You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(19) |
Nov
(18) |
Dec
(34) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(14) |
Feb
(14) |
Mar
(3) |
Apr
(10) |
May
(10) |
Jun
(17) |
Jul
(15) |
Aug
(24) |
Sep
(24) |
Oct
(11) |
Nov
(13) |
Dec
(15) |
| 2008 |
Jan
(10) |
Feb
(46) |
Mar
(20) |
Apr
(42) |
May
(44) |
Jun
(22) |
Jul
(59) |
Aug
(8) |
Sep
(15) |
Oct
(52) |
Nov
(30) |
Dec
(38) |
| 2009 |
Jan
(27) |
Feb
(27) |
Mar
(47) |
Apr
(85) |
May
(74) |
Jun
(41) |
Jul
(70) |
Aug
(64) |
Sep
(97) |
Oct
(147) |
Nov
(67) |
Dec
(48) |
| 2010 |
Jan
(68) |
Feb
(33) |
Mar
(53) |
Apr
(98) |
May
(55) |
Jun
(71) |
Jul
(99) |
Aug
(132) |
Sep
(291) |
Oct
(220) |
Nov
(344) |
Dec
(300) |
| 2011 |
Jan
(57) |
Feb
(25) |
Mar
(59) |
Apr
(104) |
May
(60) |
Jun
(155) |
Jul
(143) |
Aug
(43) |
Sep
(53) |
Oct
(20) |
Nov
(35) |
Dec
(103) |
| 2012 |
Jan
(62) |
Feb
(43) |
Mar
(29) |
Apr
(80) |
May
(75) |
Jun
(61) |
Jul
(52) |
Aug
(58) |
Sep
(33) |
Oct
(32) |
Nov
(69) |
Dec
(37) |
| 2013 |
Jan
(77) |
Feb
(28) |
Mar
(52) |
Apr
(18) |
May
(37) |
Jun
(21) |
Jul
(22) |
Aug
(55) |
Sep
(29) |
Oct
(74) |
Nov
(50) |
Dec
(44) |
| 2014 |
Jan
(77) |
Feb
(62) |
Mar
(81) |
Apr
(99) |
May
(59) |
Jun
(95) |
Jul
(55) |
Aug
(34) |
Sep
(78) |
Oct
(33) |
Nov
(48) |
Dec
(51) |
| 2015 |
Jan
(56) |
Feb
(120) |
Mar
(37) |
Apr
(15) |
May
(22) |
Jun
(196) |
Jul
(54) |
Aug
(33) |
Sep
(32) |
Oct
(42) |
Nov
(149) |
Dec
(61) |
| 2016 |
Jan
(15) |
Feb
(26) |
Mar
(37) |
Apr
(27) |
May
(14) |
Jun
(11) |
Jul
(13) |
Aug
(64) |
Sep
(2) |
Oct
(36) |
Nov
(18) |
Dec
(46) |
| 2017 |
Jan
(6) |
Feb
(1) |
Mar
(2) |
Apr
(50) |
May
(42) |
Jun
(11) |
Jul
(4) |
Aug
(12) |
Sep
(11) |
Oct
(21) |
Nov
(15) |
Dec
(42) |
| 2018 |
Jan
(33) |
Feb
(27) |
Mar
(20) |
Apr
(5) |
May
(4) |
Jun
(1) |
Jul
(42) |
Aug
(29) |
Sep
(11) |
Oct
(40) |
Nov
(312) |
Dec
(18) |
| 2019 |
Jan
(44) |
Feb
(98) |
Mar
(125) |
Apr
(160) |
May
(123) |
Jun
(33) |
Jul
(56) |
Aug
(81) |
Sep
(24) |
Oct
(23) |
Nov
(52) |
Dec
(86) |
| 2020 |
Jan
(6) |
Feb
(17) |
Mar
(62) |
Apr
(21) |
May
(118) |
Jun
(42) |
Jul
(52) |
Aug
(62) |
Sep
(20) |
Oct
(5) |
Nov
(23) |
Dec
(111) |
| 2021 |
Jan
(31) |
Feb
(8) |
Mar
(26) |
Apr
(13) |
May
(54) |
Jun
(31) |
Jul
(17) |
Aug
(10) |
Sep
(83) |
Oct
(8) |
Nov
(21) |
Dec
(33) |
| 2022 |
Jan
(67) |
Feb
(11) |
Mar
(4) |
Apr
(46) |
May
(12) |
Jun
(17) |
Jul
(19) |
Aug
(7) |
Sep
(53) |
Oct
(14) |
Nov
(29) |
Dec
(22) |
| 2023 |
Jan
(20) |
Feb
(4) |
Mar
(37) |
Apr
(25) |
May
(15) |
Jun
(20) |
Jul
(38) |
Aug
(1) |
Sep
(1) |
Oct
(34) |
Nov
|
Dec
(8) |
| 2024 |
Jan
(15) |
Feb
(10) |
Mar
|
Apr
(4) |
May
(23) |
Jun
|
Jul
(8) |
Aug
(2) |
Sep
(18) |
Oct
(1) |
Nov
(18) |
Dec
(15) |
| 2025 |
Jan
(5) |
Feb
(1) |
Mar
(7) |
Apr
(4) |
May
(18) |
Jun
(7) |
Jul
|
Aug
(17) |
Sep
(13) |
Oct
(15) |
Nov
(5) |
Dec
(37) |
|
From: <vl...@us...> - 2006-11-15 12:14:30
|
Revision: 35
http://svn.sourceforge.net/scst/?rev=35&view=rev
Author: vlnb
Date: 2006-11-15 04:13:57 -0800 (Wed, 15 Nov 2006)
Log Message:
-----------
A small patch to fix command "Send cue sheet" transfer length.
In mmc5, it is from cdb 6-8.
Signed-Off-By Ming Zhang
Modified Paths:
--------------
trunk/scst/src/scst_lib.c
Modified: trunk/scst/src/scst_lib.c
===================================================================
--- trunk/scst/src/scst_lib.c 2006-11-14 18:44:47 UTC (rev 34)
+++ trunk/scst/src/scst_lib.c 2006-11-15 12:13:57 UTC (rev 35)
@@ -1438,8 +1438,7 @@
info_p->transfer_len = (*(cdb_p + 8));
/* opcode = READ-WRITE UPDATED BLOCK */
- if ((ptr->ops == 0x5d) ||
- (ptr->ops == UPDATE_BLOCK) ||
+ if ((ptr->ops == UPDATE_BLOCK) ||
(ptr->ops == WRITE_SAME)) {
/* the opcode always returns 1 block */
info_p->flags |= SCST_TRANSFER_LEN_TYPE_FIXED;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mga...@us...> - 2006-11-14 19:00:13
|
Revision: 34
http://svn.sourceforge.net/scst/?rev=34&view=rev
Author: mgandalf
Date: 2006-11-14 10:44:47 -0800 (Tue, 14 Nov 2006)
Log Message:
-----------
Increase sleep for init script between stop/start
Modified Paths:
--------------
trunk/scstadmin/init.d/scst
Modified: trunk/scstadmin/init.d/scst
===================================================================
--- trunk/scstadmin/init.d/scst 2006-11-14 12:56:57 UTC (rev 33)
+++ trunk/scstadmin/init.d/scst 2006-11-14 18:44:47 UTC (rev 34)
@@ -46,7 +46,7 @@
;;
force-reload|restart)
$0 stop
- sleep 1
+ sleep 5
$0 start
;;
reload-config)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-11-14 12:57:12
|
Revision: 33
http://svn.sourceforge.net/scst/?rev=33&view=rev
Author: vlnb
Date: 2006-11-14 04:56:57 -0800 (Tue, 14 Nov 2006)
Log Message:
-----------
The initial commit of 0.9.5-pre1 version
Added Paths:
-----------
trunk/scstadmin/
trunk/scstadmin/Changes
trunk/scstadmin/LICENSE
trunk/scstadmin/README
trunk/scstadmin/SCST/
trunk/scstadmin/SCST/SCST.pm
trunk/scstadmin/examples/
trunk/scstadmin/examples/scst.conf
trunk/scstadmin/examples/scst_example.sql
trunk/scstadmin/init.d/
trunk/scstadmin/init.d/scst
trunk/scstadmin/scst.conf
trunk/scstadmin/scst_db/
trunk/scstadmin/scst_db/scst_db
trunk/scstadmin/scst_db/scst_db.conf
trunk/scstadmin/scst_db/scst_schema.sql
trunk/scstadmin/scstadmin
Added: trunk/scstadmin/Changes
===================================================================
--- trunk/scstadmin/Changes (rev 0)
+++ trunk/scstadmin/Changes 2006-11-14 12:56:57 UTC (rev 33)
@@ -0,0 +1,17 @@
+Changes since 0.9.2-pre2:
+
+- List SCST sessions
+- Verify specified config file against live configuration and show differences
+- Write config file based on live configuration
+- Force-apply configuration, even config deletions with a force flag.
+- Added new option types
+- Added support for specifying a blocksize
+- Added "-reload-config" to init script
+
+Changes since 0.9.5-pre0:
+
+- Renamed scst to scstadmin
+- Fixed writeConfiguration() to properly write DEVICE lines with no options
+- Removed the comment which prevented a target from being enabled in enableTarget()
+- Updated init.d/scst to use scstadmin instead of scst_db
+- Fixup of README file
Added: trunk/scstadmin/LICENSE
===================================================================
--- trunk/scstadmin/LICENSE (rev 0)
+++ trunk/scstadmin/LICENSE 2006-11-14 12:56:57 UTC (rev 33)
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
+
Added: trunk/scstadmin/README
===================================================================
--- trunk/scstadmin/README (rev 0)
+++ trunk/scstadmin/README 2006-11-14 12:56:57 UTC (rev 33)
@@ -0,0 +1,53 @@
+SCST Configuration/Administration scripts. Here you'll find scstadmin which reads
+a configuration file /etc/scst.conf, or one if your choosing. With it you can manually
+or automatically configure every aspect of SCST incuding enabling/disabling target mode
+on your target SCSI controller. The old directory contains scst_db which uses a mysql
+backend database to configure SCST but doesn't handle all the things scstadmin handles.
+The perl module SCST::SCST is very generic and tries to handle error checking as well.
+
+The init script was written for debian but should work on most distributions.
+
+ SCST This is the SCST Perl module required by scstadmin and scst_db.
+ Copy the SCST directory to your perl5 lib directory:
+ #> cp -r SCST /usr/lib/perl5/
+
+ scstadmin Script which can accept operations on a command line or from
+ a configuration file. See scst.conf. For command help,
+ #> scstadmin
+
+ old Script which configures SCST using configurations
+ found in a database. See the examples directory database
+ schema and example data. You will need to edit the
+ config file scst_db.conf to refect your environment.
+
+ scst.conf Configuration file for scst script. Usually stored
+ in /etc.
+
+ examples Configuration examples.
+
+ init.d/scst Init script to start SCST on boot which uses scstadmin.
+
+
+Getting Started:
+
+The scstadmin script is much more functional than scst_db at this point but uses a
+standard text-based config file. The original thought behind scst_db was to write
+a daemon process which would except network connections and issue SCST commands. A
+client app would then connect to that port.
+
+Copy scst.conf to /etc and edit it to your liking. if you have an existing configuration
+then have scstadmin write it out to a config file for you:
+
+#> scstadmin -WriteConfig /etc/scst.conf
+
+When removing devices, users or groups from the config file keep in mind that
+"scstadmin -config" will NOT remove those configurations from the running system unless
+you use the -ForceConfig flag. Also, using the init script to reload the configuration
+
+#> /etc/init.d/scst -reload-config
+
+will also not remove configurations from a running system.
+
+
+Mar...@gm...
+
Added: trunk/scstadmin/SCST/SCST.pm
===================================================================
--- trunk/scstadmin/SCST/SCST.pm (rev 0)
+++ trunk/scstadmin/SCST/SCST.pm 2006-11-14 12:56:57 UTC (rev 33)
@@ -0,0 +1,1011 @@
+package SCST::SCST;
+
+# Author: Mark R. Buechler
+# Copyright (c) 2005, 2006 Mark R. Buechler
+
+use 5.005;
+use IO::Handle;
+use IO::File;
+use strict;
+use Carp;
+
+my $TRUE = 1;
+my $FALSE = 0;
+
+my $_SCST_DIR_ = '/proc/scsi_tgt';
+my $_SCST_IO_ = $_SCST_DIR_.'/scsi_tgt';
+my $_SCST_CDROM_IO_ = $_SCST_DIR_.'/dev_cdrom/dev_cdrom';
+my $_SCST_CHANGER_IO_ = $_SCST_DIR_.'/dev_changer/dev_changer';
+my $_SCST_DISK_IO_ = $_SCST_DIR_.'/dev_disk/dev_disk';
+my $_SCST_DISK_FILE_IO_ = $_SCST_DIR_.'/disk_fileio/disk_fileio';
+my $_SCST_CDROM_FILE_IO_ = $_SCST_DIR_.'/cdrom_fileio/cdrom_fileio';
+my $_SCST_DISKP_IO_ = $_SCST_DIR_.'/dev_disk_perf/dev_disk_perf';
+my $_SCST_MODISK_IO_ = $_SCST_DIR_.'/dev_modisk/dev_modisk';
+my $_SCST_MODISKP_IO_ = $_SCST_DIR_.'/dev_modisk_perf/dev_modisk_perf';
+my $_SCST_TAPE_IO_ = $_SCST_DIR_.'/dev_tape/dev_tape';
+my $_SCST_TAPEP_IO_ = $_SCST_DIR_.'/dev_tape_perf/dev_tape_perf';
+my $_SCST_GROUPS_DIR_ = $_SCST_DIR_.'/groups';
+my $_SCST_SGV_STATS_ = $_SCST_DIR_.'/sgv';
+my $_SCST_SESSIONS_ = $_SCST_DIR_.'/sessions';
+my $_SCST_VERSION_IO_ = $_SCST_DIR_.'/version';
+
+my $_SCST_USERS_IO_ = 'names';
+my $_SCST_DEVICES_IO_ = 'devices';
+
+my @_AVAILABLE_OPTIONS_ = ('WRITE_THROUGH', 'O_DIRECT', 'READ_ONLY', 'NULLIO', 'NV_CACHE');
+
+use vars qw(@ISA @EXPORT $VERSION $CDROM_TYPE $CHANGER_TYPE $DISK_TYPE $DISKFILE_TYPE
+ $CDROMFILE_TYPE $DISKPERF_TYPE $MODISK_TYPE $MODISKPERF_TYPE $TAPE_TYPE
+ $TAPEPERF_TYPE);
+
+$CDROM_TYPE = 1;
+$CHANGER_TYPE = 2;
+$DISK_TYPE = 3;
+$DISKFILE_TYPE = 4;
+$CDROMFILE_TYPE = 5;
+$DISKPERF_TYPE = 6;
+$MODISK_TYPE = 7;
+$MODISKPERF_TYPE = 8;
+$TAPE_TYPE = 9;
+$TAPEPERF_TYPE = 10;
+
+$VERSION = 0.6;
+
+my $_SCST_MIN_MAJOR_ = 0;
+my $_SCST_MIN_MINOR_ = 9;
+my $_SCST_MIN_RELEASE_ = 5;
+
+my %_IO_MAP_ = ($CDROM_TYPE => $_SCST_CDROM_IO_,
+ $CHANGER_TYPE => $_SCST_CHANGER_IO_,
+ $DISK_TYPE => $_SCST_DISK_IO_,
+ $DISKFILE_TYPE => $_SCST_DISK_FILE_IO_,
+ $CDROMFILE_TYPE => $_SCST_CDROM_FILE_IO_,
+ $DISKPERF_TYPE => $_SCST_DISKP_IO_,
+ $MODISK_TYPE => $_SCST_MODISK_IO_,
+ $MODISKPERF_TYPE => $_SCST_MODISKP_IO_,
+ $TAPE_TYPE => $_SCST_TAPE_IO_,
+ $TAPEPERF_TYPE => $_SCST_TAPEP_IO_);
+
+my %_TYPE_MAP_ = ('dev_cdrom' => $CDROM_TYPE,
+ 'dev_changer' => $CHANGER_TYPE,
+ 'dev_disk' => $DISK_TYPE,
+ 'disk_fileio' => $DISKFILE_TYPE,
+ 'cdrom_fileio' => $CDROMFILE_TYPE,
+ 'dev_disk_perf' => $DISKPERF_TYPE,
+ 'dev_modisk' => $MODISK_TYPE,
+ 'dev_modisk_perf' => $MODISKPERF_TYPE,
+ 'dev_tape' => $TAPE_TYPE,
+ 'dev_tape_perf' => $TAPEPERF_TYPE);
+
+sub new {
+ my $this = shift;
+ my $debug = shift;
+ my $badVersion = $TRUE;
+
+ my $class = ref($this) || $this;
+ my $self = {};
+
+ bless($self, $class);
+
+ $self->{'debug'} = $debug if $debug;
+
+ my $scstVersion = $self->scstVersion();
+
+ my($major, $minor, $release) = split(/\./, $scstVersion, 3);
+
+ $badVersion = $FALSE if (($major > $_SCST_MIN_MAJOR_) ||
+ (($major == $_SCST_MIN_MAJOR_) && ($minor > $_SCST_MIN_MINOR_)) ||
+ (($major == $_SCST_MIN_MAJOR_) && ($minor == $_SCST_MIN_MINOR_) && ($release >= $_SCST_MIN_RELEASE_)));
+
+ croak("This module requires at least SCST version $_SCST_MIN_MAJOR_\.$_SCST_MIN_MINOR_\.".
+ "$_SCST_MIN_RELEASE_ and version $scstVersion was found") if ($badVersion);
+
+ return $self;
+}
+
+sub scstVersion {
+ my $self = shift;
+
+ my $io = new IO::File $_SCST_VERSION_IO_, O_RDONLY;
+ return $TRUE if (!$io);
+
+ my $version = <$io>;
+ chomp $version;
+
+ return $version;
+}
+
+sub groups {
+ my $self = shift;
+ my @groups;
+ my $dirHandle = new IO::Handle;
+
+ opendir $dirHandle, $_SCST_GROUPS_DIR_ or return undef;
+
+ foreach my $entry (readdir($dirHandle)) {
+ next if (($entry eq '.') || ($entry eq '..'));
+
+ push @groups, $entry;
+ }
+
+ close $dirHandle;
+
+ return \@groups;
+}
+
+sub groupExists {
+ my $self = shift;
+ my $group = shift;
+ my $groups = $self->groups();
+
+ foreach my $_group (@{$groups}) {
+ return $TRUE if ($group eq $_group);
+ }
+
+ return $FALSE;
+}
+
+sub addGroup {
+ my $self = shift;
+ my $group = shift;
+
+ return 2 if ($self->groupExists($group));
+
+ my $io = new IO::File $_SCST_IO_, O_WRONLY;
+ return $TRUE if (!$io);
+
+ my $cmd = "add_group $group\n";
+
+ if ($self->{'debug'}) {
+ print "DBG($$): $_SCST_IO_ -> $cmd\n";
+ } else {
+ print $io $cmd;
+ }
+
+ close $io;
+
+ return $FALSE if ($self->{'debug'});
+ return !$self->groupExists($group);
+}
+
+sub removeGroup {
+ my $self = shift;
+ my $group = shift;
+
+ return 2 if (!$self->groupExists($group));
+
+ my $io = new IO::File $_SCST_IO_, O_WRONLY;
+ return $TRUE if (!$io);
+
+ my $cmd = "del_group $group\n";
+
+ if ($self->{'debug'}) {
+ print "DBG($$): $_SCST_IO_ -> $cmd\n";
+ } else {
+ print $io $cmd;
+ }
+
+ close $io;
+
+ return $FALSE if ($self->{'debug'});
+ return $self->groupExists($group);
+}
+
+sub sgvStats {
+ my $self = shift;
+ my $io = new IO::File $_SCST_SGV_STATS_, O_RDONLY;
+ my %stats;
+ my $first = $TRUE;
+
+ return undef if (!$io);
+
+ while (my $line = <$io>) {
+ chomp $line;
+
+ if ($first || !$line) {
+ $first = $FALSE;
+ next;
+ }
+
+ my $size;
+ my $stat;
+ my $hit;
+ my $total;
+
+ if ($line !~ /^\s/) {
+ ($stat, $hit, $total) = split(/\s+/, $line);
+
+ $size = 'ALL';
+ if ($stat eq 'big') {
+ $total = $hit;
+ $hit = -1;
+ }
+ } else {
+ (undef, $stat, $hit, $total) = split(/\s+/, $line);
+
+ if ($stat =~ /(\d+)K$/) {
+ $size = $1;
+ $stat =~ s/\-$size\K//;
+ }
+ }
+
+ $stats{$stat}->{$size}->{'HITS'} = $hit;
+ $stats{$stat}->{$size}->{'TOTAL'} = $total;
+ }
+
+ close $io;
+
+ return \%stats;
+}
+
+sub sessions {
+ my $self = shift;
+ my $io = new IO::File $_SCST_SESSIONS_, O_RDONLY;
+ my %sessions;
+ my $first = $TRUE;
+
+ return undef if (!$io);
+
+ while (my $line = <$io>) {
+ chomp $line;
+
+ if ($first) {
+ $first = $FALSE;
+ next;
+ }
+
+ my($target, $user, $group, $commands) = split(/\s+/, $line);
+
+ $sessions{$target}->{$group}->{$user} = $commands;
+ }
+
+ close $io;
+
+ return \%sessions;
+}
+
+sub devices {
+ my $self = shift;
+ my $io = new IO::File $_SCST_IO_, O_RDONLY;
+ my %devices;
+ my $first = $TRUE;
+
+ return undef if (!$io);
+
+ while (my $line = <$io>) {
+ chomp $line;
+
+ if ($first) {
+ $first = $FALSE;
+ next;
+ }
+
+ my($vname, $handler) = split(/\s+/, $line);
+ $devices{$vname} = $_TYPE_MAP_{$handler};
+ }
+
+ close $io;
+
+ return \%devices;
+}
+
+sub handlerDevices {
+ my $self = shift;
+ my $handler = shift;
+ my $handler_io = $_IO_MAP_{$handler};
+ my $first = $TRUE;
+ my %devices;
+
+ return undef if (!$handler_io);
+ return undef if (!$self->handlerExists($handler));
+
+ my $io = new IO::File $handler_io, O_RDONLY;
+ return undef if (!$io);
+
+ while (my $line = <$io>) {
+ chomp $line;
+
+ if ($first) {
+ $first = $FALSE;
+ next;
+ }
+
+ my ($vname, $size, $blocksize, $options, $path) = split(/\s+/, $line);
+
+ if ($options =~ /^\//) {
+ $path = $options;
+ $options = "";
+ }
+
+ $devices{$vname}->{'OPTIONS'} = $self->cleanupString($options);
+ $devices{$vname}->{'SIZE'} = $self->cleanupString($size);
+ $devices{$vname}->{'PATH'} = $self->cleanupString($path);
+ $devices{$vname}->{'BLOCKSIZE'} = $self->cleanupString($blocksize);
+ }
+
+ close $io;
+
+ return \%devices;
+}
+
+sub handlerDeviceExists {
+ my $self = shift;
+ my $handler = shift;
+ my $device = shift;
+ my $devices = $self->handlerDevices($handler);
+
+ return -1 if (!defined($devices));
+ return $TRUE if (defined($$devices{$device}));
+
+ return $FALSE;
+}
+
+sub openDevice {
+ my $self = shift;
+ my $handler = shift;
+ my $device = shift;
+ my $path = shift;
+ my $options = shift;
+ my $blocksize = shift;
+ my $handler_io = $_IO_MAP_{$handler};
+
+ return $TRUE if ($self->checkOptions($options));
+ return $TRUE if (!$handler_io);
+ return $TRUE if (!$self->handlerExists($handler));
+ return 2 if ($self->handlerDeviceExists($handler, $device));
+
+ $options = $self->cleanupString($options);
+
+ my $cmd = "open $device $path $blocksize $options\n";
+
+ $cmd = $self->cleanupString($cmd);
+
+ my $rc = $self->handler_private($handler_io, $cmd);
+
+ return $FALSE if ($self->{'debug'});
+ return $rc if ($rc);
+ return !$self->handlerDeviceExists($handler, $device);
+}
+
+sub closeDevice {
+ my $self = shift;
+ my $handler = shift;
+ my $device = shift;
+ my $path = shift;
+ my $handler_io = $_IO_MAP_{$handler};
+
+ return $TRUE if (!$handler_io);
+ return $TRUE if (!$self->handlerExists($handler));
+ return 2 if (!$self->handlerDeviceExists($handler, $device));
+
+ my $cmd = "close $device $path\n";
+
+ my $rc = $self->handler_private($handler_io, $cmd);
+
+ return $FALSE if ($self->{'debug'});
+ return $rc if ($rc);
+ return $self->handlerDeviceExists($handler, $device);
+}
+
+sub userExists {
+ my $self = shift;
+ my $user = shift;
+ my $group = shift;
+
+ my $users = $self->users($group);
+
+ return -1 if (!defined($users));
+
+ foreach my $_user (@{$users}) {
+ return $TRUE if ($user eq $_user);
+ }
+
+ return $FALSE;
+}
+
+sub users {
+ my $self = shift;
+ my $group = shift;
+ my @users;
+
+ return undef if (!$self->groupExists($group));
+
+ my $io = new IO::File $_SCST_GROUPS_DIR_."/$group/".$_SCST_USERS_IO_, O_RDONLY;
+ return undef if (!$io);
+
+ while (my $line = <$io>) {
+ chomp $line;
+
+ push @users, $line;
+ }
+
+ close $io;
+
+ return \@users;
+}
+
+sub addUser {
+ my $self = shift;
+ my $user = shift;
+ my $group = shift;
+
+ return $TRUE if (!$self->groupExists($group));
+ return 2 if ($self->userExists($user, $group));
+
+ my $cmd = "add $user\n";
+
+ my $rc = $self->group_private($group, $_SCST_USERS_IO_, $cmd);
+
+ return $FALSE if ($self->{'debug'});
+ return $rc if ($rc);
+ return !$self->userExists($user, $group);
+}
+
+sub removeUser {
+ my $self = shift;
+ my $user = shift;
+ my $group = shift;
+
+ return $TRUE if (!$self->groupExists($group));
+ return 2 if (!$self->userExists($user, $group));
+
+ my $cmd = "del $user\n";
+
+ my $rc = $self->group_private($group, $_SCST_USERS_IO_, $cmd);
+
+ return $FALSE if ($self->{'debug'});
+ return $rc if ($rc);
+ return $self->userExists($user, $group);
+}
+
+sub clearUsers {
+ my $self = shift;
+ my $group = shift;
+
+ return $TRUE if (!$self->groupExists($group));
+
+ my $cmd = "clear\n";
+
+ my $rc = $self->group_private($group, $_SCST_USERS_IO_, $cmd);
+
+ return $FALSE if ($self->{'debug'});
+ return $rc if ($rc);
+
+ my $users = $self->users($group);
+
+ return ($#{$users} + 1);
+}
+
+sub handlerExists {
+ my $self = shift;
+ my $handler = shift;
+ my $handlers = $self->handlers();
+
+ foreach my $_handler (@{$handlers}) {
+ return $TRUE if ($handler eq $_handler);
+ }
+
+ return $FALSE;
+}
+
+sub handlers {
+ my $self = shift;
+ my @handlers;
+
+ my $dirHandle = new IO::Handle;
+
+ opendir $dirHandle, $_SCST_DIR_ or return undef;
+
+ foreach my $entry (readdir($dirHandle)) {
+ next if (($entry eq '.') || ($entry eq '..'));
+
+ if ((-d $_SCST_DIR_.'/'.$entry ) && (-f $_SCST_DIR_.'/'.$entry.'/type')) {
+ push @handlers, $_TYPE_MAP_{$entry} if ($_TYPE_MAP_{$entry});
+ }
+ }
+
+ close $dirHandle;
+
+ return \@handlers;
+}
+
+sub groupDeviceExists {
+ my $self = shift;
+ my $device = shift;
+ my $group = shift;
+ my $lun = shift;
+ my $devices = $self->groupDevices($group);
+
+ return -1 if (!defined($devices));
+
+ if (defined($lun)) {
+ return $TRUE if ($$devices{$device} eq $lun);
+ } else {
+ return $TRUE if (defined($$devices{$device}));
+ }
+
+ return $FALSE;
+}
+
+sub groupDevices {
+ my $self = shift;
+ my $group = shift;
+ my %devices;
+ my $first = $TRUE;
+
+ return undef if (!$self->groupExists($group));
+
+ my $io = new IO::File $_SCST_GROUPS_DIR_."/$group/".$_SCST_DEVICES_IO_, O_RDONLY;
+ return undef if (!$io);
+
+ while (my $line = <$io>) {
+ chomp $line;
+
+ if ($first) {
+ $first = $FALSE;
+ next;
+ }
+
+ my($vname, $lun) = split(/\s+/, $line);
+
+ $devices{$vname} = $lun;
+ }
+
+ close $io;
+
+ return \%devices;
+}
+
+sub assignDeviceToGroup {
+ my $self = shift;
+ my $device = shift;
+ my $group = shift;
+ my $lun = shift;
+
+ return $TRUE if (!$self->groupExists($group));
+ return 2 if ($self->groupDeviceExists($device, $group, $lun));
+
+ my $cmd = "add $device $lun\n";
+
+ my $rc = $self->group_private($group, $_SCST_DEVICES_IO_, $cmd);
+
+ return $FALSE if ($self->{'debug'});
+ return $rc if ($rc);
+ return !$self->groupDeviceExists($device, $group, $lun);
+}
+
+sub assignDeviceToHandler {
+ my $self = shift;
+ my $device = shift;
+ my $handler = shift;
+ my $handler_io = $_IO_MAP_{$handler};
+
+ return $TRUE if (!$handler_io);
+ return $TRUE if (!$self->handlerExists($handler));
+ return 2 if ($self->handlerDeviceExists($handler, $device));
+
+ my $cmd = "assign $device $handler\n";
+
+ my $rc = $self->scst_private($cmd);
+
+ return $FALSE if ($self->{'debug'});
+ return $rc if($rc);
+ return !$self->handlerDeviceExists($handler, $device);
+}
+
+sub removeDeviceFromGroup {
+ my $self = shift;
+ my $device = shift;
+ my $group = shift;
+
+ return $TRUE if (!$self->groupExists($group));
+ return 2 if (!$self->groupDeviceExists($device, $group));
+
+ my $cmd = "del $device\n";
+
+ my $rc = $self->group_private($group, $_SCST_DEVICES_IO_, $cmd);
+
+ return $FALSE if ($self->{'debug'});
+ return $rc if ($rc);
+ return $self->groupDeviceExists($device, $group);
+}
+
+sub clearGroupDevices {
+ my $self = shift;
+ my $group = shift;
+
+ return $TRUE if (!$self->groupExists($group));
+
+ my $cmd = "clear\n";
+
+ my $rc = $self->group_private($group, $_SCST_DEVICES_IO_, $cmd);
+
+ return $FALSE if ($self->{'debug'});
+ return $rc if ($rc);
+
+ my $devices = $self->groupDevices($group);
+
+ return (keys %{$devices});
+}
+
+sub handler_private {
+ my $self = shift;
+ my $handler_io = shift;
+ my $cmd = shift;
+
+ my $io = new IO::File $handler_io, O_WRONLY;
+ return $TRUE if (!$io);
+
+ if ($self->{'debug'}) {
+ print "DBG($$): '$handler_io' -> '$cmd'\n";
+ } else {
+ print $io "$cmd\0";
+ }
+
+ close $io;
+
+ return $FALSE;
+}
+
+sub scst_private {
+ my $self = shift;
+ my $cmd = shift;
+
+ my $io = new IO::File $_SCST_IO_, O_WRONLY;
+ return $TRUE if (!$io);
+
+ if ($self->{'debug'}) {
+ print "DBG($$): '$_SCST_IO_' -> '$cmd'\n";
+ } else {
+ print $io "$cmd\0";
+ }
+
+ close $io;
+
+ return $FALSE;
+}
+
+sub group_private {
+ my $self = shift;
+ my $group = shift;
+ my $file = shift;
+ my $cmd = shift;
+
+ my $io = new IO::File $_SCST_GROUPS_DIR_."/$group/".$file, O_WRONLY;
+ return $TRUE if (!$io);
+
+ if ($self->{'debug'}) {
+ print "DBG($$): $_SCST_GROUPS_DIR_/$group/$file -> $cmd\n";
+ } else {
+ print $io "$cmd\0";
+ }
+
+ close $io;
+
+ return $FALSE;
+}
+
+sub checkOptions {
+ my $self = shift;
+ my $options = shift;
+
+ return if (!$options);
+
+ foreach my $option (split(/\s+/, $options)) {
+ foreach my $avail (@_AVAILABLE_OPTIONS_) {
+ return $FALSE if ($avail eq $option);
+ }
+ }
+
+ return $TRUE;
+}
+
+sub cleanupString {
+ my $self = shift;
+ my $string = shift;
+
+ $string =~ s/^\s+//;
+ $string =~ s/\s+$//;
+
+ return $string;
+}
+
+;1 __END__
+
+=head1 NAME
+
+SCST::SCST - Generic SCST methods.
+
+=head1 SYNOPSIS
+
+ use SCST::SCST;
+
+ $p = SCST::SCST->new();
+
+ print "Using SCST version".$p->scstVersion()."\n";
+
+ if ($p->handlerDeviceExists($SCST::SCST::DISKFILE_TYPE)) {
+ print "openDevice() failed\n"
+ if ($p->openDevice($SCST::SCST::DISKFILE_TYPE, 'DISK01', '/vdisk/disk01.dsk'));
+ }
+
+ undef $p;
+
+=head1 DESCRIPTION
+
+Generic SCST methods.
+
+=head2 Methods
+
+=over 5
+
+=item SCST::SCST->new();
+
+Create a new SCST object. If the argument $debug is non-zero no changes
+will be made.
+
+Arguments: (bool) $debug
+
+Returns: (object) $new
+
+=item SCST::SCST->scstVersion();
+
+Returns the version of SCST running.
+
+Arguments: void
+
+Returns: (string) $version
+
+=item SCST::SCST->groups();
+
+Returns a list of security groups configured.
+
+Arguments: void
+
+Returns: (array ref) $groups
+
+=item SCST::SCST->groupExists();
+
+Checks for a specified group's existance.
+
+Arguments: (string) $group
+
+Returns: (boolean) $groupExists
+
+=item SCST::SCST->addGroup();
+
+Adds a security group to SCST's configuration. Returns 0 upon success, 1 if
+unsuccessfull and 2 if the group already exists.
+
+Arguments: (string) $group
+
+Returns: (int) $success
+
+=item SCST::SCST->removeGroup();
+
+Removes a group from SCST's configuration. Returns 0 upon success, 1 if
+unsuccessfull and 2 if group does not exist.
+
+=item SCST::SCST->sgvStats();
+
+Returns a hash of stats gathered from /proc/scsi_tgt/sgv.
+
+Arguments: void
+
+Returns: (hash ref) $stats
+
+Hash Layout: See /proc/scsi_tgt/sgv for tokens. This methods simply hashes
+what's found there and returns it with no further processing.
+
+=item SCST::SCST->sessions();
+
+Returns a hash of current SCST initiator sessions.
+
+Arguments: void
+
+Returns: (hash ref) $sessions
+
+Hash Layout: See /proc/scsi_tgt/sessions for tokens. This methods simply hashes
+what's found there and returns it with no further processing.
+
+=item SCST::SCST->devices();
+
+Returns a hash of devices configured without regard to device handler.
+
+Arguments: void
+
+Returns: (hash ref) $devices
+
+Hash Layout: (string) $device = (int) $handler
+
+=item SCST::SCST->handlerDevices();
+
+Returns a hash of devices configured for a specified device handler.
+
+Arguments: (int) $handler
+
+Returns: (hash ref) $devices
+
+Hash Layout: (string) $device -> SIZE = (int) $deviceSize
+ (string) $device -> PATH = (string) $devicePath
+ (string) $device -> OPTIONS = (string) $options (comma seperated)
+
+=item SCST::SCST->handlerDeviceExists();
+
+Checks for a specified device is configured for a specified device handler.
+
+Arguments: (int) $handler, (string) $device
+
+Returns: (boolean) $deviceExists
+
+=item SCST::SCST->openDevice();
+
+Opens an already existing specified device for the specified device handler.
+Returns 0 upon success, 1 if unsuccessfull and 2 if the device already exists.
+
+Available options for the parameter $options are: WRITE_THROUGH, READ_ONLY, O_DIRECT
+
+Arguments: (int) $handler, (string) $device, (string) $path [, (string) $options]
+
+Returns: (int) $success
+
+=item SCST::SCST->closeDevice();
+
+Closes an open device configured for the specified device handler. Returns
+0 upon success, 1 if unsuccessfull and 2 of the device does not exist.
+
+Arguments: (int) $handler, (string) $device, (string) $path
+
+Returns: (int) $success
+
+=item SCST::SCST->userExists();
+
+Checks for a specified user with the specified security group.
+
+Arguments: (string) $user, (string) $group
+
+Returns (boolean) $userExists
+
+=item SCST::SCST->users();
+
+Returns a list of users configured for a given security group.
+
+Arguments: (string) $group
+
+Returns: (hash ref) $users
+
+=item SCST::SCST->addUser();
+
+Adds the specified user to the specified security group. Returns 0
+upon success, 1 if unsuccessfull and 2 if the user already exists.
+
+Arguments: (string) $user, (string) $group
+
+Returns: (int) $success
+
+=item SCST::SCST->removeUser();
+
+Removed the specified user from the specified security group. Returns
+0 upon success, 1 if unsuccessfull and 2 if the user does not exist.
+
+Arguments: (string) $user, (string) $group
+
+Returns: (int) $success
+
+=item SCST::SCST->clearUsers();
+
+Removes all users from the specified security group. Returns 0 upon
+success or 1 if unsuccessfull.
+
+Arguments: (string) $group
+
+Returns: (int) $success
+
+=item SCST::SCST->handlerExists();
+
+Checks if a specified device handler exists within SCST's configuration.
+
+Arguments: (int) $handler
+
+Returns: (boolean) $handlerExists
+
+=item SCST::SCST->handlers();
+
+Returns a list of configured device handlers.
+
+Arguments: void
+
+Returns: (array ref) $handlers
+
+=item SCST::SCST->groupDeviceExists();
+
+Checks if a specified device is assigned to a specified security group.
+If the optional $lun argument is specified, this method also matches
+the lun.
+
+Arguments: (string) $device, (string) $group [, (int) $lun]
+
+Returns: (boolean) $deviceExists
+
+=item SCST::SCST->groupDevices();
+
+Returns a hash if devices assigned to the specified security group.
+
+Arguments: (string) $group
+
+Returns: (hash ref) $devices
+
+Hash Layout: (string) $device = (int) $lun
+
+=item SCST::SCST->assignDeviceToGroup();
+
+Assigns the specified device to the specified security group. Returns
+0 upon success, 1 if unsuccessfull and 2 if the device has already
+been assigned to the specified security group.
+
+Arguments: (string) $device, (string) $group, (int) $lun
+
+Returns: (int) $success
+
+=item SCST::SCST->assignDeviceToHandler();
+
+Assigns specified device to specified handler. Returns 0 upon success,
+1 if unsuccessfull and 2 if the specified device is already assigned to
+the specified handler.
+
+Arguments: (string) $device, (string) $handler
+
+Returns: (int) $success
+
+=item SCST::SCST->removeDeviceFromGroup();
+
+Removes the specified device from the specified security group. Returns
+0 upon success, 1 if unsuccessfull and 2 if the device has not been
+assigned to the specified security group.
+
+Arguments: (string) $device, (string) $group
+
+Returns: (int) $success
+
+=item SCST::SCST->clearGroupDevices();
+
+Removes all devices from the specified security group. Returns 0 upon
+success or 1 if unsuccessfull.
+
+Arguments: (string) $group
+
+Returns: (int) $success
+
+=back
+
+=head1 WARNING
+
+None at this time.
+
+=head1 NOTES
+
+If the $debug parameter is specified on package new(), no actions are
+performed. Rather they are printed to STDOUT and 0 is returned.
+
+Available Device Handlers:
+
+CDROM_TYPE,
+CHANGER_TYPE,
+DISK_TYPE,
+DISKFILE_TYPE,
+CDROMFILE_TYPE,
+DISKPERF_TYPE,
+MODISK_TYPE,
+MODISKPERF_TYPE,
+TAPE_TYPE,
+TAPEPERF_TYPE
+
+To specify a device handler to a method, use the following syntax:
+
+$SCST::SCST::<handler type>
+
+For example:
+
+$SCST::SCST::MODISK_TYPE
+
+=cut
Added: trunk/scstadmin/examples/scst.conf
===================================================================
--- trunk/scstadmin/examples/scst.conf (rev 0)
+++ trunk/scstadmin/examples/scst.conf 2006-11-14 12:56:57 UTC (rev 33)
@@ -0,0 +1,91 @@
+# Automatically generated by scst.
+
+[HANDLER disk_fileio]
+DEVICE GW15K000,/dev/evms/GW15K000,512
+DEVICE GW15K001,/dev/evms/GW15K001,512
+DEVICE MP15K004,/dev/evms/MP15K004,512
+DEVICE MP15K005,/dev/evms/MP15K005,512
+DEVICE MP15K006,/dev/evms/MP15K006,512
+DEVICE MP15K007,/dev/evms/MP15K007,512
+DEVICE MP15K008,/dev/evms/MP15K008,512
+DEVICE MP15K009,/dev/evms/MP15K009,512
+DEVICE MP15K00a,/dev/evms/MP15K00a,512
+DEVICE MP15K00b,/dev/evms/MP15K00b,512
+DEVICE MP15K00c,/dev/evms/MP15K00c,512
+DEVICE MP15K00d,/dev/evms/MP15K00d,512
+DEVICE MP15K00e,/dev/evms/MP15K00e,512
+DEVICE MS10K006,/dev/evms/MS10K002,512
+DEVICE MS15K000,/dev/evms/MS15K000,512
+DEVICE MS15K001,/dev/evms/MS15K001,512
+DEVICE MS15K002,/dev/evms/MS15K002,512
+DEVICE MS15K005,/dev/evms/MS15K003,512
+DEVICE RG10K000,/dev/evms/RG10K000,512
+DEVICE RG72K001,/dev/evms/RG72K001,512
+
+[HANDLER cdrom_fileio]
+
+[GROUP CORBIN2_a]
+USER 21:00:00:e0:8b:11:8d:8a
+
+[GROUP CORBIN3_a]
+USER 21:00:00:e0:8b:03:9e:1a
+
+[GROUP MENTASM_a]
+USER 21:00:00:e0:8b:11:06:8a
+
+[GROUP PC1_a]
+USER 21:00:00:e0:8b:11:3f:8d
+
+[GROUP PC2_a]
+USER 21:00:00:e0:8b:03:d8:4a
+
+[GROUP PC3_a]
+USER 21:00:00:e0:8b:13:ba:01
+
+[GROUP PC4_a]
+USER 21:00:00:e0:8b:11:a6:8b
+
+[GROUP RAISTLIN_a]
+USER 21:00:00:e0:8b:11:75:8b
+
+[ASSIGNMENT CORBIN2_a]
+DEVICE MP15K009,0
+DEVICE MS10K006,1
+DEVICE RG10K000,2
+DEVICE RG72K001,3
+
+[ASSIGNMENT CORBIN3_a]
+DEVICE MP15K00d,0
+
+[ASSIGNMENT Default]
+DEVICE GW15K000,0
+DEVICE GW15K001,1
+
+[ASSIGNMENT MENTASM_a]
+DEVICE MP15K006,0
+DEVICE MP15K008,1
+DEVICE MP15K00e,2
+
+[ASSIGNMENT PC1_a]
+DEVICE MS15K000,0
+
+[ASSIGNMENT PC2_a]
+DEVICE MS15K005,0
+
+[ASSIGNMENT PC3_a]
+DEVICE MP15K00c,0
+
+[ASSIGNMENT PC4_a]
+DEVICE MP15K005,0
+DEVICE MP15K007,1
+
+[ASSIGNMENT RAISTLIN_a]
+DEVICE MP15K00a,0
+DEVICE MP15K00b,1
+
+[TARGETS enable]
+HOST 0x50060b0000397178
+HOST 0x50060b000039717a
+
+[TARGETS disable]
+
Added: trunk/scstadmin/examples/scst_example.sql
===================================================================
--- trunk/scstadmin/examples/scst_example.sql (rev 0)
+++ trunk/scstadmin/examples/scst_example.sql 2006-11-14 12:56:57 UTC (rev 33)
@@ -0,0 +1,185 @@
+-- MySQL dump 10.10
+--
+-- Host: localhost Database: scst
+-- ------------------------------------------------------
+-- Server version 5.0.26-Debian_1-log
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `assignments`
+--
+
+DROP TABLE IF EXISTS `assignments`;
+CREATE TABLE `assignments` (
+ `device_id` int(8) NOT NULL default '0',
+ `type_id` char(2) default NULL,
+ `group_id` int(4) NOT NULL default '0',
+ `host_id` int(2) NOT NULL default '0',
+ `target_id` int(2) NOT NULL default '0',
+ `target_lun` int(3) NOT NULL default '0',
+ PRIMARY KEY (`device_id`,`group_id`,`host_id`,`target_id`,`target_lun`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `assignments`
+--
+
+LOCK TABLES `assignments` WRITE;
+/*!40000 ALTER TABLE `assignments` DISABLE KEYS */;
+INSERT INTO `assignments` VALUES (5,'MS',13,0,0,0),(5,'MP',11,0,0,0),(13,'MP',6,0,0,0),(0,'GW',1,0,0,0),(1,'GW',1,0,0,1),(12,'MP',12,0,0,0),(6,'MP',8,0,0,0),(8,'MP',8,0,0,1),(9,'MP',9,0,0,0),(10,'MP',10,0,0,0),(11,'MP',10,0,0,1),(7,'MP',11,0,0,1),(14,'MP',8,0,0,2),(0,'MS',7,0,0,0),(1,'RG',9,0,0,3),(0,'RG',9,0,0,2),(6,'MS',9,0,0,1);
+/*!40000 ALTER TABLE `assignments` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `device_types`
+--
+
+DROP TABLE IF EXISTS `device_types`;
+CREATE TABLE `device_types` (
+ `type_id` char(2) NOT NULL default '',
+ `type_name` char(100) NOT NULL default '',
+ PRIMARY KEY (`type_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `device_types`
+--
+
+LOCK TABLES `device_types` WRITE;
+/*!40000 ALTER TABLE `device_types` DISABLE KEYS */;
+INSERT INTO `device_types` VALUES ('GW','Gateway Communication Device'),('MP','Mirrored Pair Device'),('SV','Snapshot Device'),('SD','Single Disk Device (Unprotected)'),('SS','Stripe Set (VERY Unprotected)'),('RG','Raid 5 Group Device'),('MS','Mirrored Stripe Device');
+/*!40000 ALTER TABLE `device_types` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `devices`
+--
+
+DROP TABLE IF EXISTS `devices`;
+CREATE TABLE `devices` (
+ `device_id` int(8) NOT NULL default '0',
+ `type_id` char(2) NOT NULL default '',
+ `perf_id` char(3) NOT NULL default '',
+ `md_uuid` char(40) default NULL,
+ `device_path` char(100) default NULL,
+ `options` char(50) default NULL,
+ `blocksize` int(6) default NULL,
+ `scst_handlr_id` int(2) NOT NULL default '0',
+ PRIMARY KEY (`device_id`,`type_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=29 DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `devices`
+--
+
+LOCK TABLES `devices` WRITE;
+/*!40000 ALTER TABLE `devices` DISABLE KEYS */;
+INSERT INTO `devices` VALUES (7,'MP','15K','','/dev/evms/MP15K007',NULL,NULL,2),(5,'MP','15K','','/dev/evms/MP15K005',NULL,NULL,2),(6,'MP','15K','','/dev/evms/MP15K006',NULL,NULL,2),(4,'MP','15K','','/dev/evms/MP15K004',NULL,NULL,2),(8,'MP','15K','','/dev/evms/MP15K008',NULL,NULL,2),(9,'MP','15K','','/dev/evms/MP15K009',NULL,NULL,2),(10,'MP','15K','','/dev/evms/MP15K00a',NULL,NULL,2),(11,'MP','15K','','/dev/evms/MP15K00b',NULL,NULL,2),(12,'MP','15K','','/dev/evms/MP15K00c',NULL,NULL,2),(0,'GW','15K','','/dev/evms/GW15K000',NULL,NULL,2),(1,'GW','15K','','/dev/evms/GW15K001',NULL,NULL,2),(13,'MP','15K','','/dev/evms/MP15K00d',NULL,NULL,2),(14,'MP','15K','','/dev/evms/MP15K00e',NULL,NULL,2),(6,'MS','10K','','/dev/evms/MS10K002',NULL,NULL,2),(5,'MS','15K','','/dev/evms/MS15K003',NULL,NULL,2),(1,'RG','72K','','/dev/evms/RG72K001',NULL,NULL,2),(2,'MS','15K','','/dev/evms/MS15K002',NULL,NULL,2),(1,'MS','15K','','/dev/evms/MS15K001',NULL,NULL,2),(0,'MS','15K','','/dev/evms/MS15K000',NULL,NULL,2),(0,'RG','10K','','/dev/evms/RG10K000',NULL,NULL,2);
+/*!40000 ALTER TABLE `devices` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `group_users`
+--
+
+DROP TABLE IF EXISTS `group_users`;
+CREATE TABLE `group_users` (
+ `group_id` int(16) NOT NULL default '0',
+ `user_id` char(32) NOT NULL default '',
+ PRIMARY KEY (`group_id`,`user_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `group_users`
+--
+
+LOCK TABLES `group_users` WRITE;
+/*!40000 ALTER TABLE `group_users` DISABLE KEYS */;
+INSERT INTO `group_users` VALUES (6,'20:00:00:e0:8b:03:9e:1a'),(6,'21:00:00:e0:8b:03:9e:1a'),(7,'20:00:00:e0:8b:11:3f:8d'),(7,'21:00:00:e0:8b:11:3f:8d'),(8,'20:00:00:e0:8b:11:06:8a'),(8,'21:00:00:e0:8b:11:06:8a'),(9,'20:00:00:e0:8b:11:8d:8a'),(9,'21:00:00:e0:8b:11:8d:8a'),(10,'20:00:00:e0:8b:11:75:8b'),(10,'21:00:00:e0:8b:11:75:8b'),(11,'20:00:00:e0:8b:11:a6:8b'),(11,'21:00:00:e0:8b:11:a6:8b'),(12,'20:00:00:e0:8b:13:ba:01'),(12,'21:00:00:e0:8b:13:ba:01'),(13,'20:00:00:e0:8b:03:d8:4a'),(13,'21:00:00:e0:8b:03:d8:4a');
+/*!40000 ALTER TABLE `group_users` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `perf_types`
+--
+
+DROP TABLE IF EXISTS `perf_types`;
+CREATE TABLE `perf_types` (
+ `perf_id` char(3) NOT NULL default '',
+ `perf_name` char(100) NOT NULL default '',
+ PRIMARY KEY (`perf_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `perf_types`
+--
+
+LOCK TABLES `perf_types` WRITE;
+/*!40000 ALTER TABLE `perf_types` DISABLE KEYS */;
+INSERT INTO `perf_types` VALUES ('15K','15K RPM UltraSCSI-2'),('10F','10K RPM Fibre'),('72I','7200 RPM ATA/SATA'),('54I','5400 RPM ATA/SATA'),('10I','10K RPM ATA/SATA');
+/*!40000 ALTER TABLE `perf_types` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `scst_handlers`
+--
+
+DROP TABLE IF EXISTS `scst_handlers`;
+CREATE TABLE `scst_handlers` (
+ `scst_handlr_id` int(2) NOT NULL default '0',
+ `handler_name` char(32) NOT NULL default '',
+ `autoload` enum('N','Y') NOT NULL default 'N',
+ PRIMARY KEY (`scst_handlr_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `scst_handlers`
+--
+
+LOCK TABLES `scst_handlers` WRITE;
+/*!40000 ALTER TABLE `scst_handlers` DISABLE KEYS */;
+INSERT INTO `scst_handlers` VALUES (1,'disk','N'),(2,'disk_fileio','Y'),(3,'cdrom','N'),(4,'changer','N'),(5,'disk_perf','N'),(6,'modisk','N'),(7,'modisk_perf','N'),(8,'tape','N'),(9,'tape_perf','N');
+/*!40000 ALTER TABLE `scst_handlers` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `security_groups`
+--
+
+DROP TABLE IF EXISTS `security_groups`;
+CREATE TABLE `security_groups` (
+ `group_id` int(4) NOT NULL auto_increment,
+ `group_name` char(100) NOT NULL default '',
+ PRIMARY KEY (`group_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `security_groups`
+--
+
+LOCK TABLES `security_groups` WRITE;
+/*!40000 ALTER TABLE `security_groups` DISABLE KEYS */;
+INSERT INTO `security_groups` VALUES (1,'Default'),(6,'CORBIN3_a'),(12,'PC3_a'),(7,'PC1_a'),(8,'MENTASM_a'),(9,'CORBIN2_a'),(10,'RAISTLIN_a'),(11,'PC4_a'),(13,'PC2_a');
+/*!40000 ALTER TABLE `security_groups` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2006-11-06 20:47:39
Added: trunk/scstadmin/init.d/scst
===================================================================
--- trunk/scstadmin/init.d/scst (rev 0)
+++ trunk/scstadmin/init.d/scst 2006-11-14 12:56:57 UTC (rev 33)
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin
+SCST_CMD=/usr/local/sbin/scstadmin
+SCST_CFG=/etc/scst.conf
+
+# Modules to load/unload
+SCST_MODULES="scst_fileio scst_disk scst_cdrom"
+
+OPTIONS=""
+
+test -x $SCST_CMD -a -f $SCST_CFG || exit 0
+
+case "$1" in
+ start)
+ echo -n "Loading and configuring SCSI Target Mid-level: scst "
+
+ modprobe qla2x00tgt || { echo "[qla2x00tgt failed]" ; exit 1 ; }
+
+ for module in ${SCST_MODULES}; do
+ modprobe ${module} || { echo "[${module} failed]" ; exit 1 ; }
+ done
+
+ $SCST_CMD -config $SCST_CFG
+
+ RC=$?
+
+ if [ $RC -ne 0 ];
+ then
+ echo "[config failed]"
+ fi
+
+ echo "."
+ ;;
+ stop)
+ echo -n "Stopping SCSI Target Mid-level: scst "
+
+ for module in ${SCST_MODULES}; do
+ rmmod ${module} || { echo "[${module} failed]" ; }
+ done
+
+ rmmod qla2x00tgt || { echo "[qla2x00tgt failed]" ; }
+ rmmod scsi_tgt || { echo "[scsi_tgt failed]" ; }
+
+ echo "."
+ ;;
+ force-reload|restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ reload-config)
+ echo -n "Reloading configuration: scst "
+
+ $SCST_CMD -config $SCST_CFG
+
+ RC=$?
+
+ if [ $RC -ne 0 ];
+ then
+ echo "[config failed]"
+ fi
+
+ echo "."
+ ;;
+ *)
+ echo "Usage: /etc/init.d/scst {start|stop|restart|force-reload|reload-config}"
+ exit 1
+esac
+
+exit 0
Property changes on: trunk/scstadmin/init.d/scst
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/scstadmin/scst.conf
===================================================================
--- trunk/scstadmin/scst.conf (rev 0)
+++ trunk/scstadmin/scst.conf 2006-11-14 12:56:57 UTC (rev 33)
@@ -0,0 +1,51 @@
+# SCST Configurator v0.2
+
+# Handler devices
+[HANDLER disk]
+# DEVICE <H:C:I:L>
+
+[HANDLER disk_fileio]
+# DEVICE <vname>,<path>,<WRITE_THROUGH|READ_ONLY|O_DIRECT|NV_CACHE|NULLIO>,<block size>
+DEVICE DISK01,/tmp/test1.dsk,READ_ONLY|WRITE_THROUGH
+DEVICE DISK02,/tmp/test2.dsk
+DEVICE DISK03,/tmp/test3.dsk,O_DIRECT
+DEVICE DISK04,/tmp/test4.dsk,,512
+
+[HANDLER disk_perf]
+
+[HANDLER cdrom]
+# DEVICE <H:C:I:L>
+
+[HANDLER changer]
+# DEVICE <H:C:I:L>
+
+[HANDLER modisk]
+# DEVICE <H:C:I:L>
+
+[HANDLER modisk_perf]
+
+[HANDLER tape]
+# DEVICE <H:C:I:L>
+
+[HANDLER tape_perf]
+
+# Security Group
+[GROUP Test]
+# USER <user>
+USER 50060b000001369d
+
+# Device Assignments
+[ASSIGNMENT Test]
+# DEVICE <device>,<vlun>
+DEVICE DISK01,0
+DEVICE DISK02,1
+DEVICE DISK03
+
+# Target to enable
+[TARGETS enable]
+HOST 50:06:0B:00:00:39:71:78
+HOST host4
+
+# Targets to disable
+[TARGETS disable]
+HOST host5
Added: trunk/scstadmin/scst_db/scst_db
===================================================================
--- trunk/scstadmin/scst_db/scst_db (rev 0)
+++ trunk/scstadmin/scst_db/scst_db 2006-11-14 12:56:57 UTC (rev 33)
@@ -0,0 +1,556 @@
+#!/usr/bin/perl
+$Version = 'SCST DB Configurator v0.51';
+
+# Configures SCST
+#
+# Written by Mark R. Buechler 12/07/04
+
+sub usage
+ {
+ die <<"EndUsage";
+$Version
+
+Usage:
+General Operations
+ -config <config> : Configure SCST given the specified configuration file.
+ -check : Check database configuration against current configuration.
+
+Options
+ -ForceConfig : Force all confuration changes, even deletions (DANGER!).
+
+Debugging (limited support)
+ -debug : Debug mode - don\'t do anything destructive.
+
+Examples:
+ Configure SCST:
+ scst_db config scst_db.conf
+
+EndUsage
+ }
+
+use SCST::SCST;
+use Getopt::Long;
+use IO::Handle;
+use IO::File;
+use DBI;
+use POSIX;
+use strict;
+
+my $_DEF_CONFIG_ = '/etc/scst_db.conf';
+
+my $TRUE = 1;
+my $FALSE = 0;
+
+my $_MAX_LUNS_ = 255;
+my $_DEFAULT_GROUP_ = 'Default';
+
+my $_MDADM_ = '/sbin/mdadm';
+my $_MDSTAT_ = '/proc/mdstat';
+my $_MD_DEV_ = '/dev/';
+
+my $SCST;
+my $DEVICES;
+my %USERS;
+my %ASSIGNMENTS;
+my %HANDLERS;
+my %GROUPS;
+my $_DEBUG_;
+
+my %MD_DEVICES;
+
+my %_HANDLER_MAP_ = ('cdrom' => $SCST::SCST::CDROM_TYPE,
+ 'changer' => $SCST::SCST::CHANGER_TYPE,
+ 'disk' => $SCST::SCST::DISK_TYPE,
+ 'disk_fileio' => $SCST::SCST::DISKFILE_TYPE,
+ 'cdrom_fileio' => $SCST::SCST::CDROMFILE_TYPE,
+ 'disk_perf' => $SCST::SCST::DISKPERF_TYPE,
+ 'modisk' => $SCST::SCST::MODISK_TYPE,
+ 'modisk_perf' => $SCST::SCST::MODISKPERF_TYPE,
+ 'tape' => $SCST::SCST::TAPE_TYPE,
+ 'tape_perf' => $SCST::SCST::TAPEPERF_TYPE);
+
+my %_REVERSE_MAP_ = ($SCST::SCST::CDROM_TYPE => 'cdrom',
+ $SCST::SCST::CHANGER_TYPE => 'changer',
+ $SCST::SCST::DISK_TYPE => 'disk',
+ $SCST::SCST::DISKFILE_TYPE => 'disk_fileio',
+ $SCST::SCST::CDROMFILE_TYPE...
[truncated message content] |
|
From: <vl...@us...> - 2006-11-13 17:15:01
|
Revision: 32
http://svn.sourceforge.net/scst/?rev=32&view=rev
Author: vlnb
Date: 2006-11-13 09:14:19 -0800 (Mon, 13 Nov 2006)
Log Message:
-----------
- Fixed problems with big amount of LUNs. Tested on 1500 LUNS
- Docs update
Modified Paths:
--------------
trunk/scst/README
trunk/scst/src/dev_handlers/scst_fileio.c
trunk/scst/src/scst_lib.c
trunk/scst/src/scst_proc.c
trunk/scst/src/scst_targ.c
Modified: trunk/scst/README
===================================================================
--- trunk/scst/README 2006-11-10 12:39:12 UTC (rev 31)
+++ trunk/scst/README 2006-11-13 17:14:19 UTC (rev 32)
@@ -323,20 +323,20 @@
way as "*_perf" handlers.
- NV_CACHE - enables "non-volatile cache" mode. In this mode it is
- assumed that the target has GOOD uninterruptable power supply
- and software/hardware bug free, i.e. all data from the target's
- cache are guaranteed sooner or later to go to the media, hence
- all data synchronization with media operations, like
- SYNCHRONIZE_CACHE, are ignored (BTW, so violating SCSI standard)
- in order to bring a bit more performance. Use with extreme
- caution, since in this mode after a crash of the target
- journaled file systems don't guarantee the consistency after
- journal recovery, therefore manual fsck MUST be ran. The main
- intent for it is to determine the performance impact caused by
- the cache synchronization. Note, that since usually the journal
- barrier protection (see "IMPORTANT" below) turned off, enabling
- NV_CACHE could change nothing, since no data synchronization
- with media operations will go from the initiator.
+ assumed that the target has GOOD UPS and software/hardware bug
+ free, i.e. all data from the target's cache are guaranteed
+ sooner or later to go to the media, hence all data
+ synchronization with media operations, like SYNCHRONIZE_CACHE,
+ are ignored (BTW, so violating SCSI standard) in order to bring
+ a bit more performance. Use with extreme caution, since in this
+ mode after a crash of the target journaled file systems don't
+ guarantee the consistency after journal recovery, therefore
+ manual fsck MUST be ran. The main intent for it is to determine
+ the performance impact caused by the cache synchronization.
+ Note, that since usually the journal barrier protection (see
+ "IMPORTANT" below) turned off, enabling NV_CACHE could change
+ nothing, since no data synchronization with media operations
+ will go from the initiator.
* "close NAME" - closes device "NAME".
@@ -349,32 +349,36 @@
========= caching policy. This is generally safe from the consistence of
journaled file systems, laying over them, point of view, but
your unsaved cached data will be lost in case of
- power/hardware/software faulure, so you must supply your
+ power/hardware/software failure, so you must supply your
target server with some kind of UPS or disable write back
caching using WRITE_THROUGH flag. You also should note, that
the file systems journaling over write back caching enabled
- devices works reliably *ONLY* if it uses some kind of data
- protection barriers (i.e. after writing journaling data some
- kind of synchronization with media operations will be used),
- otherwise, because of possible reordering in the cache, even
- after successful journal rollback you very much risk to loose
- your data on the FS. On Linux initiators for EXT3 and
- ReiserFS file systems the barrier protection could be turned
- on using "barrier=1" and "barrier=flush" mount options
- correspondingly. Note, that usually it turned off by default
- and the status of barriers usage isn't reported anywhere in
- the system logs as well as there is no way to know it on the
- mounted file system (at least no known one). Also note
- that on some real-life workloads write through caching might
- perform better, than write back one with the barrier protection
- turned on.
+ devices works reliably *ONLY* if the order of journal writes
+ is guaranteed or it uses some kind of data protection
+ barriers (i.e. after writing journal data some kind of
+ synchronization with media operations is used), otherwise,
+ because of possible reordering in the cache, even after
+ successful journal rollback, you very much risk to loose your
+ data on the FS. Currently, Linux IO subsystem guarantees
+ order of write operations only using data protection
+ barriers. Some info about it from the XFS point of view could
+ be found at http://oss.sgi.com/projects/xfs/faq.html#wcache.
+ On Linux initiators for EXT3 and ReiserFS file systems the
+ barrier protection could be turned on using "barrier=1" and
+ "barrier=flush" mount options correspondingly. Note, that
+ usually it turned off by default and the status of barriers
+ usage isn't reported anywhere in the system logs as well as
+ there is no way to know it on the mounted file system (at
+ least no known one). Also note that on some real-life
+ workloads write through caching might perform better, than
+ write back one with the barrier protection turned on.
-IMPORTANT: Many disk and partition table mananagement utilities don't support
+IMPORTANT: Many disk and partition table management utilities don't support
========= block sizes >512 bytes, therefore make sure that your favorite one
supports it. Also, if you export disk file or device with
some block size, different from one, with which it was
already divided on partitions, you could get various weird
- things like utilities hang up or other unexpected behaviour.
+ things like utilities hang up or other unexpected behavior.
Hence, to be sure, zero the exported file or device before the
first access to it from the remote initiator with another
block size.
@@ -384,10 +388,15 @@
Before doing any performance measurements note that:
-I. Maximum performance is possible only with real SCSI devices or
-performance handlers. If you have enough CPU power, FILEIO handler could
-provide the same results, when aggregate throughput is close to
-aggregate throuput locally on the target on the same disks.
+I. Currently maximum performance is possible only with real SCSI devices
+with several simultaneously executed commands (SCSI tagged queuing) or
+performance handlers. If you have enough CPU power, FILEIO handler also
+could provide the same results, when aggregate throughput is close to
+the aggregate throughput locally on the target from the same disks. Also
+note, that currently IO subsystem in Linux implemented on such way, so a
+FILEIO device over a single file occupied entire formatted with some
+file system device (eg /dev/hdc) could perform considerably better, than
+a FILEIO device over /dev/hdc itself without the file system involved.
II. In order to get the maximum performance you should:
@@ -414,8 +423,8 @@
- The default kernel read-ahead and queuing settings are optimized
for locally attached disks, therefore they are not optimal if they
- attached remotly (our case), which sometimes could lead to unexpectedly
- low throughput. You should increase read-ahead size
+ attached remotely (our case), which sometimes could lead to
+ unexpectedly low throughput. You should increase read-ahead size
(/sys/block/device/queue/read_ahead_kb) to at least 256Kb or even
more on all initiators and the target. Also experiment with other
parameters in /sys/block/device directory, they also affect the
@@ -448,7 +457,7 @@
a device node is used. Both values are on the target.
Just for reference: we had with 0.9.2 and "old" Qlogic driver on 2.4.2x
-kernel, where we did carefull performance study, aggregate throuhput
+kernel, where we did careful performance study, aggregate throughput
about 390 Mb/sec from 2 qla2300 cards sitting on different 64-bit PCI
buses and working simultaneously for two different initiators with
several simultaneously working load programs on each. From one card -
Modified: trunk/scst/src/dev_handlers/scst_fileio.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_fileio.c 2006-11-10 12:39:12 UTC (rev 31)
+++ trunk/scst/src/dev_handlers/scst_fileio.c 2006-11-13 17:14:19 UTC (rev 32)
@@ -2066,7 +2066,7 @@
* value less, than requested. Let's restart.
*/
int i, e = eiv_count;
- TRACE(TRACE_MINOR, "write() returned %d from %zd "
+ TRACE_MGMT_DBG("write() returned %d from %zd "
"(iv_count=%d)", (int)err, full_len,
eiv_count);
if (err == 0) {
@@ -2261,20 +2261,43 @@
return dev;
}
-static int fileio_proc_update_size(int size, int *len,
- off_t *begin, off_t *pos, off_t *offset)
+struct fileio_proc_update_struct {
+ int len, plen, pplen;
+ off_t begin, pbegin, ppbegin;
+ off_t pos;
+};
+
+static int fileio_proc_update_size(int size, off_t offset, int length,
+ struct fileio_proc_update_struct *p, int is_start)
{
int res;
if (size > 0) {
- *len += size;
- *pos = *begin + *len;
- if (*pos < *offset) {
- *len = 0;
- *begin = *pos;
+ p->len += size;
+ p->pos = p->begin + p->len;
+ if (p->pos < offset) {
+ p->len = 0;
+ p->begin = p->pos;
}
- res = 0;
- } else
+ if (p->pos > offset + length) {
+ p->begin = p->pbegin;
+ p->len = p->plen;
+ res = 1;
+ goto out;
+ } else
+ res = 0;
+ } else {
+ p->begin = p->ppbegin;
+ p->len = p->pplen;
res = 1;
+ goto out;
+ }
+ if (is_start) {
+ p->ppbegin = p->pbegin;
+ p->pplen = p->plen;
+ p->pbegin = p->begin;
+ p->plen = p->len;
+ }
+out:
return res;
}
@@ -2288,10 +2311,12 @@
int res = 0, action;
char *p, *name, *file_name;
struct scst_fileio_dev *virt_dev, *vv;
- int size, len = 0;
- off_t begin = 0, pos = 0;
+ int size;
+ struct fileio_proc_update_struct pu;
TRACE_ENTRY();
+
+ memset(&pu, 0, sizeof(pu));
/* VERY UGLY code. You can rewrite it if you want */
@@ -2303,99 +2328,84 @@
if (inout == 0) { /* read */
size = scnprintf(buffer, length, "%-17s %-11s %-11s %-15s %s\n",
"Name", "Size(MB)", "Block size", "Options", "File name");
- if (fileio_proc_update_size(size, &len, &begin, &pos, &offset)) {
- res = len;
- goto out_up;
- }
+ if (fileio_proc_update_size(size, offset, length, &pu, 1))
+ goto stop_output;
list_for_each_entry(virt_dev, &disk_fileio_dev_list,
fileio_dev_list_entry)
{
int c;
- size = scnprintf(buffer + len, length - len,
+ size = scnprintf(buffer + pu.len, length - pu.len,
"%-17s %-11d %-12d", virt_dev->name,
(uint32_t)(virt_dev->file_size >> 20),
virt_dev->block_size);
- if (fileio_proc_update_size(size, &len, &begin, &pos,
- &offset)) {
- res = len;
- goto out_up;
+ if (fileio_proc_update_size(size, offset, length, &pu,
+ 1)) {
+ goto stop_output;
}
c = 0;
if (virt_dev->wt_flag) {
- size = scnprintf(buffer + len, length - len, "WT");
+ size = scnprintf(buffer + pu.len, length - pu.len, "WT");
c += size;
- if (fileio_proc_update_size(size, &len, &begin,
- &pos, &offset)) {
- res = len;
- goto out_up;
+ if (fileio_proc_update_size(size, offset,
+ length, &pu, 0)) {
+ goto stop_output;
}
}
if (virt_dev->nv_cache) {
- size = scnprintf(buffer + len, length - len,
+ size = scnprintf(buffer + pu.len, length - pu.len,
c ? ",NV" : "NV");
c += size;
- if (fileio_proc_update_size(size, &len, &begin,
- &pos, &offset)) {
- res = len;
- goto out_up;
+ if (fileio_proc_update_size(size, offset,
+ length, &pu, 0)) {
+ goto stop_output;
}
}
if (virt_dev->rd_only_flag) {
- size = scnprintf(buffer + len, length - len,
+ size = scnprintf(buffer + pu.len, length - pu.len,
c ? ",RO" : "RO");
c += size;
- if (fileio_proc_update_size(size, &len, &begin,
- &pos, &offset)) {
- res = len;
- goto out_up;
+ if (fileio_proc_update_size(size, offset,
+ length, &pu, 0)) {
+ goto stop_output;
}
}
if (virt_dev->o_direct_flag) {
- size = scnprintf(buffer + len, length - len,
+ size = scnprintf(buffer + pu.len, length - pu.len,
c ? ",DR" : "DR");
c += size;
- if (fileio_proc_update_size(size, &len, &begin,
- &pos, &offset)) {
- res = len;
- goto out_up;
+ if (fileio_proc_update_size(size, offset,
+ length, &pu, 0)) {
+ goto stop_output;
}
}
if (virt_dev->nullio) {
- size = scnprintf(buffer + len, length - len,
+ size = scnprintf(buffer + pu.len, length - pu.len,
c ? ",NIO" : "NIO");
c += size;
- if (fileio_proc_update_size(size, &len, &begin,
- &pos, &offset)) {
- res = len;
- goto out_up;
+ if (fileio_proc_update_size(size, offset,
+ length, &pu, 0)) {
+ goto stop_output;
}
}
while (c < 16) {
- size = scnprintf(buffer + len, length - len, " ");
- if (fileio_proc_update_size(size, &len, &begin, &pos,
- &offset)) {
- res = len;
- goto out_up;
+ size = scnprintf(buffer + pu.len, length - pu.len, " ");
+ if (fileio_proc_update_size(size, offset,
+ length, &pu, 0)) {
+ goto stop_output;
}
c++;
}
- size = scnprintf(buffer + len, length - len, "%s\n",
+ size = scnprintf(buffer + pu.len, length - pu.len, "%s\n",
virt_dev->file_name);
- if (fileio_proc_update_size(size, &len, &begin,
- &pos, &offset)) {
- res = len;
- goto out_up;
+ if (fileio_proc_update_size(size, offset, length, &pu,
+ 0)) {
+ goto stop_output;
}
}
- *start = buffer + (offset - begin);
- len -= (offset - begin);
- if (len > length)
- len = length;
- res = len;
*eof = 1;
- }
- else { /* write */
+ goto stop_output;
+ } else { /* write */
uint32_t block_size = DEF_DISK_BLOCKSIZE;
int block_shift = DEF_DISK_BLOCKSIZE_SHIFT;
p = buffer;
@@ -2545,15 +2555,15 @@
strcpy(virt_dev->name, name);
- len = strlen(file_name) + 1;
- virt_dev->file_name = kmalloc(len, GFP_KERNEL);
+ pu.len = strlen(file_name) + 1;
+ virt_dev->file_name = kmalloc(pu.len, GFP_KERNEL);
if (virt_dev->file_name == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Allocation of file_name failed");
res = -ENOMEM;
goto out_free_vdev;
}
- strncpy(virt_dev->file_name, file_name, len);
+ strncpy(virt_dev->file_name, file_name, pu.len);
list_add_tail(&virt_dev->fileio_dev_list_entry,
&disk_fileio_dev_list);
@@ -2605,6 +2615,14 @@
TRACE_EXIT_RES(res);
return res;
+stop_output:
+ *start = buffer + (offset - pu.begin);
+ pu.len -= (offset - pu.begin);
+ if (pu.len > length)
+ pu.len = length;
+ res = pu.len;
+ goto out_up;
+
out_free_vpath:
list_del(&virt_dev->fileio_dev_list_entry);
kfree(virt_dev->file_name);
@@ -2924,11 +2942,13 @@
int res = 0, action;
char *p, *name;
struct scst_fileio_dev *virt_dev;
- int size, len = 0;
- off_t begin = 0, pos = 0;
+ int size;
+ struct fileio_proc_update_struct pu;
TRACE_ENTRY();
+ memset(&pu, 0, sizeof(pu));
+
if (down_interruptible(&scst_fileio_mutex) != 0) {
res = -EINTR;
goto out;
@@ -2937,32 +2957,24 @@
if (inout == 0) { /* read */
size = scnprintf(buffer, length, "%-17s %-9s %s\n",
"Name", "Size(MB)", "File name");
- if (fileio_proc_update_size(size, &len, &begin, &pos,
- &offset)) {
- res = len;
- goto out_up;
- }
+ if (fileio_proc_update_size(size, offset, length, &pu, 1))
+ goto stop_output;
list_for_each_entry(virt_dev, &cdrom_fileio_dev_list,
fileio_dev_list_entry)
{
- size = scnprintf(buffer + len, length - len,
+ size = scnprintf(buffer + pu.len, length - pu.len,
"%-17s %-9d %s\n", virt_dev->name,
(uint32_t)(virt_dev->file_size >> 20),
virt_dev->file_name);
- if (fileio_proc_update_size(size, &len, &begin,
- &pos, &offset)) {
- res = len;
- goto out_up;
+ if (fileio_proc_update_size(size, offset, length, &pu,
+ 1)) {
+ goto stop_output;
}
}
- *start = buffer + (offset - begin);
- len -= (offset - begin);
- if (len > length)
- len = length;
- res = len;
- }
- else { /* write */
+ *eof = 1;
+ goto stop_output;
+ } else { /* write */
p = buffer;
if (p[strlen(p) - 1] == '\n') {
p[strlen(p) - 1] = '\0';
@@ -3022,6 +3034,13 @@
TRACE_EXIT_RES(res);
return res;
+stop_output:
+ *start = buffer + (offset - pu.begin);
+ pu.len -= (offset - pu.begin);
+ if (pu.len > length)
+ pu.len = length;
+ res = pu.len;
+ goto out_up;
}
static int fileio_proc_help_build(struct scst_dev_type *dev_type)
Modified: trunk/scst/src/scst_lib.c
===================================================================
--- trunk/scst/src/scst_lib.c 2006-11-10 12:39:12 UTC (rev 31)
+++ trunk/scst/src/scst_lib.c 2006-11-13 17:14:19 UTC (rev 32)
@@ -341,7 +341,7 @@
dev->scsi_dev->lun, (uint64_t)tgt_dev->acg_dev->lun);
}
else {
- TRACE(TRACE_MINOR, "Virtual device SCST lun=%Ld",
+ TRACE_MGMT_DBG("Virtual device SCST lun=%Ld",
(uint64_t)tgt_dev->acg_dev->lun);
}
@@ -1562,6 +1562,7 @@
address_method = (*lun) >> 6; /* high 2 bits of byte 0 */
switch (address_method) {
case 0: /* peripheral device addressing method */
+#if 0 /* At least QLA2300 Linux ini uses it as the flat space addressing method */
if (*lun) {
PRINT_ERROR_PR("Illegal BUS INDENTIFIER in LUN "
"peripheral device addressing method 0x%02x, "
@@ -1570,6 +1571,9 @@
}
res = *(lun + 1);
break;
+#else
+ /* go through */
+#endif
case 1: /* flat space addressing method */
res = *(lun + 1) | (((*lun) & 0x3f) << 8);
Modified: trunk/scst/src/scst_proc.c
===================================================================
--- trunk/scst/src/scst_proc.c 2006-11-10 12:39:12 UTC (rev 31)
+++ trunk/scst/src/scst_proc.c 2006-11-13 17:14:19 UTC (rev 32)
@@ -726,45 +726,62 @@
TRACE_EXIT();
}
-static int scst_proc_update_size(int size, int *len,
- off_t *begin, off_t *pos, off_t *offset, int length)
+struct scst_proc_update_struct {
+ int len, plen, pplen;
+ off_t begin, pbegin, ppbegin;
+ off_t pos;
+};
+
+static int scst_proc_update_size(int size, off_t offset, int length,
+ struct scst_proc_update_struct *p)
{
int res;
if (size > 0) {
- *len += size;
- *pos = *begin + *len;
- if (*pos < *offset) {
- *len = 0;
- *begin = *pos;
+ p->len += size;
+ p->pos = p->begin + p->len;
+ if (p->pos < offset) {
+ p->len = 0;
+ p->begin = p->pos;
}
- if (pos > offset + length)
+ if (p->pos > offset + length) {
+ p->begin = p->pbegin;
+ p->len = p->plen;
res = 1;
- else
+ goto out;
+ } else
res = 0;
- } else
+ } else {
+ p->begin = p->ppbegin;
+ p->len = p->pplen;
res = 1;
+ goto out;
+ }
+ p->ppbegin = p->pbegin;
+ p->pplen = p->plen;
+ p->pbegin = p->begin;
+ p->plen = p->len;
+out:
return res;
}
-static int scst_proc_sgv_read_1(char *buffer, int *len,
- off_t *begin, off_t *pos, off_t *offset, int length,
+static int scst_proc_sgv_read_1(char *buffer, off_t offset, int length,
+ struct scst_proc_update_struct *p,
const struct sgv_pool *pool, const char *name)
{
int i, size;
- size = scnprintf(buffer + *len, length - *len, "\n%-20s %-11d %-11d\n",
+ size = scnprintf(buffer + p->len, length - p->len, "\n%-20s %-11d %-11d\n",
name, atomic_read(&pool->acc.hit_alloc),
atomic_read(&pool->acc.total_alloc));
- if (scst_proc_update_size(size, len, begin, pos, offset, length))
+ if (scst_proc_update_size(size, offset, length, p))
return 1;
for(i = 0; i < SGV_POOL_ELEMENTS; i++) {
- size = scnprintf(buffer + *len, length - *len,
+ size = scnprintf(buffer + p->len, length - p->len,
" %-18s %-11d %-11d\n", pool->cache_names[i],
atomic_read(&pool->cache_acc[i].hit_alloc),
atomic_read(&pool->cache_acc[i].total_alloc));
- if (scst_proc_update_size(size, len, begin, pos, offset,
- length))
+ if (scst_proc_update_size(size, offset, length, p))
return 1;
}
return 0;
@@ -774,48 +791,52 @@
off_t offset, int length, int *eof, void *data)
{
int res = 0;
- int size, len = 0;
- off_t begin = 0, pos = 0;
+ int size;
+ struct scst_proc_update_struct st;
TRACE_ENTRY();
TRACE_DBG("offset: %d, length %d", (int) offset, length);
- size = scnprintf(buffer + len, length - len, "%-20s %-11s %-11s",
+ memset(&st, 0, sizeof(st));
+
+ size = scnprintf(buffer + st.len, length - st.len, "%-20s %-11s %-11s",
"Name", "Hit", "Total");
- if (scst_proc_update_size(size, &len, &begin, &pos, &offset, length))
+ if (scst_proc_update_size(size, offset, length, &st))
goto stop_output;
- if (scst_proc_sgv_read_1(buffer, &len, &begin, &pos, &offset, length,
- &scst_sgv.norm, "sgv"))
+ if (scst_proc_sgv_read_1(buffer, offset, length, &st, &scst_sgv.norm,
+ "sgv"))
goto stop_output;
- if (scst_proc_sgv_read_1(buffer, &len, &begin, &pos, &offset, length,
+ if (scst_proc_sgv_read_1(buffer, offset, length, &st,
&scst_sgv.norm_clust, "sgv-clust"))
goto stop_output;
- if (scst_proc_sgv_read_1(buffer, &len, &begin, &pos, &offset, length,
+ if (scst_proc_sgv_read_1(buffer, offset, length, &st,
&scst_sgv.dma, "sgv-dma"))
goto stop_output;
#ifdef SCST_HIGHMEM
- if (scst_proc_sgv_read_1(buffer, &len, &begin, &pos, &offset, length,
+ if (scst_proc_sgv_read_1(buffer, offset, length, &st,
&scst_sgv.highmem, "sgv-highmem"))
goto stop_output;
#endif
- size = scnprintf(buffer + len, length - len, "\n%-32s %-11d\n",
+ size = scnprintf(buffer + st.len, length - st.len, "\n%-32s %-11d\n",
"big", atomic_read(&sgv_big_total_alloc));
- if (scst_proc_update_size(size, &len, &begin, &pos, &offset, length))
+ if (scst_proc_update_size(size, offset, length, &st))
goto stop_output;
+ *eof = 1;
+
stop_output:
- *start = buffer + (offset - begin);
- len -= (offset - begin);
- if (len > length)
- len = length;
- res = len;
+ *start = buffer + (offset - st.begin);
+ st.len -= (offset - st.begin);
+ if (st.len > length)
+ st.len = length;
+ res = st.len;
TRACE_EXIT_RES(res);
return res;
@@ -979,8 +1000,8 @@
void *data)
{
int res = 0;
- int size, len = 0;
- off_t begin = 0, pos = 0;
+ int size, len = 0, plen, pplen;
+ off_t begin = 0, pos = 0, pbegin, ppbegin;
struct scst_device *dev;
TRACE_ENTRY();
@@ -1005,6 +1026,8 @@
} else
goto stop_output;
+ ppbegin = pbegin = begin;
+ pplen = plen = len;
list_for_each_entry(dev, &scst_dev_list, dev_list_entry) {
if (dev->virt_id == 0) {
size = scnprintf(buffer + len, length - len,
@@ -1027,12 +1050,24 @@
len = 0;
begin = pos;
}
- if (pos > offset + length)
+ if (pos > offset + length) {
+ begin = pbegin;
+ len = plen;
goto stop_output;
- } else
+ }
+ } else {
+ begin = ppbegin;
+ len = pplen;
goto stop_output;
+ }
+ ppbegin = pbegin;
+ pplen = plen;
+ pbegin = begin;
+ plen = len;
}
+ *eof = 1;
+
stop_output:
*start = buffer + (offset - begin);
len -= (offset - begin);
@@ -1771,8 +1806,8 @@
int res = 0;
struct scst_acg *acg = (struct scst_acg *)data;
struct scst_acg_dev *acg_dev;
- int size, len = 0;
- off_t begin = 0, pos = 0;
+ int size, len = 0, plen, pplen;
+ off_t begin = 0, pos = 0, pbegin, ppbegin;
TRACE_ENTRY();
@@ -1796,6 +1831,8 @@
} else
goto stop_output;
+ ppbegin = pbegin = begin;
+ pplen = plen = len;
list_for_each_entry(acg_dev, &acg->acg_dev_list, acg_dev_list_entry) {
if (acg_dev->dev->virt_id == 0) {
size = scnprintf(buffer + len, length - len,
@@ -1819,12 +1856,24 @@
len = 0;
begin = pos;
}
- if (pos > offset + length)
+ if (pos > offset + length) {
+ begin = pbegin;
+ len = plen;
goto stop_output;
- } else
+ }
+ } else {
+ begin = ppbegin;
+ len = pplen;
goto stop_output;
+ }
+ ppbegin = pbegin;
+ pplen = plen;
+ pbegin = begin;
+ plen = len;
}
+ *eof = 1;
+
stop_output:
*start = buffer + (offset - begin);
len -= (offset - begin);
@@ -2034,8 +2083,8 @@
int res = 0;
struct scst_acg *acg;
struct scst_session *sess;
- int size, len = 0;
- off_t begin = 0, pos = 0;
+ int size, len = 0, plen, pplen;
+ off_t begin = 0, pos = 0, pbegin, ppbegin;
TRACE_ENTRY();
@@ -2059,6 +2108,8 @@
} else
goto stop_output;
+ ppbegin = pbegin = begin;
+ pplen = plen = len;
list_for_each_entry(acg, &scst_acg_list, scst_acg_list_entry) {
list_for_each_entry(sess, &acg->acg_sess_list, acg_sess_list_entry) {
size = scnprintf(buffer + len, length - len,
@@ -2074,13 +2125,25 @@
len = 0;
begin = pos;
}
- if (pos > offset + length)
+ if (pos > offset + length) {
+ begin = pbegin;
+ len = plen;
goto stop_output;
- } else
+ }
+ } else {
+ begin = ppbegin;
+ len = pplen;
goto stop_output;
+ }
+ ppbegin = pbegin;
+ pplen = plen;
+ pbegin = begin;
+ plen = len;
}
}
+ *eof = 1;
+
stop_output:
*start = buffer + (offset - begin);
len -= (offset - begin);
@@ -2102,8 +2165,8 @@
int res = 0;
struct scst_acg *acg = (struct scst_acg *)data;
struct scst_acn *name;
- int size, len = 0;
- off_t begin = 0, pos = 0;
+ int size, len = 0, plen, pplen;
+ off_t begin = 0, pos = 0, pbegin, ppbegin;
TRACE_ENTRY();
@@ -2112,6 +2175,8 @@
goto out;
}
+ ppbegin = pbegin = begin;
+ pplen = plen = len;
list_for_each_entry(name, &acg->acn_list, acn_list_entry) {
size = scnprintf(buffer + len, length - len, "%s\n",
name->name);
@@ -2122,12 +2187,24 @@
len = 0;
begin = pos;
}
- if (pos > offset + length)
+ if (pos > offset + length) {
+ begin = pbegin;
+ len = plen;
goto stop_output;
- } else
+ }
+ } else {
+ begin = ppbegin;
+ len = pplen;
goto stop_output;
+ }
+ ppbegin = pbegin;
+ pplen = plen;
+ pbegin = begin;
+ plen = len;
}
+ *eof = 1;
+
stop_output:
*start = buffer + (offset - begin);
len -= (offset - begin);
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2006-11-10 12:39:12 UTC (rev 31)
+++ trunk/scst/src/scst_targ.c 2006-11-13 17:14:19 UTC (rev 32)
@@ -306,7 +306,7 @@
cmd->cdb[0], dev->handler->name);
}
if (scst_cmd_is_expected_set(cmd)) {
- TRACE(TRACE_MINOR, "Using initiator supplied values: "
+ TRACE(TRACE_SCSI, "Using initiator supplied values: "
"direction %d, transfer_len %d",
cmd->expected_data_direction,
cmd->expected_transfer_len);
@@ -1234,6 +1234,7 @@
int buffer_size;
struct scst_tgt_dev *tgt_dev = NULL;
uint8_t *buffer;
+ int offs, overflow = 0;
TRACE_ENTRY();
@@ -1243,45 +1244,70 @@
cmd->host_status = DID_OK;
cmd->driver_status = 0;
- /* ToDo: use full SG buffer, not only the first entry */
+ if (cmd->cdb[2] != 0) {
+ PRINT_ERROR_PR("Unsupported SELECT REPORT value %x in REPORT "
+ "LUNS command", cmd->cdb[2]);
+ goto out_err;
+ }
+
buffer_size = scst_get_buf_first(cmd, &buffer);
if (unlikely(buffer_size <= 0))
goto out_err;
- if (buffer_size < 16) {
+ if (buffer_size < 16)
goto out_put_err;
- }
memset(buffer, 0, buffer_size);
+ offs = 8;
/* sess->sess_tgt_dev_list is protected by suspended activity */
list_for_each_entry(tgt_dev, &cmd->sess->sess_tgt_dev_list,
sess_tgt_dev_list_entry)
{
- if (8 + 8 * dev_cnt + 2 <= buffer_size) {
- buffer[8 + 8 * dev_cnt] = (tgt_dev->acg_dev->lun >> 8) & 0xff;
- buffer[8 + 8 * dev_cnt + 1] = tgt_dev->acg_dev->lun & 0xff;
+ if (!overflow) {
+ if (offs >= buffer_size) {
+ scst_put_buf(cmd, buffer);
+ buffer_size = scst_get_buf_first(cmd, &buffer);
+ if (buffer_size > 0) {
+ memset(buffer, 0, buffer_size);
+ offs = 0;
+ } else {
+ overflow = 1;
+ goto inc_dev_cnt;
+ }
+ }
+ if ((buffer_size - offs) < 8) {
+ PRINT_ERROR_PR("Buffer allocated for REPORT "
+ "LUNS command doesn't allow to fit 8 "
+ "byte entry (buffer_size=%d)",
+ buffer_size);
+ goto out_put_hw_err;
+ }
+ buffer[offs] = (tgt_dev->acg_dev->lun >> 8) & 0xff;
+ buffer[offs + 1] = tgt_dev->acg_dev->lun & 0xff;
+ offs += 8;
}
+inc_dev_cnt:
dev_cnt++;
- /* Tmp, until ToDo above done */
- if (dev_cnt >= ((PAGE_SIZE >> 3) - 2))
- break;
}
+ if (!overflow)
+ scst_put_buf(cmd, buffer);
/* Set the response header */
+ buffer_size = scst_get_buf_first(cmd, &buffer);
+ if (unlikely(buffer_size <= 0))
+ goto out_err;
dev_cnt *= 8;
buffer[0] = (dev_cnt >> 24) & 0xff;
buffer[1] = (dev_cnt >> 16) & 0xff;
buffer[2] = (dev_cnt >> 8) & 0xff;
buffer[3] = dev_cnt & 0xff;
+ scst_put_buf(cmd, buffer);
dev_cnt += 8;
+ if (dev_cnt < cmd->resp_data_len)
+ scst_set_resp_data_len(cmd, dev_cnt);
- scst_put_buf(cmd, buffer);
-
- if (buffer_size > dev_cnt)
- scst_set_resp_data_len(cmd, dev_cnt);
-
out_done:
cmd->completed = 1;
@@ -1298,6 +1324,11 @@
scst_set_cmd_error(cmd,
SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb));
goto out_done;
+
+out_put_hw_err:
+ scst_put_buf(cmd, buffer);
+ scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error));
+ goto out_done;
}
static int scst_pre_select(struct scst_cmd *cmd)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-11-10 12:39:31
|
Revision: 31
http://svn.sourceforge.net/scst/?rev=31&view=rev
Author: vlnb
Date: 2006-11-10 04:39:12 -0800 (Fri, 10 Nov 2006)
Log Message:
-----------
Documentaion updates
Modified Paths:
--------------
trunk/qla2x00t/qla2x00-target/README
trunk/scst/Makefile
trunk/scst/README
Modified: trunk/qla2x00t/qla2x00-target/README
===================================================================
--- trunk/qla2x00t/qla2x00-target/README 2006-11-09 11:07:14 UTC (rev 30)
+++ trunk/qla2x00t/qla2x00-target/README 2006-11-10 12:39:12 UTC (rev 31)
@@ -5,19 +5,14 @@
-------------------------------
This driver has all required features and looks to be quite stable (for
-beta) and useful. It is designed to work in conjunction with the
-initiator driver from Linux kernel version 2.6, which is intended to
-perform all the initialization and shutdown tasks. This driver needs to
-be patched to enable the target mode and provide all necessary
-callbacks, but it's still capable to work as initiator only. Mode, when
-a host acts as the initiator and the target simultaneously, is supported
-as well.
+beta) and useful. It consists from two parts: the target mode driver
+itself and the changed initiator driver from Linux kernel, which is,
+particularly, intended to perform all the initialization and shutdown
+tasks. This driver was changed to provide the target mode support and
+all necessary callbacks, but it's still capable to work as initiator
+only. Mode, when a host acts as the initiator and the target
+simultaneously, is supported as well.
-If you have a driver's version (e.g. development) without the patch, but
-with the full patched initiator source code, you should replace by it
-qla2xxx subdirectory in kernel_source/drivers/scsi/ and then rebuild the
-kernel or only its modules.
-
This version is compatible with SCST version 0.9.5 and higher.
Tested on stable kernels from http://www.kernel.org. The original
@@ -33,28 +28,24 @@
At first, make sure that the link "/lib/modules/`you_kernel_version`/build"
points to the source code for your currently running kernel.
-Then, edit Makefile and set SCST_INC_DIR variable to point to the
+Then you should replace (or link) by the initiator driver from this
+package "qla2xxx" subdirectory in kernel_source/drivers/scsi/ and then
+rebuild the kernel and its modules.
+
+Then edit Makefile and set SCST_INC_DIR variable to point to the
directory, where SCST's public include files are located. If you install
QLA2x00 target driver's source code in the SCST's directory, then
SCST_INC_DIR will be set correctly for you ("../include").
-The driver consists of two parts: the patch for initiator driver
-"linux-2.6-qla2xxx-target.patch" and target driver in the
-"qla2x00-target" directory.
-
-Patch the kernel tree with "linux-2.6-qla2xxx-target.patch" patch.
-
To compile, type 'make'. It will build qla2x00tgt.ko module.
To install, type 'make install'. The target driver will be installed in
-/lib/modules/`you_kernel_version`/kernel/drivers/scsi/scsi_tgt.
+/lib/modules/`you_kernel_version`/extra.
To uninstall, type 'make uninstall'.
-The initiator driver must be loaded before the target one.
-
-Then the target mode should be enabled via a sysfs interface on a per
-card basis. Under the appropriate scsi_host there is an entry
+The target mode should be enabled via a sysfs interface on a per card
+basis. Under the appropriate scsi_host there is an entry
target_mode_enabled, where you should write "1", like:
echo "1" >/sys/class/scsi_host/host0/target_mode_enabled
Modified: trunk/scst/Makefile
===================================================================
--- trunk/scst/Makefile 2006-11-09 11:07:14 UTC (rev 30)
+++ trunk/scst/Makefile 2006-11-10 12:39:12 UTC (rev 31)
@@ -43,6 +43,8 @@
@echo " install : install"
@echo " uninstall : uninstall"
@echo " Notes :"
- @echo " - install and uninstall must be made as root"
+ @echo " - install and uninstall must be made as root."
+ @echo " - be sure to compile qla against the correct initiator"
+ @echo " driver. Read its README for details."
.PHONY: all install uninstall clean extraclean help
Modified: trunk/scst/README
===================================================================
--- trunk/scst/README 2006-11-09 11:07:14 UTC (rev 30)
+++ trunk/scst/README 2006-11-10 12:39:12 UTC (rev 31)
@@ -12,8 +12,8 @@
SCST looks to be quite stable (for beta) and useful. It supports disks
(SCSI type 0), tapes (type 1), processor (type 3), CDROM's (type 5), MO
-disks (type 7), medium changers (type 8) and RAID controller (type 0xC).
-There are also FILEIO and "performance" device handlers. In addition, it
+disks (type 7), medium changers (type 8) and RAID controller (type 0xC)
+as well as FILEIO and "performance" device handlers. In addition, it
supports advanced per-initiator access and devices visibility
management, so different initiators could see different set of devices
with different access permissions. See below for details.
@@ -22,64 +22,25 @@
Tested mostly on "vanilla" 2.6.17.8 kernel from kernel.org.
-Device handlers
----------------
-
-Device specific drivers (device handlers) are plugins for SCST, which
-help SCST to analyze incoming requests and determine parameters,
-specific to various types of devices. If an appropriate device handler
-for a SCSI device type isn't loaded, SCST doesn't know how to handle
-devices of this type, so they will be invisible for remote initiators
-(more precisely, "LUN not supported" sense code will be returned).
-
-In addition to device handlers for real devices, there are FILEIO and
-"performance" ones.
-
-FILEIO device handler works over files on file systems and makes from
-them virtual remotely available SCSI disks or CDROM's. In addition, it
-allows to work directly over a block device, e.g. local IDE or SCSI disk
-or ever disk partition, where there is no file systems overhead. Using
-block devices comparing to sending SCSI commands directly to SCSI
-mid-level via scsi_do_req() has advantage that data are transfered via
-system cache, so it is possible to fully benefit from caching and read
-ahead performed by Linux's VM subsystem. The only disadvantage here that
-there is superfluous data copying between the cache and SCST's buffers.
-This issue is going to be addressed in the next release. Virtual CDROM's
-are useful for remote installation. See below for details how to setup
-and use FILEIO device handler.
-
-"Performance" device handlers for disks, MO disks and tapes in their
-exec() method skip (pretend to execute) all READ and WRITE operations
-and thus provide a way for direct link performance measurements without
-overhead of actual data transferring from/to underlying SCSI device.
-
-NOTE: Since "perf" device handlers on READ operations don't touch the
-==== commands' data buffer, it is returned to remote initiators as it
- was allocated, without even being zeroed. Thus, "perf" device
- handlers impose some security risk, so use them with caution.
-
Installation
------------
At first, make sure that the link "/lib/modules/`you_kernel_version`/build"
points to the source code for your currently running kernel.
-Then, if you are going to work on 2.6 kernels, since in those kernels
-scsi_do_req() works in LIFO order, instead of expected and required
-FIFO, SCST needs a new function scsi_do_req_fifo() to be added in the
-kernel. Patch 26_scst.patch (or 26_scst-2.6.14-.patch for early kernels)
-from "kernel" directory does that. If it doesn't apply to your kernel
-version, apply it manually, it only adds that function and nothing more.
-You may not patch the kernel if STRICT_SERIALIZING is defined during the
-compilation (see its description below).
+Then, since in the mainstream kernels scsi_do_req()/scsi_execute_async()
+work in LIFO order, instead of expected and required FIFO, SCST needs a
+new functions scsi_do_req_fifo()/scsi_execute_async_fifo() to be added
+in the kernel. Patch 26_scst-2.6.X.patch from "kernel" directory does
+that. If it doesn't apply to your kernel, apply it manually, it only
+adds one of those functions and nothing more. You may not patch the
+kernel if STRICT_SERIALIZING or FILEIO_ONLY are defined during the
+compilation (see their description below).
-To compile SCST go to 'src' directory and type 'make' on 2.6 kernels and
-'make -f Makefile-24' on 2.4 ones. It will build SCST itself and its
-device handlers. To install them type 'make install'. The driver modules
-will be installed in
-'/lib/modules/`you_kernel_version`/kernel/drivers/scsi/scsi_tgt' on 2.4
-kernels and in '/lib/modules/`you_kernel_version`/extra' on 2.6 ones. In
-addition, scsi_tgt.h, scst_debug.h and scst_debug.c will be copied to
+To compile SCST type 'make'. It will build SCST itself and its device
+handlers. To install them type 'make install'. The driver modules will
+be installed in '/lib/modules/`you_kernel_version`/extra'. In addition,
+scsi_tgt.h, scst_debug.h and scst_debug.c will be copied to
'/usr/local/include/scst'. The first file contains all SCST's public
data definition, which are used by target drivers. The other ones
support debug messages logging.
@@ -115,19 +76,53 @@
important for execution via sg and st commands that change
the state of devices and their parameters, because that could
lead to data corruption. If any such command is done, at
- least related device handler driver(s) must be restarted. For
- block devices READ/WRITE commands using direct disk handler
- look to be safe.
+ least related device handler(s) must be restarted. For block
+ devices READ/WRITE commands using direct disk handler look to
+ be safe.
-To uninstall, type 'make uninstall'. It is not implemented for 2.6
-kernels.
+To uninstall, type 'make uninstall'.
If you install QLA2x00 target driver's source code in this directory,
then you can build, install or uninstall it by typing 'make qla', 'make
-qla_install' or 'make qla_uninstall' correspondingly. Or 'make qla26',
-'make qla26_install' or 'make qla26_uninstall' for new 2.6 driver. For
-more details about QLA2x00 target drivers see their README files.
+qla_install' or 'make qla_uninstall' correspondingly. For more details
+about QLA2x00 target drivers see their README files.
+Device handlers
+---------------
+
+Device specific drivers (device handlers) are plugins for SCST, which
+help SCST to analyze incoming requests and determine parameters,
+specific to various types of devices. If an appropriate device handler
+for a SCSI device type isn't loaded, SCST doesn't know how to handle
+devices of this type, so they will be invisible for remote initiators
+(more precisely, "LUN not supported" sense code will be returned).
+
+In addition to device handlers for real devices, there are FILEIO and
+"performance" ones.
+
+FILEIO device handler works over files on file systems and makes from
+them virtual remotely available SCSI disks or CDROM's. In addition, it
+allows to work directly over a block device, e.g. local IDE or SCSI disk
+or ever disk partition, where there is no file systems overhead. Using
+block devices comparing to sending SCSI commands directly to SCSI
+mid-level via scsi_do_req()/scsi_execute_async() has advantage that data
+are transfered via system cache, so it is possible to fully benefit from
+caching and read ahead performed by Linux's VM subsystem. The only
+disadvantage here that there is superfluous data copying between the
+cache and SCST's buffers. This issue is going to be addressed in the
+next release. Virtual CDROM's are useful for remote installation. See
+below for details how to setup and use FILEIO device handler.
+
+"Performance" device handlers for disks, MO disks and tapes in their
+exec() method skip (pretend to execute) all READ and WRITE operations
+and thus provide a way for direct link performance measurements without
+overhead of actual data transferring from/to underlying SCSI device.
+
+NOTE: Since "perf" device handlers on READ operations don't touch the
+==== commands' data buffer, it is returned to remote initiators as it
+ was allocated, without even being zeroed. Thus, "perf" device
+ handlers impose some security risk, so use them with caution.
+
Compilation options
-------------------
@@ -175,7 +170,7 @@
SCST_HIGHMEM isn't required for HIGHMEM systems and SCST will work
fine on them with SCST_HIGHMEM off. Untested.
- - SCST_STRICT_SECURITY - if defined, makes SCST zero allocated data
+ - SCST_STRICT_SECURITY - if defined, makes SCST clean allocated data
buffers. Undefining it (default) considerably improves performance
and eases CPU load, but could create a security hole (information
leakage), so enable it, if you have strict security requirements.
@@ -209,6 +204,13 @@
on device with host:channel:id:lun
- "sessions" file, which lists currently connected initiators (open sessions)
+
+ - "sgv" file provides some statistic about with which block sizes
+ commands from remote initiators come and how effective sgv_pool in
+ serving those allocations from the cache, i.e. without memory
+ allocations requests to the kernel. "Size" - is the commands data
+ size upper rounded to power of 2, "Hit" - how many there are
+ allocations from the cache, "Total" - total number of allocations.
- "threads" file, which allows to read and set number of SCST's threads
@@ -303,10 +305,11 @@
information of currently open device files. On write it supports the
following command:
- * "open NAME PATH [BLOCK_SIZE] [FLAGS]" - opens file "PATH" as
+ * "open NAME [PATH] [BLOCK_SIZE] [FLAGS]" - opens file "PATH" as
device "NAME" with block size "BLOCK_SIZE" bytes with flags
- "FLAGS". The block size must be power of 2 and >= 512 bytes
- Default is 512. Possible flags:
+ "FLAGS". "PATH" could be empty only for FILEIO CDROM. "BLOCK_SIZE"
+ and "FLAGS" are valid only for disk FILEIO. The block size must be
+ power of 2 and >= 512 bytes Default is 512. Possible flags:
- WRITE_THROUGH - write back caching disabled
@@ -337,6 +340,8 @@
* "close NAME" - closes device "NAME".
+ * "change NAME [PATH]" - changes a virtual CD in the FILEIO CDROM.
+
For example, "echo "open disk1 /vdisks/disk1" >/proc/scsi_tgt/disk_fileio/disk_fileio"
will open file /vdisks/disk1 as virtual FILEIO disk with name "disk1".
@@ -359,19 +364,20 @@
correspondingly. Note, that usually it turned off by default
and the status of barriers usage isn't reported anywhere in
the system logs as well as there is no way to know it on the
- mounted file system (at least we don't know how). Also note
+ mounted file system (at least no known one). Also note
that on some real-life workloads write through caching might
- perform better, than write back one with barrier protection
+ perform better, than write back one with the barrier protection
turned on.
IMPORTANT: Many disk and partition table mananagement utilities don't support
========= block sizes >512 bytes, therefore make sure that your favorite one
supports it. Also, if you export disk file or device with
- another block size, than one, with which it was already
- divided on partitions, you could get various weird things
- like utilities hang up or other unexpected behaviour. Thus, to
- be sure, zero the exported file or device before the first
- access to it from the remote initiator with another block size.
+ some block size, different from one, with which it was
+ already divided on partitions, you could get various weird
+ things like utilities hang up or other unexpected behaviour.
+ Hence, to be sure, zero the exported file or device before the
+ first access to it from the remote initiator with another
+ block size.
Performance
-----------
@@ -379,10 +385,9 @@
Before doing any performance measurements note that:
I. Maximum performance is possible only with real SCSI devices or
-performance handlers. FILEIO handler isn't optimized for performance
-yet, although, if you have enough CPU power, it could provide very
-acceptable results, when aggregate throughput is close to aggregate
-throuput locally on the target on the same disks.
+performance handlers. If you have enough CPU power, FILEIO handler could
+provide the same results, when aggregate throughput is close to
+aggregate throuput locally on the target on the same disks.
II. In order to get the maximum performance you should:
@@ -411,7 +416,7 @@
for locally attached disks, therefore they are not optimal if they
attached remotly (our case), which sometimes could lead to unexpectedly
low throughput. You should increase read-ahead size
- (/sys/block/device/queue/read_ahead_kb) for at least 256Kb or even
+ (/sys/block/device/queue/read_ahead_kb) to at least 256Kb or even
more on all initiators and the target. Also experiment with other
parameters in /sys/block/device directory, they also affect the
performance. If you find the best values, please share them with us.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-11-09 11:07:36
|
Revision: 30
http://svn.sourceforge.net/scst/?rev=30&view=rev
Author: vlnb
Date: 2006-11-09 03:07:14 -0800 (Thu, 09 Nov 2006)
Log Message:
-----------
Pass-through mode resid handlning updated
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2006-11-07 10:53:35 UTC (rev 29)
+++ trunk/scst/src/scst_targ.c 2006-11-09 11:07:14 UTC (rev 30)
@@ -1011,7 +1011,8 @@
}
static void scst_do_cmd_done(struct scst_cmd *cmd, int result,
- const uint8_t *rq_sense, int rq_sense_len, int *next_state)
+ const uint8_t *rq_sense, int rq_sense_len, int resid,
+ int *next_state)
{
unsigned char type;
@@ -1022,9 +1023,19 @@
cmd->msg_status = msg_byte(result);
cmd->host_status = host_byte(result);
cmd->driver_status = driver_byte(result);
- TRACE(TRACE_SCSI, "result=%x, cmd->status=%x, "
+ if (unlikely(resid != 0)) {
+#ifdef EXTRACHECKS
+ if ((resid < 0) || (resid >= cmd->resp_data_len)) {
+ PRINT_ERROR_PR("Wrong resid %d (cmd->resp_data_len=%d)",
+ resid, cmd->resp_data_len);
+ } else
+#endif
+ scst_set_resp_data_len(cmd, cmd->resp_data_len - resid);
+ }
+
+ TRACE(TRACE_SCSI, "result=%x, cmd->status=%x, resid=%d, "
"cmd->masked_status=%x, cmd->msg_status=%x, cmd->host_status=%x, "
- "cmd->driver_status=%x", result, cmd->status,
+ "cmd->driver_status=%x", result, cmd->status, resid,
cmd->masked_status, cmd->msg_status, cmd->host_status,
cmd->driver_status);
@@ -1091,22 +1102,13 @@
WARN_ON(in_irq());
- /*
- * We don't use scsi_cmd->resid, because:
- * 1. Many low level initiator drivers don't use (set) this field
- * 2. We determine the command's buffer size directly from CDB,
- * so scsi_cmd->resid is not relevant for us, and target drivers
- * should know the residual, if necessary, by comparing expected
- * and actual transfer sizes.
- */
-
cmd = scst_get_cmd(scsi_cmd, &req);
if (cmd == NULL)
goto out;
next_state = SCST_CMD_STATE_DEV_DONE;
scst_do_cmd_done(cmd, req->sr_result, req->sr_sense_buffer,
- sizeof(req->sr_sense_buffer), &next_state);
+ sizeof(req->sr_sense_buffer), scsi_cmd->resid, &next_state);
/* Clear out request structure */
req->sr_use_sg = 0;
@@ -1153,7 +1155,7 @@
goto out;
next_state = SCST_CMD_STATE_DEV_DONE;
- scst_do_cmd_done(cmd, result, sense, SCSI_SENSE_BUFFERSIZE,
+ scst_do_cmd_done(cmd, result, sense, SCSI_SENSE_BUFFERSIZE, resid,
&next_state);
cmd->state = next_state;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-11-07 17:48:57
|
Revision: 28
http://svn.sourceforge.net/scst/?rev=28&view=rev
Author: vlnb
Date: 2006-11-07 02:48:12 -0800 (Tue, 07 Nov 2006)
Log Message:
-----------
- One more iteration of scst_get_context() related fixes
- Locking cleanup while calling dev handlers' task_mgmt_fn()
- STRICT_SERIALIZING mode fixes
- Cleanups
Modified Paths:
--------------
trunk/scst/include/scsi_tgt.h
trunk/scst/src/dev_handlers/scst_fileio.c
trunk/scst/src/scst.c
trunk/scst/src/scst_lib.c
trunk/scst/src/scst_priv.h
trunk/scst/src/scst_targ.c
Modified: trunk/scst/include/scsi_tgt.h
===================================================================
--- trunk/scst/include/scsi_tgt.h 2006-11-03 17:41:16 UTC (rev 27)
+++ trunk/scst/include/scsi_tgt.h 2006-11-07 10:48:12 UTC (rev 28)
@@ -774,7 +774,7 @@
* - SCST_DEV_TM_NOT_COMPLETED - regular standard actions for the command
* should be done
*
- * NOTE: for SCST_ABORT_TASK called under spinlock
+ * Called with BH off. Might be called under a lock and IRQ off.
*/
int (*task_mgmt_fn) (struct scst_mgmt_cmd *mgmt_cmd,
struct scst_tgt_dev *tgt_dev);
Modified: trunk/scst/src/dev_handlers/scst_fileio.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_fileio.c 2006-11-03 17:41:16 UTC (rev 27)
+++ trunk/scst/src/dev_handlers/scst_fileio.c 2006-11-07 10:48:12 UTC (rev 28)
@@ -2212,7 +2212,7 @@
return;
}
-/* Might be called under lock and IRQ off */
+/* Called with BH off. Might be called under lock and IRQ off */
static int fileio_task_mgmt_fn(struct scst_mgmt_cmd *mcmd,
struct scst_tgt_dev *tgt_dev)
{
@@ -2221,16 +2221,16 @@
TRACE_ENTRY();
if (mcmd->fn == SCST_ABORT_TASK) {
- unsigned long flags;
struct scst_cmd *cmd_to_abort = mcmd->cmd_to_abort;
struct scst_fileio_tgt_dev *ftgt_dev =
(struct scst_fileio_tgt_dev *)cmd_to_abort->tgt_dev->dh_priv;
- /*
- * Actually, _bh lock is enough here. But, since we
- * could be called with IRQ off, the in-kernel debug check
- * gives false alarm on using _bh lock. So, let's suppress it.
+
+ /*
+ * It is safe relating to scst_list_lock despite of lockdep's
+ * warning. Just don't know how to tell it to lockdep.
*/
- spin_lock_irqsave(&ftgt_dev->fdev_lock, flags);
+ /* BH already off */
+ spin_lock(&ftgt_dev->fdev_lock);
if (cmd_to_abort->fileio_in_list) {
TRACE(TRACE_MGMT, "Aborting cmd %p and moving it to "
"the queue head", cmd_to_abort);
@@ -2239,7 +2239,7 @@
&ftgt_dev->fdev_cmd_list);
wake_up(&ftgt_dev->fdev_waitQ);
}
- spin_unlock_irqrestore(&ftgt_dev->fdev_lock, flags);
+ spin_unlock(&ftgt_dev->fdev_lock);
}
TRACE_EXIT_RES(res);
@@ -2522,8 +2522,14 @@
TRACE_DBG("%s", "READ_ONLY");
} else if (!strncmp("O_DIRECT", p, 8)) {
p += 8;
+ #if 0
+
virt_dev->o_direct_flag = 1;
TRACE_DBG("%s", "O_DIRECT");
+ #else
+ PRINT_INFO_PR("%s flag doesn't currently"
+ " work, ignoring it", "O_DIRECT");
+ #endif
} else if (!strncmp("NULLIO", p, 6)) {
p += 6;
virt_dev->nullio = 1;
Modified: trunk/scst/src/scst.c
===================================================================
--- trunk/scst/src/scst.c 2006-11-03 17:41:16 UTC (rev 27)
+++ trunk/scst/src/scst.c 2006-11-07 10:48:12 UTC (rev 28)
@@ -34,10 +34,6 @@
#include "scst_debug.c"
-#if defined(DEBUG) || defined(TRACING)
-unsigned long trace_flag = SCST_DEFAULT_LOG_FLAGS;
-#endif
-
/*
* All targets, devices and dev_types management is done under
* this mutex.
@@ -73,6 +69,10 @@
LIST_HEAD(scst_cmd_list);
DECLARE_WAIT_QUEUE_HEAD(scst_list_waitQ);
+#if defined(DEBUG) || defined(TRACING)
+unsigned long trace_flag = SCST_DEFAULT_LOG_FLAGS;
+#endif
+
spinlock_t scst_cmd_mem_lock = SPIN_LOCK_UNLOCKED;
unsigned long scst_cur_cmd_mem, scst_cur_max_cmd_mem;
Modified: trunk/scst/src/scst_lib.c
===================================================================
--- trunk/scst/src/scst_lib.c 2006-11-03 17:41:16 UTC (rev 27)
+++ trunk/scst/src/scst_lib.c 2006-11-07 10:48:12 UTC (rev 28)
@@ -1651,6 +1651,7 @@
{
struct scst_session *sess = tgt_dev->sess;
+ local_bh_disable();
spin_lock_irq(&scst_list_lock);
TRACE_DBG("Searching in search cmd list (sess=%p)", sess);
@@ -1666,6 +1667,7 @@
}
}
spin_unlock_irq(&scst_list_lock);
+ local_bh_enable();
}
list_for_each_entry_safe(cmd, tcmd, &dev->blocked_cmd_list,
@@ -1980,37 +1982,43 @@
void scst_unblock_cmds(struct scst_device *dev)
{
#ifdef STRICT_SERIALIZING
- struct scst_cmd *cmd;
+ struct scst_cmd *cmd, *t;
int found = 0;
TRACE_ENTRY();
- list_for_each_entry(cmd, &dev->blocked_cmd_list,
+ list_for_each_entry_safe(cmd, t, &dev->blocked_cmd_list,
blocked_cmd_list_entry) {
+ unsigned long flags;
+ int brk = 0;
/*
* Since only one cmd per time is being executed, expected_sn
* can't change behind us, if the corresponding cmd is in
- * blocked_cmd_list
+ * blocked_cmd_list, but we could be called before
+ * __scst_inc_expected_sn().
*/
- if ((cmd->tgt_dev && (cmd->sn == cmd->tgt_dev->expected_sn)) ||
- (unlikely(cmd->internal) || unlikely(cmd->retry))) {
- unsigned long flags;
- list_del(&cmd->blocked_cmd_list_entry);
- TRACE_MGMT_DBG("Moving cmd %p to active cmd list", cmd);
- spin_lock_irqsave(&scst_list_lock, flags);
- list_move(&cmd->cmd_list_entry, &scst_active_cmd_list);
- spin_unlock_irqrestore(&scst_list_lock, flags);
- wake_up(&scst_list_waitQ);
- found = 1;
+ if (likely(!cmd->internal) && likely(!cmd->retry)) {
+ int expected_sn;
+ if (cmd->tgt_dev == NULL)
+ BUG();
+ expected_sn = cmd->tgt_dev->expected_sn;
+ if (cmd->sn == expected_sn)
+ brk = 1;
+ else if (cmd->sn != (expected_sn+1))
+ continue;
+ }
+
+ list_del(&cmd->blocked_cmd_list_entry);
+ TRACE_MGMT_DBG("Moving cmd %p to active cmd list", cmd);
+ spin_lock_irqsave(&scst_list_lock, flags);
+ list_move(&cmd->cmd_list_entry, &scst_active_cmd_list);
+ spin_unlock_irqrestore(&scst_list_lock, flags);
+ found = 1;
+ if (brk)
break;
- }
}
-#ifdef EXTRACHECKS
- if (!found && !list_empty(&dev->blocked_cmd_list)) {
- TRACE(TRACE_MINOR, "%s", "No commands unblocked when "
- "blocked cmd list is not empty");
- }
-#endif
+ if (found)
+ wake_up(&scst_list_waitQ);
#else /* STRICT_SERIALIZING */
struct scst_cmd *cmd, *tcmd;
unsigned long flags;
Modified: trunk/scst/src/scst_priv.h
===================================================================
--- trunk/scst/src/scst_priv.h 2006-11-03 17:41:16 UTC (rev 27)
+++ trunk/scst/src/scst_priv.h 2006-11-07 10:48:12 UTC (rev 28)
@@ -104,11 +104,9 @@
static inline int scst_get_context(void) {
if (in_irq())
return SCST_CONTEXT_TASKLET;
- if (in_softirq())
- return SCST_CONTEXT_DIRECT_ATOMIC;
- if (in_interrupt()) /* Is it possible? */
+ if (irqs_disabled())
return SCST_CONTEXT_THREAD;
- if (in_atomic())
+ if (in_softirq() || in_atomic())
return SCST_CONTEXT_DIRECT_ATOMIC;
return SCST_CONTEXT_DIRECT;
}
@@ -447,8 +445,11 @@
static inline void scst_sess_put(struct scst_session *sess)
{
- if (atomic_dec_and_test(&sess->refcnt))
+ smp_mb__before_atomic_dec();
+ if (atomic_dec_and_test(&sess->refcnt)) {
+ smp_mb__after_atomic_dec();
scst_sched_session_free(sess);
+ }
}
void __scst_suspend_activity(void);
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2006-11-03 17:41:16 UTC (rev 27)
+++ trunk/scst/src/scst_targ.c 2006-11-07 10:48:12 UTC (rev 28)
@@ -2469,7 +2469,9 @@
TRACE_ENTRY();
+#ifdef EXTRACHECKS
BUG_ON(in_irq());
+#endif
cmd->atomic = ((context & ~SCST_PROCESSIBLE_ENV) ==
SCST_CONTEXT_DIRECT_ATOMIC);
@@ -2788,10 +2790,18 @@
{
int res = SCST_DEV_TM_NOT_COMPLETED;
if (tgt_dev->acg_dev->dev->handler->task_mgmt_fn) {
+ int irq = irqs_disabled();
TRACE_MGMT_DBG("Calling dev handler %s task_mgmt_fn(fn=%d)",
- tgt_dev->acg_dev->dev->handler->name, mcmd->fn);
+ tgt_dev->acg_dev->dev->handler->name, mcmd->fn);
+#ifdef EXTRACHECKS
+ BUG_ON(in_irq());
+#endif
+ if (!irq)
+ local_bh_disable();
res = tgt_dev->acg_dev->dev->handler->task_mgmt_fn(mcmd,
tgt_dev);
+ if (!irq)
+ local_bh_enable();
TRACE_MGMT_DBG("Dev handler %s task_mgmt_fn() returned %d",
tgt_dev->acg_dev->dev->handler->name, res);
if (set_status && (res != SCST_DEV_TM_NOT_COMPLETED)) {
@@ -2817,7 +2827,7 @@
/*
* Called under scst_list_lock and IRQ off (to protect cmd
- * from being destroyed).
+ * from being destroyed) + BHs also off
* Returns -1 if command is being executed (ABORT failed), 0 otherwise
*/
void scst_abort_cmd(struct scst_cmd *cmd, struct scst_mgmt_cmd *mcmd,
@@ -2945,6 +2955,7 @@
TRACE_ENTRY();
+ local_bh_disable();
spin_lock_irq(&scst_list_lock);
TRACE_DBG("Searching in search cmd list (sess=%p)", sess);
@@ -2958,6 +2969,7 @@
scst_abort_cmd(cmd, mcmd, other_ini, 0);
}
spin_unlock_irq(&scst_list_lock);
+ local_bh_enable();
scst_unblock_aborted_cmds(scst_mutex_held);
@@ -3026,6 +3038,7 @@
struct scst_session *sess = mcmd->sess;
struct scst_cmd *cmd;
+ local_bh_disable();
spin_lock_irq(&scst_list_lock);
cmd = __scst_find_cmd_by_tag(sess, mcmd->tag);
if (cmd == NULL) {
@@ -3042,6 +3055,7 @@
mcmd->cmd_to_abort = NULL; /* just in case */
}
spin_unlock_irq(&scst_list_lock);
+ local_bh_enable();
} else {
int rc;
rc = scst_mgmt_translate_lun(mcmd);
@@ -3944,8 +3958,12 @@
scst_free_session_callback(sess);
} else if (sess->init_phase == SCST_SESS_IPH_INITING) {
scst_init_session(sess);
- } else
+ } else {
+ PRINT_ERROR_PR("session %p is in "
+ "scst_sess_mgmt_list, but in unknown "
+ "phase %x", sess, sess->init_phase);
BUG();
+ }
spin_lock_irq(&scst_mgmt_lock);
goto restart;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-11-07 17:45:47
|
Revision: 29
http://svn.sourceforge.net/scst/?rev=29&view=rev
Author: vlnb
Date: 2006-11-07 02:53:35 -0800 (Tue, 07 Nov 2006)
Log Message:
-----------
DEBUG_WORK_IN_THREAD undefined
Modified Paths:
--------------
trunk/qla2x00t/qla2x00-target/Makefile
Modified: trunk/qla2x00t/qla2x00-target/Makefile
===================================================================
--- trunk/qla2x00t/qla2x00-target/Makefile 2006-11-07 10:48:12 UTC (rev 28)
+++ trunk/qla2x00t/qla2x00-target/Makefile 2006-11-07 10:53:35 UTC (rev 29)
@@ -31,12 +31,12 @@
SCST_DIR := $(shell pwd)/../../scst/src
EXTRA_CFLAGS += -I$(SCST_INC_DIR) -DFC_TARGET_SUPPORT
EXTRA_CFLAGS += -DFC_SCST_WWN_AUTH
-EXTRA_CFLAGS += -DEXTRACHECKS
INSTALL_DIR := /lib/modules/$(shell uname -r)/extra
+EXTRA_CFLAGS += -DEXTRACHECKS
#EXTRA_CFLAGS += -DTRACING
-EXTRA_CFLAGS += -DDEBUG_TGT -DDEBUG_WORK_IN_THREAD
+EXTRA_CFLAGS += -DDEBUG_TGT
#EXTRA_CFLAGS += -DDEBUG_WORK_IN_THREAD
ifeq ($(KVER),)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-11-03 17:41:30
|
Revision: 27
http://svn.sourceforge.net/scst/?rev=27&view=rev
Author: vlnb
Date: 2006-11-03 09:41:16 -0800 (Fri, 03 Nov 2006)
Log Message:
-----------
- Fixed double locking regression, introduced rev20
- Small docs update
Revision Links:
--------------
http://svn.sourceforge.net/scst/?rev=20&view=rev
Modified Paths:
--------------
trunk/qla2x00t/qla2x00-target/ChangeLog
trunk/qla2x00t/qla2x00-target/README
trunk/qla2x00t/qla2x00-target/ToDo
trunk/qla2x00t/qla2x00-target/qla2x00t.c
Modified: trunk/qla2x00t/qla2x00-target/ChangeLog
===================================================================
--- trunk/qla2x00t/qla2x00-target/ChangeLog 2006-11-02 12:10:53 UTC (rev 26)
+++ trunk/qla2x00t/qla2x00-target/ChangeLog 2006-11-03 17:41:16 UTC (rev 27)
@@ -2,6 +2,8 @@
-----------------------------------------------------
- Ported to 2.6.17.x and 2.6.18.
+
+ - Problem with not found WWN on the first login attempt fixed.
- Updated for the latest SCST interfaces changes.
Modified: trunk/qla2x00t/qla2x00-target/README
===================================================================
--- trunk/qla2x00t/qla2x00-target/README 2006-11-02 12:10:53 UTC (rev 26)
+++ trunk/qla2x00t/qla2x00-target/README 2006-11-03 17:41:16 UTC (rev 27)
@@ -24,14 +24,6 @@
initiator driver was taken from kernel version 2.6.17.8, but it should
also work on other versions, including 2.6.18.x and 2.6.16.x.
-NOTE: WWN-based authentification on 2200 cards doesn't always work from
----- the first "connect", but works on all subsequent attempts.
- On this error message "Unable to find wwn login for loop
- id XX, using loop id instead" is logged. So, just try again, eg
- unload/load FC card driver on the initiator host. This is the
- current limitation. Everyone who fix it or found a usable
- workaround is welcome.
-
See also "ToDo" file for list of known issues and unimplemented
features.
@@ -74,9 +66,8 @@
in/out in Makefile:
- FC_SCST_WWN_AUTH - turns on using remote initiator's WWN as
- authentification name for scst_register_session_ex(). See note above
- about limitations of this mode. If it is off, LOOP ID used instead of
- WWN.
+ authentification name for scst_register_session_ex(). If it is off,
+ LOOP ID used instead of WWN.
- DEBUG_TGT - turns on some debugging code, including some logging. Makes
the driver considerably bigger and slower, producing large amount of
Modified: trunk/qla2x00t/qla2x00-target/ToDo
===================================================================
--- trunk/qla2x00t/qla2x00-target/ToDo 2006-11-02 12:10:53 UTC (rev 26)
+++ trunk/qla2x00t/qla2x00-target/ToDo 2006-11-03 17:41:16 UTC (rev 27)
@@ -17,13 +17,11 @@
- SNS support.
- - Support for sense with length > 26 (is it possible at all?)
+ - Support for sense with length > 26 (is it possible?)
- - Queue types (simple, ordered, etc.) support (needs appropriate support
- from SCST and Linux kernel)
-
- On 2300 if on a tape with block size 0 we write block with size X
and then read it with bs <X the tape skips all blocks with size X
until the next correct block or filemark found, instead of returning
ILI with negative counter. Looks like the initiator retries the
- command quetly. 2200 works correctly.
+ command quetly. 2200 works correctly. With the latest firmware that
+ might be fixed.
Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c
===================================================================
--- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2006-11-02 12:10:53 UTC (rev 26)
+++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2006-11-03 17:41:16 UTC (rev 27)
@@ -94,7 +94,7 @@
static void q2t_host_action(scsi_qla_host_t *ha,
qla2x_tgt_host_action_t action);
static void q2t_send_term_exchange(scsi_qla_host_t *ha, struct q2t_cmd *cmd,
- atio_entry_t *atio);
+ atio_entry_t *atio, int ha_locked);
/*
* Global Variables
@@ -694,7 +694,7 @@
prm.cmd->state = Q2T_STATE_ABORTED;
- q2t_send_term_exchange(ha, prm.cmd, &prm.cmd->atio);
+ q2t_send_term_exchange(ha, prm.cmd, &prm.cmd->atio, 0);
/* !! At this point cmd could be already freed !! */
goto out;
}
@@ -880,17 +880,18 @@
}
static void q2t_send_term_exchange(scsi_qla_host_t *ha, struct q2t_cmd *cmd,
- atio_entry_t *atio)
+ atio_entry_t *atio, int ha_locked)
{
ctio_ret_entry_t *ctio;
- unsigned long flags;
+ unsigned long flags = 0;
int do_tgt_cmd_done = 0;
TRACE_ENTRY();
TRACE_DBG("Sending TERM EXCH CTIO (ha=%p)", ha);
- spin_lock_irqsave(&ha->hardware_lock, flags);
+ if (!ha_locked)
+ spin_lock_irqsave(&ha->hardware_lock, flags);
/* Send marker if required */
if (tgt_data.issue_marker(ha) != QLA_SUCCESS) {
@@ -934,7 +935,8 @@
q2t_exec_queue(ha);
out_unlock:
- spin_unlock_irqrestore(&ha->hardware_lock, flags);
+ if (!ha_locked)
+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
if (do_tgt_cmd_done) {
msleep(250);
@@ -1742,7 +1744,7 @@
rc = q2t_send_cmd_to_scst(ha, atio);
if (unlikely(rc != 0)) {
if (rc == -ESRCH) {
- q2t_send_term_exchange(ha, NULL, atio);
+ q2t_send_term_exchange(ha, NULL, atio, 1);
} else {
PRINT_INFO("qla2x00tgt(%ld): Unable to "
"send the command to SCSI target "
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-11-02 18:40:17
|
Revision: 24
http://svn.sourceforge.net/scst/?rev=24&view=rev
Author: vlnb
Date: 2006-11-02 04:03:39 -0800 (Thu, 02 Nov 2006)
Log Message:
-----------
Showing block size added to /proc/scsi_tgt/disk_fileio/disk_fileio
Modified Paths:
--------------
trunk/scst/src/dev_handlers/scst_fileio.c
Modified: trunk/scst/src/dev_handlers/scst_fileio.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_fileio.c 2006-11-02 11:20:46 UTC (rev 23)
+++ trunk/scst/src/dev_handlers/scst_fileio.c 2006-11-02 12:03:39 UTC (rev 24)
@@ -2301,8 +2301,8 @@
}
if (inout == 0) { /* read */
- size = scnprintf(buffer, length, "%-17s %-12s %-15s %s\n",
- "Name", "Size(MB)", "Options", "File name");
+ size = scnprintf(buffer, length, "%-17s %-11s %-11s %-15s %s\n",
+ "Name", "Size(MB)", "Block size", "Options", "File name");
if (fileio_proc_update_size(size, &len, &begin, &pos, &offset)) {
res = len;
goto out_up;
@@ -2313,8 +2313,9 @@
{
int c;
size = scnprintf(buffer + len, length - len,
- "%-17s %-13d", virt_dev->name,
- (uint32_t)(virt_dev->file_size >> 20));
+ "%-17s %-11d %-12d", virt_dev->name,
+ (uint32_t)(virt_dev->file_size >> 20),
+ virt_dev->block_size);
if (fileio_proc_update_size(size, &len, &begin, &pos,
&offset)) {
res = len;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-11-02 18:40:15
|
Revision: 26
http://svn.sourceforge.net/scst/?rev=26&view=rev
Author: vlnb
Date: 2006-11-02 04:10:53 -0800 (Thu, 02 Nov 2006)
Log Message:
-----------
Serving commands, whose expected data len is less, than maximum, fixed. Particularly, it affected READ CAPACITY(16) from Linux initiators
Modified Paths:
--------------
trunk/scst/src/scst_cdbprobe.h
trunk/scst/src/scst_lib.c
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_cdbprobe.h
===================================================================
--- trunk/scst/src/scst_cdbprobe.h 2006-11-02 12:08:28 UTC (rev 25)
+++ trunk/scst/src/scst_cdbprobe.h 2006-11-02 12:10:53 UTC (rev 26)
@@ -385,8 +385,8 @@
SCST_DATA_WRITE, 4, SCST_UNKNOWN_LENGTH, 1, 0}, /*N2! */
{0x93, " M ", "ERASE(16)",
SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0},
- {0x9E, "M ", "SERVICE ACTION IN",
- SCST_DATA_READ, 4, 0, 0, 0},
+ {0x9E, "O ", "SERVICE ACTION IN",
+ SCST_DATA_READ, 0, 0, 0, 0},
/* 12-bytes length CDB */
{0xA0, "VVVVVVVVVV M ", "REPORT LUN",
Modified: trunk/scst/src/scst_lib.c
===================================================================
--- trunk/scst/src/scst_lib.c 2006-11-02 12:08:28 UTC (rev 25)
+++ trunk/scst/src/scst_lib.c 2006-11-02 12:10:53 UTC (rev 26)
@@ -1485,9 +1485,8 @@
}
}
if (!info_p->transfer_len) {
- TRACE(TRACE_SCSI,
- "Warning! transfer_len 0, direction %d change on " "%d",
- info_p->direction, SCST_DATA_NONE);
+ TRACE_DBG("Warning! transfer_len 0, direction %d change on %d",
+ info_p->direction, SCST_DATA_NONE);
info_p->direction = SCST_DATA_NONE;
}
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2006-11-02 12:08:28 UTC (rev 25)
+++ trunk/scst/src/scst_targ.c 2006-11-02 12:10:53 UTC (rev 26)
@@ -374,15 +374,25 @@
TRACE_DBG("Dev handler %s parse() returned %d",
dev->handler->name, state);
- if (cmd->data_len == -1)
- cmd->data_len = cmd->bufflen;
-
if (state == SCST_CMD_STATE_DEFAULT)
state = SCST_CMD_STATE_PREPARE_SPACE;
}
else
state = SCST_CMD_STATE_PREPARE_SPACE;
+ if (scst_cmd_is_expected_set(cmd)) {
+ if (cmd->expected_transfer_len < cmd->bufflen) {
+ TRACE(TRACE_SCSI, "cmd->expected_transfer_len(%d) < "
+ "cmd->bufflen(%d), using expected_transfer_len "
+ "instead", cmd->expected_transfer_len,
+ cmd->bufflen);
+ cmd->bufflen = cmd->expected_transfer_len;
+ }
+ }
+
+ if (cmd->data_len == -1)
+ cmd->data_len = cmd->bufflen;
+
#ifdef EXTRACHECKS
if (state != SCST_CMD_STATE_NEED_THREAD_CTX) {
if (((cmd->data_direction == SCST_DATA_UNKNOWN) &&
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-11-02 18:40:13
|
Revision: 20
http://svn.sourceforge.net/scst/?rev=20&view=rev
Author: vlnb
Date: 2006-11-02 02:43:12 -0800 (Thu, 02 Nov 2006)
Log Message:
-----------
The first attempt to fix the "Unable to find wwn login for loop id 2, using loop id instead" problem
Modified Paths:
--------------
trunk/qla2x00t/qla2x00-target/qla2x00t.c
Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c
===================================================================
--- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2006-10-27 10:43:58 UTC (rev 19)
+++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2006-11-02 10:43:12 UTC (rev 20)
@@ -112,7 +112,8 @@
static void q2t_ctio_completion(scsi_qla_host_t *ha, uint32_t handle);
static void q2t_host_action(scsi_qla_host_t *ha,
qla2x_tgt_host_action_t action);
-static void q2x_send_term_exchange(scsi_qla_host_t *ha, struct q2t_cmd *cmd);
+static void q2t_send_term_exchange(scsi_qla_host_t *ha, struct q2t_cmd *cmd,
+ atio_entry_t *atio);
/*
* Global Variables
@@ -710,7 +711,7 @@
prm.cmd->state = Q2T_STATE_ABORTED;
- q2x_send_term_exchange(ha, prm.cmd);
+ q2t_send_term_exchange(ha, prm.cmd, &prm.cmd->atio);
/* !! At this point cmd could be already freed !! */
goto out;
}
@@ -895,10 +896,10 @@
return res;
}
-static void q2x_send_term_exchange(scsi_qla_host_t *ha, struct q2t_cmd *cmd)
+static void q2t_send_term_exchange(scsi_qla_host_t *ha, struct q2t_cmd *cmd,
+ atio_entry_t *atio)
{
ctio_ret_entry_t *ctio;
- atio_entry_t *atio = &cmd->atio;
unsigned long flags;
int do_tgt_cmd_done = 0;
@@ -925,15 +926,19 @@
ctio->entry_type = CTIO_RET_TYPE;
ctio->entry_count = 1;
- ctio->handle = q2t_make_handle(ha);
- if (ctio->handle != Q2T_NULL_HANDLE) {
- ha->cmds[ctio->handle] = cmd;
- ctio->handle |= CTIO_COMPLETION_HANDLE_MARK;
- } else {
- ctio->handle = Q2T_SKIP_HANDLE | CTIO_COMPLETION_HANDLE_MARK;
- do_tgt_cmd_done = 1;
- }
+ if (cmd != NULL) {
+ ctio->handle = q2t_make_handle(ha);
+ if (ctio->handle != Q2T_NULL_HANDLE) {
+ ha->cmds[ctio->handle] = cmd;
+ } else {
+ ctio->handle = Q2T_SKIP_HANDLE;
+ do_tgt_cmd_done = 1;
+ }
+ } else
+ ctio->handle = Q2T_SKIP_HANDLE;
+ ctio->handle |= CTIO_COMPLETION_HANDLE_MARK;
+
SET_TARGET_ID(ha, ctio->target, GET_TARGET_ID(ha, atio));
ctio->exchange_id = atio->exchange_id;
@@ -1274,7 +1279,6 @@
return;
}
-
static char *q2t_make_name(scsi_qla_host_t *ha, int loop_id)
#ifdef FC_SCST_WWN_AUTH
{
@@ -1303,11 +1307,19 @@
}
if (wwn_found == 0) {
- PRINT_ERROR("qla2x00tgt(%ld): Unable to find wwn login for "
+#if 0
+ PRINT_ERROR("qla2x00tgt(%ld): Unable to find wwn login for "
"loop id %d, using loop id instead", ha->instance, loop_id);
- snprintf(wwn_str, 2*WWN_SIZE, "%d", loop_id);
+ snprintf(wwn_str, 2*WWN_SIZE, "%d", loop_id);
+#else
+ TRACE_DBG("qla2x00tgt(%ld): Unable to find wwn login for "
+ "loop id %d", ha->instance, loop_id);
+ kfree(wwn_str);
+ wwn_str = NULL;
+#endif
}
+
out:
return wwn_str;
}
@@ -1386,8 +1398,10 @@
/* register session (remote initiator) */
{
char *name = q2t_make_name(ha, loop_id);
- if (name == NULL)
+ if (name == NULL) {
+ res = -ESRCH;
goto out_free_sess;
+ }
sess->scst_sess = scst_register_session(
tgt->scst_tgt, 1, name, sess,
q2t_alloc_session_done);
@@ -1733,6 +1747,7 @@
switch (pkt->entry_type) {
case ACCEPT_TGT_IO_TYPE:
if (ha->flags.enable_target_mode && ha->tgt != NULL) {
+ int rc;
atio = (atio_entry_t *)pkt;
TRACE_DBG("ACCEPT_TGT_IO instance %ld status %04x "
"lun %04x read/write %d data_length %08x "
@@ -1752,12 +1767,17 @@
}
TRACE_BUFF_FLAG(TRACE_SCSI, "CDB", atio->cdb,
sizeof(atio->cdb));
- if (q2t_send_cmd_to_scst(ha, atio) != 0) {
- PRINT_INFO("qla2x00tgt(%ld): Unable to send "
- "the command to SCSI target "
- "mid-level, sending BUSY status",
- ha->instance);
- q2t_send_busy(ha, atio);
+ rc = q2t_send_cmd_to_scst(ha, atio);
+ if (unlikely(rc != 0)) {
+ if (rc == -ESRCH) {
+ q2t_send_term_exchange(ha, NULL, atio);
+ } else {
+ PRINT_INFO("qla2x00tgt(%ld): Unable to "
+ "send the command to SCSI target "
+ "mid-level, sending BUSY status",
+ ha->instance);
+ q2t_send_busy(ha, atio);
+ }
}
} else {
PRINT_ERROR("qla2x00tgt(%ld): ATIO, but target mode "
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-11-02 18:39:04
|
Revision: 22
http://svn.sourceforge.net/scst/?rev=22&view=rev
Author: vlnb
Date: 2006-11-02 02:54:10 -0800 (Thu, 02 Nov 2006)
Log Message:
-----------
- Fixes wrongly set context in scst_tgt_cmd_done()
- Fixes retries for stateful devices
Modified Paths:
--------------
trunk/scst/include/scsi_tgt.h
trunk/scst/src/dev_handlers/scst_changer.c
trunk/scst/src/dev_handlers/scst_disk.c
trunk/scst/src/dev_handlers/scst_fileio.c
trunk/scst/src/dev_handlers/scst_processor.c
trunk/scst/src/dev_handlers/scst_raid.c
trunk/scst/src/dev_handlers/scst_tape.c
trunk/scst/src/scst_lib.c
trunk/scst/src/scst_priv.h
trunk/scst/src/scst_targ.c
Modified: trunk/scst/include/scsi_tgt.h
===================================================================
--- trunk/scst/include/scsi_tgt.h 2006-11-02 10:43:29 UTC (rev 21)
+++ trunk/scst/include/scsi_tgt.h 2006-11-02 10:54:10 UTC (rev 22)
@@ -227,10 +227,9 @@
#define SCST_DEV_TM_NOT_COMPLETED 1
/*************************************************************
- ** Default timeout and retries count for cmd's CDB execution
- ** by SCSI mid-level (cmd's "timeout" and "retries" fields).
+ ** Default timeout for cmd's CDB execution
+ ** by SCSI mid-level (cmd's "timeout" field).
*************************************************************/
-#define SCST_DEFAULT_RETRIES 5
#define SCST_DEFAULT_TIMEOUT (30*HZ)
/*************************************************************
Modified: trunk/scst/src/dev_handlers/scst_changer.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_changer.c 2006-11-02 10:43:29 UTC (rev 21)
+++ trunk/scst/src/dev_handlers/scst_changer.c 2006-11-02 10:54:10 UTC (rev 22)
@@ -141,6 +141,8 @@
* based on info_cdb, therefore change them only if necessary
*/
+ cmd->retries = 1;
+
if (info_cdb->flags & SCST_LONG_TIMEOUT) {
cmd->timeout = CHANGER_LONG_TIMEOUT;
} else {
Modified: trunk/scst/src/dev_handlers/scst_disk.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_disk.c 2006-11-02 10:43:29 UTC (rev 21)
+++ trunk/scst/src/dev_handlers/scst_disk.c 2006-11-02 10:54:10 UTC (rev 22)
@@ -58,7 +58,7 @@
exec: disk_exec, \
}
-#define DISK_RETRIES 2
+#define DISK_RETRIES 5
#define DISK_SMALL_TIMEOUT (3 * HZ)
#define DISK_REG_TIMEOUT (60 * HZ)
#define DISK_LONG_TIMEOUT (3600 * HZ)
@@ -294,6 +294,8 @@
* based on info_cdb, therefore change them only if necessary
*/
+ cmd->retries = DISK_RETRIES;
+
if (info_cdb->flags & SCST_SMALL_TIMEOUT) {
cmd->timeout = DISK_SMALL_TIMEOUT;
} else if (info_cdb->flags & SCST_LONG_TIMEOUT) {
Modified: trunk/scst/src/dev_handlers/scst_fileio.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_fileio.c 2006-11-02 10:43:29 UTC (rev 21)
+++ trunk/scst/src/dev_handlers/scst_fileio.c 2006-11-02 10:54:10 UTC (rev 22)
@@ -1725,7 +1725,7 @@
nblocks = virt_dev->nblocks;
memset(buffer, 0, sizeof(buffer));
- data64 = (uint64_t *)buffer;
+ data64 = (uint64_t*)buffer;
data64[0] = cpu_to_be64(nblocks - 1);
buffer[8] = (blocksize >> (BYTE * 3)) & 0xFF;
buffer[9] = (blocksize >> (BYTE * 2)) & 0xFF;
Modified: trunk/scst/src/dev_handlers/scst_processor.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_processor.c 2006-11-02 10:43:29 UTC (rev 21)
+++ trunk/scst/src/dev_handlers/scst_processor.c 2006-11-02 10:54:10 UTC (rev 22)
@@ -141,6 +141,8 @@
* based on info_cdb, therefore change them only if necessary
*/
+ cmd->retries = 1;
+
if (info_cdb->flags & SCST_LONG_TIMEOUT) {
cmd->timeout = PROCESSOR_LONG_TIMEOUT;
} else {
Modified: trunk/scst/src/dev_handlers/scst_raid.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_raid.c 2006-11-02 10:43:29 UTC (rev 21)
+++ trunk/scst/src/dev_handlers/scst_raid.c 2006-11-02 10:54:10 UTC (rev 22)
@@ -141,6 +141,8 @@
* based on info_cdb, therefore change them only if necessary
*/
+ cmd->retries = 1;
+
if (info_cdb->flags & SCST_LONG_TIMEOUT) {
cmd->timeout = RAID_LONG_TIMEOUT;
} else {
Modified: trunk/scst/src/dev_handlers/scst_tape.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_tape.c 2006-11-02 10:43:29 UTC (rev 21)
+++ trunk/scst/src/dev_handlers/scst_tape.c 2006-11-02 10:54:10 UTC (rev 22)
@@ -305,6 +305,8 @@
* based on info_cdb, therefore change them only if necessary
*/
+ cmd->retries = 1;
+
if (info_cdb->flags & SCST_SMALL_TIMEOUT) {
cmd->timeout = TAPE_SMALL_TIMEOUT;
} else if (info_cdb->flags & SCST_LONG_TIMEOUT) {
Modified: trunk/scst/src/scst_lib.c
===================================================================
--- trunk/scst/src/scst_lib.c 2006-11-02 10:43:29 UTC (rev 21)
+++ trunk/scst/src/scst_lib.c 2006-11-02 10:54:10 UTC (rev 22)
@@ -949,7 +949,7 @@
cmd->queue_type = SCST_CMD_QUEUE_UNTAGGED;
cmd->timeout = SCST_DEFAULT_TIMEOUT;
- cmd->retries = SCST_DEFAULT_RETRIES;
+ cmd->retries = 1;
cmd->data_len = -1;
cmd->tgt_resp_flags = SCST_TSC_FLAG_STATUS;
cmd->resp_data_len = -1;
Modified: trunk/scst/src/scst_priv.h
===================================================================
--- trunk/scst/src/scst_priv.h 2006-11-02 10:43:29 UTC (rev 21)
+++ trunk/scst/src/scst_priv.h 2006-11-02 10:54:10 UTC (rev 22)
@@ -102,9 +102,15 @@
#define SCST_CMD_MEM_TIMEOUT (120*HZ)
static inline int scst_get_context(void) {
- /* Be overinsured */
- return (in_atomic() || in_interrupt()) ? SCST_CONTEXT_DIRECT_ATOMIC :
- SCST_CONTEXT_DIRECT;
+ if (in_irq())
+ return SCST_CONTEXT_TASKLET;
+ if (in_softirq())
+ return SCST_CONTEXT_DIRECT_ATOMIC;
+ if (in_interrupt()) /* Is it possible? */
+ return SCST_CONTEXT_THREAD;
+ if (in_atomic())
+ return SCST_CONTEXT_DIRECT_ATOMIC;
+ return SCST_CONTEXT_DIRECT;
}
#define SCST_MGMT_CMD_CACHE_STRING "scst_mgmt_cmd"
@@ -250,6 +256,8 @@
return;
}
+void scst_proccess_redirect_cmd(struct scst_cmd *cmd, int context,
+ int check_retries);
void scst_check_retries(struct scst_tgt *tgt, int processible_env);
void scst_tgt_retry_timer_fn(unsigned long arg);
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2006-11-02 10:43:29 UTC (rev 21)
+++ trunk/scst/src/scst_targ.c 2006-11-02 10:54:10 UTC (rev 22)
@@ -744,12 +744,65 @@
goto out;
}
-void scst_rx_data(struct scst_cmd *cmd, int status, int pref_context)
+void scst_proccess_redirect_cmd(struct scst_cmd *cmd, int context,
+ int check_retries)
{
unsigned long flags;
+ int rc;
TRACE_ENTRY();
+ TRACE_DBG("Context: %d", context);
+
+ switch(context) {
+ case SCST_CONTEXT_DIRECT:
+ case SCST_CONTEXT_DIRECT_ATOMIC:
+ if (check_retries)
+ scst_check_retries(cmd->tgt, 0);
+ cmd->non_atomic_only = 0;
+ rc = __scst_process_active_cmd(cmd, context, 0);
+ if (rc == SCST_CMD_STATE_RES_NEED_THREAD)
+ goto out_thread;
+ break;
+
+ default:
+ PRINT_ERROR_PR("Context %x is unknown, using the thread one",
+ context);
+ /* go through */
+ case SCST_CONTEXT_THREAD:
+ if (check_retries)
+ scst_check_retries(cmd->tgt, 1);
+ goto out_thread;
+
+ case SCST_CONTEXT_TASKLET:
+ if (check_retries)
+ scst_check_retries(cmd->tgt, 1);
+ cmd->non_atomic_only = 0;
+ spin_lock_irqsave(&scst_list_lock, flags);
+ TRACE_DBG("Moving cmd %p to active cmd list", cmd);
+ list_move_tail(&cmd->cmd_list_entry, &scst_active_cmd_list);
+ spin_unlock_irqrestore(&scst_list_lock, flags);
+ scst_schedule_tasklet();
+ break;
+ }
+out:
+ TRACE_EXIT();
+ return;
+
+out_thread:
+ cmd->non_atomic_only = 1;
+ spin_lock_irqsave(&scst_list_lock, flags);
+ TRACE_DBG("Moving cmd %p to active cmd list", cmd);
+ list_move_tail(&cmd->cmd_list_entry, &scst_active_cmd_list);
+ spin_unlock_irqrestore(&scst_list_lock, flags);
+ wake_up(&scst_list_waitQ);
+ goto out;
+}
+
+void scst_rx_data(struct scst_cmd *cmd, int status, int pref_context)
+{
+ TRACE_ENTRY();
+
TRACE_DBG("Preferred context: %d", pref_context);
TRACE(TRACE_SCSI, "tag=%d status=%#x", scst_cmd_get_tag(cmd), status);
cmd->non_atomic_only = 0;
@@ -783,41 +836,13 @@
default:
PRINT_ERROR_PR("scst_rx_data() received unknown status %x",
- status);
+ status);
+ cmd->state = SCST_CMD_STATE_DEV_DONE;
break;
}
- switch (pref_context) {
- case SCST_CONTEXT_DIRECT:
- case SCST_CONTEXT_DIRECT_ATOMIC:
- scst_check_retries(cmd->tgt, 0);
- __scst_process_active_cmd(cmd, pref_context, 0);
- break;
+ scst_proccess_redirect_cmd(cmd, pref_context, 1);
- default:
- PRINT_ERROR_PR("Context %x is undefined, using thread one",
- pref_context);
- /* go through */
- case SCST_CONTEXT_THREAD:
- spin_lock_irqsave(&scst_list_lock, flags);
- TRACE_DBG("Moving cmd %p to active cmd list", cmd);
- list_move_tail(&cmd->cmd_list_entry, &scst_active_cmd_list);
- cmd->non_atomic_only = 1;
- spin_unlock_irqrestore(&scst_list_lock, flags);
- scst_check_retries(cmd->tgt, 1);
- wake_up(&scst_list_waitQ);
- break;
-
- case SCST_CONTEXT_TASKLET:
- spin_lock_irqsave(&scst_list_lock, flags);
- TRACE_DBG("Moving cmd %p to active cmd list", cmd);
- list_move_tail(&cmd->cmd_list_entry, &scst_active_cmd_list);
- spin_unlock_irqrestore(&scst_list_lock, flags);
- scst_schedule_tasklet();
- scst_check_retries(cmd->tgt, 0);
- break;
- }
-
TRACE_EXIT();
return;
}
@@ -1088,7 +1113,7 @@
cmd->state = next_state;
cmd->non_atomic_only = 0;
- __scst_process_active_cmd(cmd, scst_get_context(), 0);
+ scst_proccess_redirect_cmd(cmd, scst_get_context(), 0);
out:
TRACE_EXIT();
@@ -1124,7 +1149,7 @@
cmd->state = next_state;
cmd->non_atomic_only = 0;
- __scst_process_active_cmd(cmd, scst_get_context(), 0);
+ scst_proccess_redirect_cmd(cmd, scst_get_context(), 0);
out:
TRACE_EXIT();
@@ -1153,7 +1178,7 @@
cmd->sg_cnt, sg, (void*)sg[0].page);
for(i = 0; i < cmd->sg_cnt; ++i) {
TRACE_BUFF_FLAG(TRACE_RECV_TOP,
- "Exec'd sg:", page_address(sg[i].page),
+ "Exec'd sg", page_address(sg[i].page),
sg[i].length);
}
}
@@ -1184,7 +1209,7 @@
cmd->state = next_state;
cmd->non_atomic_only = 0;
- __scst_process_active_cmd(cmd, scst_get_context(), 0);
+ scst_proccess_redirect_cmd(cmd, scst_get_context(), 0);
TRACE_EXIT();
return;
@@ -2175,7 +2200,7 @@
cmd->sg_cnt, sg, (void*)sg[0].page);
for(i = 0; i < cmd->sg_cnt; ++i) {
TRACE_BUFF_FLAG(TRACE_SEND_BOT,
- "Xmitting sg:", page_address(sg[i].page),
+ "Xmitting sg", page_address(sg[i].page),
sg[i].length);
}
}
@@ -2277,48 +2302,13 @@
void scst_tgt_cmd_done(struct scst_cmd *cmd)
{
- int res = 0;
- unsigned long flags;
- int context;
-
TRACE_ENTRY();
BUG_ON(cmd->state != SCST_CMD_STATE_XMIT_WAIT);
- if (in_irq())
- context = SCST_CONTEXT_TASKLET;
- else
- context = scst_get_context();
-
- TRACE_DBG("Context: %d", context);
- cmd->non_atomic_only = 0;
cmd->state = SCST_CMD_STATE_FINISHED;
+ scst_proccess_redirect_cmd(cmd, scst_get_context(), 1);
- switch (context) {
- case SCST_CONTEXT_DIRECT:
- case SCST_CONTEXT_DIRECT_ATOMIC:
- flags = 0;
- scst_check_retries(cmd->tgt, 0);
- res = __scst_process_active_cmd(cmd, context, 0);
- BUG_ON(res == SCST_CMD_STATE_RES_NEED_THREAD);
- break;
-
- case SCST_CONTEXT_TASKLET:
- {
- spin_lock_irqsave(&scst_list_lock, flags);
- TRACE_DBG("Moving cmd %p to active cmd list", cmd);
- list_move_tail(&cmd->cmd_list_entry, &scst_active_cmd_list);
- spin_unlock_irqrestore(&scst_list_lock, flags);
- scst_schedule_tasklet();
- scst_check_retries(cmd->tgt, 0);
- break;
- }
-
- default:
- BUG();
- break;
- }
-
TRACE_EXIT();
return;
}
@@ -2577,6 +2567,14 @@
TRACE_ENTRY();
+#ifdef EXTRACHECKS
+ {
+ int c = (context & ~SCST_PROCESSIBLE_ENV);
+ WARN_ON((c != SCST_CONTEXT_DIRECT_ATOMIC) &&
+ (c != SCST_CONTEXT_DIRECT));
+ }
+#endif
+
tm_dbg_check_released_cmds();
restart:
@@ -2649,7 +2647,7 @@
scst_do_job_init(&scst_init_cmd_list);
scst_do_job_active(&scst_active_cmd_list,
- SCST_CONTEXT_THREAD|SCST_PROCESSIBLE_ENV);
+ SCST_CONTEXT_DIRECT|SCST_PROCESSIBLE_ENV);
if (unlikely(test_bit(SCST_FLAG_SHUTDOWN, &scst_flags)) &&
list_empty(&scst_cmd_list) &&
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-11-02 18:38:57
|
Revision: 25
http://svn.sourceforge.net/scst/?rev=25&view=rev
Author: vlnb
Date: 2006-11-02 04:08:28 -0800 (Thu, 02 Nov 2006)
Log Message:
-----------
Minor cleanup
Modified Paths:
--------------
trunk/qla2x00t/qla2x00-target/qla2x00t.c
Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c
===================================================================
--- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2006-11-02 12:03:39 UTC (rev 24)
+++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2006-11-02 12:08:28 UTC (rev 25)
@@ -77,10 +77,6 @@
# endif
#endif
-#if defined(DEBUG) || defined(TRACING)
-unsigned long trace_flag = SCST_DEFAULT_QLA_LOG_FLAGS;
-#endif
-
static int q2t_target_detect(struct scst_tgt_template *templ);
static int q2t_target_release(struct scst_tgt *scst_tgt);
static int q2t_xmit_response(struct scst_cmd *scst_cmd);
@@ -104,6 +100,10 @@
* Global Variables
*/
+#if defined(DEBUG) || defined(TRACING)
+unsigned long trace_flag = SCST_DEFAULT_QLA_LOG_FLAGS;
+#endif
+
struct scst_tgt_template tgt_template = {
name:"qla2x00tgt",
sg_tablesize:0,
@@ -123,8 +123,8 @@
task_mgmt_fn_done:q2t_task_mgmt_fn_done,
};
+kmem_cache_t *q2t_cmd_cachep = NULL;
static struct qla2x_tgt_target tgt_data;
-kmem_cache_t *q2t_cmd_cachep = NULL;
/*
* Functions
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-11-02 18:38:56
|
Revision: 23
http://svn.sourceforge.net/scst/?rev=23&view=rev
Author: vlnb
Date: 2006-11-02 03:20:46 -0800 (Thu, 02 Nov 2006)
Log Message:
-----------
TRACE_MEM() cleanups
Modified Paths:
--------------
trunk/qla2x00t/qla2x00-target/qla2x00t.c
trunk/scst/src/dev_handlers/scst_cdrom.c
trunk/scst/src/dev_handlers/scst_disk.c
trunk/scst/src/dev_handlers/scst_fileio.c
trunk/scst/src/dev_handlers/scst_modisk.c
trunk/scst/src/dev_handlers/scst_tape.c
trunk/scst/src/scst.c
trunk/scst/src/scst_lib.c
trunk/scst/src/scst_priv.h
trunk/scst/src/scst_proc.c
Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c
===================================================================
--- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2006-11-02 10:54:10 UTC (rev 22)
+++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2006-11-02 11:20:46 UTC (rev 23)
@@ -53,21 +53,6 @@
#include <scst_debug.h>
#include <scst_debug.c>
-#ifndef MEMCPY
-/* Debugging to see how many memcopys/memsets happen */
-#define MEMCPY(d, s, l) do { \
- TRACE_MEM("memcpy to %p size %zd", d, (size_t)l); \
- memcpy(d, s, l); \
- } while (0)
-#endif
-
-#ifndef MEMSET
-#define MEMSET(d, c, l) do { \
- TRACE_MEM("memset of %p size %zd", d, (size_t)l); \
- memset(d, c, l); \
- } while (0)
-#endif
-
#ifndef FC_TARGET_SUPPORT
#error "FC_TARGET_SUPPORT is NOT DEFINED"
#endif
@@ -217,7 +202,7 @@
if (ha->tgt != NULL)
ha->tgt->notify_ack_expected++;
- MEMSET(ntfy, 0, sizeof(*ntfy));
+ memset(ntfy, 0, sizeof(*ntfy));
ntfy->entry_type = NOTIFY_ACK_TYPE;
ntfy->entry_count = 1;
SET_TARGET_ID(ha, ntfy->target, target_id);
@@ -302,7 +287,6 @@
BUG_ON(sess == NULL);
tgt = sess->tgt;
- TRACE_MEM("kfree for sess %p (tgt %p)", sess, tgt);
kfree(sess);
if (tgt == NULL)
@@ -414,7 +398,6 @@
scst_tgt_set_tgt_priv(scst_tgt, NULL);
- TRACE_MEM("kfree for tgt %p", tgt);
kfree(tgt);
TRACE_EXIT_RES(res);
@@ -598,7 +581,7 @@
* that.
*/
- MEMSET(cont_pkt64, 0, sizeof(*cont_pkt64));
+ memset(cont_pkt64, 0, sizeof(*cont_pkt64));
cont_pkt64->entry_count = 1;
cont_pkt64->sys_define = 0;
@@ -665,10 +648,10 @@
ctio_m1->scsi_status |=
__constant_cpu_to_le16(SS_SENSE_LEN_VALID);
ctio_m1->sense_length = cpu_to_le16(prm->sense_buffer_len);
- MEMCPY(ctio_m1->sense_data, prm->sense_buffer,
+ memcpy(ctio_m1->sense_data, prm->sense_buffer,
prm->sense_buffer_len);
} else {
- MEMSET(ctio_m1->sense_data, 0, sizeof(ctio_m1->sense_data));
+ memset(ctio_m1->sense_data, 0, sizeof(ctio_m1->sense_data));
ctio_m1->sense_length = 0;
}
@@ -800,7 +783,7 @@
TRACE_DBG("%s", "Building additional status "
"packet");
- MEMCPY(ctio_m1, prm.pkt, sizeof(*ctio_m1));
+ memcpy(ctio_m1, prm.pkt, sizeof(*ctio_m1));
ctio_m1->entry_count = 1;
/* Real finish is ctio_m1's finish */
@@ -965,7 +948,6 @@
static inline void q2t_free_cmd(struct q2t_cmd *cmd)
{
- TRACE_MEM("kfree for cmd (q2t_cmd) %p", cmd);
kmem_cache_free(q2t_cmd_cachep, cmd);
}
@@ -1367,7 +1349,6 @@
}
cmd = kmem_cache_alloc(q2t_cmd_cachep, GFP_ATOMIC);
- TRACE_MEM("kmem_cache_alloc(GFP_ATOMIC) for cmd (%zd): %p", sizeof(*cmd), cmd);
if (cmd == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of cmd failed");
res = -ENOMEM;
@@ -1375,15 +1356,13 @@
}
TRACE_BUFFER("ATIO Coming Up", atio, sizeof(*atio));
- MEMSET(cmd, 0, sizeof(*cmd));
- MEMCPY(&cmd->atio, atio, sizeof(*atio));
+ memset(cmd, 0, sizeof(*cmd));
+ memcpy(&cmd->atio, atio, sizeof(*atio));
cmd->state = Q2T_STATE_NEW;
sess = q2t_find_sess_by_lid(tgt, loop_id);
if (unlikely(sess == NULL)) {
sess = kzalloc(sizeof(*sess), GFP_ATOMIC);
- TRACE_MEM("kzalloc(GFP_ATOMIC) for sess (%zd): %p",
- sizeof(*sess), sess);
if (sess == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Allocation of sess failed");
@@ -1431,7 +1410,6 @@
return res;
out_free_sess:
- TRACE_MEM("kfree for sess %p", sess);
kfree(sess);
smp_mb__before_atomic_dec();
if (atomic_dec_and_test(&tgt->sess_count))
@@ -1470,8 +1448,6 @@
}
mcmd = kzalloc(sizeof(*mcmd), GFP_ATOMIC);
- TRACE_MEM("kzalloc(GFP_ATOMIC) for mcmd (%zd): %p",
- sizeof(*mcmd), mcmd);
if (mcmd == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of mgmt cmd failed");
res = -ENOMEM;
@@ -1535,7 +1511,6 @@
return res;
out_free:
- TRACE_MEM("kfree for mcmd %p", mcmd);
kfree(mcmd);
goto out;
}
@@ -1563,7 +1538,6 @@
}
mcmd = kzalloc(sizeof(*mcmd), GFP_ATOMIC);
- TRACE_MEM("kzalloc(GFP_ATOMIC) for mcmd (%zd): %p", sizeof(*mcmd), mcmd);
if (mcmd == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of mgmt cmd failed");
res = -ENOMEM;
@@ -1587,7 +1561,6 @@
return res;
out_free:
- TRACE_MEM("kfree for mcmd %p", mcmd);
kfree(mcmd);
goto out;
}
@@ -1617,7 +1590,6 @@
/* scst_mgmt_cmd_set_tgt_priv(scst_mcmd, NULL); */
scst_mcmd->tgt_priv = NULL;
- TRACE_MEM("kfree for mcmd %p", mcmd);
kfree(mcmd);
out:
@@ -1982,8 +1954,6 @@
switch (action) {
case ENABLE_TARGET_MODE :
tgt = kzalloc(sizeof(*tgt), GFP_KERNEL);
- TRACE_MEM("kzalloc(GFP_KERNEL) for tgt (%zd): %p",
- sizeof(*tgt), tgt);
if (tgt == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Allocation of tgt failed");
@@ -2021,7 +1991,6 @@
PRINT_ERROR("qla2x00tgt(%ld): scst_register() "
"failed for host %ld(%p)", ha->instance,
ha->host_no, ha);
- TRACE_MEM("kfree for tgt %p", tgt);
kfree(tgt);
goto out;
}
Modified: trunk/scst/src/dev_handlers/scst_cdrom.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_cdrom.c 2006-11-02 10:54:10 UTC (rev 22)
+++ trunk/scst/src/dev_handlers/scst_cdrom.c 2006-11-02 11:20:46 UTC (rev 23)
@@ -95,8 +95,6 @@
}
cdrom = kzalloc(sizeof(*cdrom), GFP_KERNEL);
- TRACE_MEM("kzalloc(GFP_KERNEL) for struct cdrom_params (%zu): %p",
- sizeof(*cdrom), cdrom);
if (cdrom == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Unable to allocate struct cdrom_params");
@@ -105,7 +103,6 @@
}
buffer = kzalloc(buffer_size, GFP_KERNEL);
- TRACE_MEM("kzalloc(GFP_KERNEL) for %d: %p", buffer_size, buffer);
if (!buffer) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Memory allocation failure");
res = -ENOMEM;
@@ -158,16 +155,13 @@
}
out_free_buf:
- TRACE_MEM("kfree for buffer: %p", buffer);
kfree(buffer);
out_free_cdrom:
if (res == 0)
dev->dh_priv = cdrom;
- else {
- TRACE_MEM("kfree for cdrom: %p", cdrom);
+ else
kfree(cdrom);
- }
out:
TRACE_EXIT();
@@ -189,7 +183,6 @@
TRACE_ENTRY();
- TRACE_MEM("kfree for cdrom: %p", cdrom);
kfree(cdrom);
dev->dh_priv = NULL;
Modified: trunk/scst/src/dev_handlers/scst_disk.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_disk.c 2006-11-02 10:54:10 UTC (rev 22)
+++ trunk/scst/src/dev_handlers/scst_disk.c 2006-11-02 11:20:46 UTC (rev 23)
@@ -171,8 +171,6 @@
}
disk = kzalloc(sizeof(*disk), GFP_KERNEL);
- TRACE_MEM("kzalloc(GFP_KERNEL) for struct disk_params (%zu): %p",
- sizeof(*disk), disk);
if (disk == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Unable to allocate struct disk_params");
@@ -181,7 +179,6 @@
}
buffer = kzalloc(buffer_size, GFP_KERNEL);
- TRACE_MEM("kzalloc(GFP_KERNEL) for %d: %p", buffer_size, buffer);
if (!buffer) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Memory allocation failure");
res = -ENOMEM;
@@ -231,16 +228,13 @@
}
out_free_buf:
- TRACE_MEM("kfree for buffer: %p", buffer);
kfree(buffer);
out_free_disk:
if (res == 0)
dev->dh_priv = disk;
- else {
- TRACE_MEM("kfree for disk: %p", disk);
+ else
kfree(disk);
- }
out:
TRACE_EXIT_RES(res);
@@ -262,7 +256,6 @@
TRACE_ENTRY();
- TRACE_MEM("kfree for disk: %p", disk);
kfree(disk);
dev->dh_priv = NULL;
Modified: trunk/scst/src/dev_handlers/scst_fileio.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_fileio.c 2006-11-02 10:54:10 UTC (rev 22)
+++ trunk/scst/src/dev_handlers/scst_fileio.c 2006-11-02 11:20:46 UTC (rev 23)
@@ -700,8 +700,6 @@
TRACE_ENTRY();
ftgt_dev = kzalloc(sizeof(*ftgt_dev), GFP_KERNEL);
- TRACE_MEM("kzalloc(GFP_KERNEL) for ftgt_dev (%zd): %p",
- sizeof(*ftgt_dev), ftgt_dev);
if (ftgt_dev == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of per-session "
"virtual device failed");
@@ -755,7 +753,6 @@
filp_close(ftgt_dev->fd, NULL);
out_free:
- TRACE_MEM("kfree ftgt_dev: %p", ftgt_dev);
kfree(ftgt_dev);
goto out;
}
@@ -780,12 +777,9 @@
if (ftgt_dev->fd)
filp_close(ftgt_dev->fd, NULL);
- if (ftgt_dev->iv != NULL) {
- TRACE_MEM("kfree ftgt_dev->iv: %p", ftgt_dev->iv);
+ if (ftgt_dev->iv != NULL)
kfree(ftgt_dev->iv);
- }
- TRACE_MEM("kfree ftgt_dev: %p", ftgt_dev);
kfree(ftgt_dev);
tgt_dev->dh_priv = NULL;
@@ -1892,13 +1886,9 @@
iv_count = scst_get_buf_count(cmd);
if (iv_count > ftgt_dev->iv_count) {
- if (ftgt_dev->iv != NULL) {
- TRACE_MEM("kfree ftgt_dev->iv: %p", ftgt_dev->iv);
+ if (ftgt_dev->iv != NULL)
kfree(ftgt_dev->iv);
- }
ftgt_dev->iv = kmalloc(sizeof(*ftgt_dev->iv) * iv_count, GFP_KERNEL);
- TRACE_MEM("kmalloc(GFP_KERNEL) for iv (%zd): %p",
- sizeof(*ftgt_dev->iv) * iv_count, ftgt_dev->iv);
if (ftgt_dev->iv == NULL) {
PRINT_ERROR_PR("Unable to allocate iv (%d)", iv_count);
scst_set_busy(cmd);
@@ -2260,7 +2250,6 @@
{
struct scst_fileio_dev *dev;
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
- TRACE_MEM("kzalloc(GFP_KERNEL) for dev (%zd): %p", sizeof(*dev), dev);
if (dev == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of virtual "
"device failed");
@@ -2551,8 +2540,6 @@
len = strlen(file_name) + 1;
virt_dev->file_name = kmalloc(len, GFP_KERNEL);
- TRACE_MEM("kmalloc(GFP_KERNEL) for file_name (%d): %p",
- len, virt_dev->file_name);
if (virt_dev->file_name == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Allocation of file_name failed");
@@ -2598,9 +2585,7 @@
list_del(&virt_dev->fileio_dev_list_entry);
- TRACE_MEM("kfree for file_name: %p", virt_dev->file_name);
kfree(virt_dev->file_name);
- TRACE_MEM("kfree for virt_dev: %p", virt_dev);
kfree(virt_dev);
}
res = length;
@@ -2615,12 +2600,9 @@
out_free_vpath:
list_del(&virt_dev->fileio_dev_list_entry);
-
- TRACE_MEM("kfree for file_name: %p", virt_dev->file_name);
kfree(virt_dev->file_name);
out_free_vdev:
- TRACE_MEM("kfree for virt_dev: %p", virt_dev);
kfree(virt_dev);
goto out_up;
}
@@ -2681,8 +2663,6 @@
if (!virt_dev->cdrom_empty) {
len = strlen(file_name) + 1;
virt_dev->file_name = kmalloc(len, GFP_KERNEL);
- TRACE_MEM("kmalloc(GFP_KERNEL) for file_name (%d): %p",
- len, virt_dev->file_name);
if (virt_dev->file_name == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Allocation of file_name failed");
@@ -2711,12 +2691,9 @@
out_free_vpath:
list_del(&virt_dev->fileio_dev_list_entry);
-
- TRACE_MEM("kfree for file_name: %p", virt_dev->file_name);
kfree(virt_dev->file_name);
out_free_vdev:
- TRACE_MEM("kfree for virt_dev: %p", virt_dev);
kfree(virt_dev);
goto out;
}
@@ -2749,11 +2726,8 @@
list_del(&virt_dev->fileio_dev_list_entry);
- if (virt_dev->file_name) {
- TRACE_MEM("kfree for file_name: %p", virt_dev->file_name);
+ if (virt_dev->file_name)
kfree(virt_dev->file_name);
- }
- TRACE_MEM("kfree for virt_dev: %p", virt_dev);
kfree(virt_dev);
out:
@@ -2810,8 +2784,6 @@
if (!virt_dev->cdrom_empty) {
len = strlen(file_name) + 1;
fn = kmalloc(len, GFP_KERNEL);
- TRACE_MEM("kmalloc(GFP_KERNEL) for file_name (%d): %p",
- len, fn);
if (fn == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Allocation of file_name failed");
@@ -2908,10 +2880,8 @@
virt_dev->name);
}
- if (old_fn) {
- TRACE_MEM("kfree for old_fn: %p", old_fn);
+ if (old_fn)
kfree(old_fn);
- }
out_resume:
scst_resume_activity();
@@ -2921,19 +2891,16 @@
out_free:
virt_dev->file_name = old_fn;
- TRACE_MEM("kfree for fn: %p", fn);
kfree(fn);
goto out;
out_free_resume:
virt_dev->file_name = old_fn;
- TRACE_MEM("kfree for fn: %p", fn);
kfree(fn);
goto out_resume;
out_err_resume:
virt_dev->file_name = old_fn;
- TRACE_MEM("kfree for fn: %p", fn);
kfree(fn);
scst_resume_activity();
cdrom_fileio_close(name);
@@ -3161,9 +3128,7 @@
PRINT_INFO_PR("Virtual device %s unregistered", virt_dev->name);
TRACE_DBG("virt_id %d", virt_dev->virt_id);
- TRACE_MEM("kfree for file_name: %p", virt_dev->file_name);
kfree(virt_dev->file_name);
- TRACE_MEM("kfree for virt_dev: %p", virt_dev);
kfree(virt_dev);
}
up(&scst_fileio_mutex);
Modified: trunk/scst/src/dev_handlers/scst_modisk.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_modisk.c 2006-11-02 10:54:10 UTC (rev 22)
+++ trunk/scst/src/dev_handlers/scst_modisk.c 2006-11-02 11:20:46 UTC (rev 23)
@@ -171,8 +171,6 @@
}
modisk = kzalloc(sizeof(*modisk), GFP_KERNEL);
- TRACE_MEM("kzalloc(GFP_KERNEL) for struct modisk_params (%zu): %p",
- sizeof(*modisk), modisk);
if (modisk == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Unable to allocate struct modisk_params");
@@ -193,7 +191,6 @@
}
buffer = kzalloc(buffer_size, GFP_KERNEL);
- TRACE_MEM("kzalloc(GFP_KERNEL) for %d: %p", buffer_size, buffer);
if (!buffer) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Memory allocation failure");
res = -ENOMEM;
@@ -245,16 +242,13 @@
}
out_free_buf:
- TRACE_MEM("kfree for buffer: %p", buffer);
kfree(buffer);
out_free_modisk:
if (res == 0)
dev->dh_priv = modisk;
- else {
- TRACE_MEM("kfree for modisk: %p", modisk);
+ else
kfree(modisk);
- }
out:
TRACE_EXIT_RES(res);
@@ -276,7 +270,6 @@
TRACE_ENTRY();
- TRACE_MEM("kfree for modisk: %p", modisk);
kfree(modisk);
dev->dh_priv = NULL;
Modified: trunk/scst/src/dev_handlers/scst_tape.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_tape.c 2006-11-02 10:54:10 UTC (rev 22)
+++ trunk/scst/src/dev_handlers/scst_tape.c 2006-11-02 11:20:46 UTC (rev 23)
@@ -181,8 +181,6 @@
}
tape = kzalloc(sizeof(*tape), GFP_KERNEL);
- TRACE_MEM("kzalloc(GFP_KERNEL) for struct tape_params (%zu): %p",
- sizeof(*tape), tape);
if (tape == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Unable to allocate struct tape_params");
@@ -192,7 +190,6 @@
spin_lock_init(&tape->tp_lock);
buffer = kmalloc(buffer_size, GFP_KERNEL);
- TRACE_MEM("kmalloc(GFP_KERNEL) for %d: %p", buffer_size, buffer);
if (!buffer) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Memory allocation failure");
res = -ENOMEM;
@@ -243,16 +240,13 @@
}
out_free_buf:
- TRACE_MEM("kfree for buffer: %p", buffer);
kfree(buffer);
out_free_req:
if (res == 0)
dev->dh_priv = tape;
- else {
- TRACE_MEM("kfree for tape: %p", tape);
+ else
kfree(tape);
- }
out:
TRACE_EXIT_RES(res);
@@ -274,7 +268,6 @@
TRACE_ENTRY();
- TRACE_MEM("kfree for tape: %p", tape);
kfree(tape);
dev->dh_priv = NULL;
Modified: trunk/scst/src/scst.c
===================================================================
--- trunk/scst/src/scst.c 2006-11-02 10:54:10 UTC (rev 22)
+++ trunk/scst/src/scst.c 2006-11-02 11:20:46 UTC (rev 23)
@@ -238,8 +238,6 @@
TRACE_ENTRY();
tgt = kzalloc(sizeof(*tgt), GFP_KERNEL);
- TRACE_MEM("kzalloc(GFP_KERNEL) for tgt (%zd): %p",
- sizeof(*tgt), tgt);
if (tgt == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s", "kzalloc() failed");
goto out;
@@ -272,7 +270,6 @@
return tgt;
out_free:
- TRACE_MEM("kfree() for tgt %p", tgt);
kfree(tgt);
goto out;
}
@@ -314,7 +311,6 @@
del_timer_sync(&tgt->retry_timer);
- TRACE_MEM("kfree for tgt: %p", tgt);
kfree(tgt);
TRACE_EXIT();
Modified: trunk/scst/src/scst_lib.c
===================================================================
--- trunk/scst/src/scst_lib.c 2006-11-02 10:54:10 UTC (rev 22)
+++ trunk/scst/src/scst_lib.c 2006-11-02 11:20:46 UTC (rev 23)
@@ -150,7 +150,6 @@
TRACE_ENTRY();
dev = kzalloc(sizeof(*dev), gfp_mask);
- TRACE_MEM("kzalloc() for dev (%zd): %p", sizeof(*dev), dev);
if (dev == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Allocation of scst_device failed");
@@ -185,7 +184,6 @@
}
#endif
- TRACE_MEM("kfree for dev: %p", dev);
kfree(dev);
TRACE_EXIT();
@@ -200,7 +198,6 @@
TRACE_ENTRY();
res = kmem_cache_alloc(scst_acgd_cachep, GFP_KERNEL);
- TRACE_MEM("kmem_cache_alloc() for acg_dev (%zd): %p", sizeof(*res), res);
if (res == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of scst_acg_dev failed");
goto out;
@@ -226,7 +223,6 @@
list_del(&acg_dev->acg_dev_list_entry);
list_del(&acg_dev->dev_acg_dev_list_entry);
- TRACE_MEM("kfree for acg_dev: %p", acg_dev);
kmem_cache_free(scst_acgd_cachep, acg_dev);
TRACE_EXIT();
@@ -241,7 +237,6 @@
TRACE_ENTRY();
acg = kzalloc(sizeof(*acg), GFP_KERNEL);
- TRACE_MEM("kzalloc() for acg (%zd): %p", sizeof(*acg), acg);
if (acg == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of acg failed");
goto out;
@@ -302,16 +297,12 @@
acn_list_entry)
{
list_del(&n->acn_list_entry);
- TRACE_MEM("kfree() for scst_acn->name: %p", n->name);
kfree(n->name);
- TRACE_MEM("kfree() for scst_acn: %p", n);
kfree(n);
}
INIT_LIST_HEAD(&acg->acn_list);
- TRACE_MEM("kfree for acg: %p", acg);
kfree(acg);
-
out:
TRACE_EXIT_RES(res);
return res;
@@ -331,8 +322,6 @@
TRACE_ENTRY();
tgt_dev = kmem_cache_alloc(scst_tgtd_cachep, GFP_KERNEL);
- TRACE_MEM("kmem_cache_alloc(GFP_KERNEL) for tgt_dev (%zd): %p",
- sizeof(*tgt_dev), tgt_dev);
if (tgt_dev != NULL)
memset(tgt_dev, 0, sizeof(*tgt_dev));
else {
@@ -394,7 +383,6 @@
return tgt_dev;
out_free:
- TRACE_MEM("kfree for tgt_dev: %p", tgt_dev);
kmem_cache_free(scst_tgtd_cachep, tgt_dev);
tgt_dev = NULL;
goto out;
@@ -463,7 +451,6 @@
TRACE_DBG("%s", "Dev handler's detach_tgt() returned");
}
- TRACE_MEM("kfree for tgt_dev: %p", tgt_dev);
kmem_cache_free(scst_tgtd_cachep, tgt_dev);
TRACE_EXIT();
@@ -649,7 +636,6 @@
}
n = kmalloc(sizeof(*n), GFP_KERNEL);
- TRACE_MEM("kmalloc(GFP_KERNEL) for scst_acn (%zd): %p", sizeof(*n), n);
if (n == NULL) {
PRINT_ERROR_PR("%s", "Unable to allocate scst_acn");
res = -ENOMEM;
@@ -658,8 +644,6 @@
len = strlen(name);
nm = kmalloc(len + 1, GFP_KERNEL);
- TRACE_MEM("kmalloc(GFP_KERNEL) for scst_acn->name (%d): %p",
- len + 1, nm);
if (nm == NULL) {
PRINT_ERROR_PR("%s", "Unable to allocate scst_acn->name");
res = -ENOMEM;
@@ -676,7 +660,6 @@
return res;
out_free:
- TRACE_MEM("kfree() for scst_acn: %p", n);
kfree(n);
goto out;
}
@@ -693,9 +676,7 @@
{
if (strcmp(n->name, name) == 0) {
list_del(&n->acn_list_entry);
- TRACE_MEM("kfree() for scst_acn->name: %p", n->name);
kfree(n->name);
- TRACE_MEM("kfree() for scst_acn: %p", n);
kfree(n);
res = 0;
break;
@@ -720,11 +701,8 @@
if (scsi_cmd && (req = scsi_cmd->sc_request)) {
if (req) {
- if (req->sr_bufflen) {
- TRACE_MEM("kfree for req->sr_buffer: %p",
- req->sr_buffer);
+ if (req->sr_bufflen)
kfree(req->sr_buffer);
- }
scsi_release_request(req);
}
}
@@ -823,7 +801,6 @@
TRACE_ENTRY();
sess = kmem_cache_alloc(scst_sess_cachep, gfp_mask);
- TRACE_MEM("kmem_cache_alloc() for sess (%zd): %p", sizeof(*sess), sess);
if (sess != NULL)
memset(sess, 0, sizeof(*sess));
else {
@@ -842,8 +819,6 @@
len = strlen(initiator_name);
nm = kmalloc(len + 1, gfp_mask);
- TRACE_MEM("kmalloc(GFP_KERNEL) for sess->initiator_name (%d): %p",
- len + 1, nm);
if (nm == NULL) {
PRINT_ERROR_PR("%s", "Unable to allocate sess->initiator_name");
goto out_free;
@@ -857,7 +832,6 @@
return sess;
out_free:
- TRACE_MEM("kfree() for sess: %p", sess);
kmem_cache_free(scst_sess_cachep, sess);
sess = NULL;
goto out;
@@ -881,10 +855,7 @@
up(&scst_mutex);
- TRACE_MEM("kfree for sess->initiator_name: %p", sess->initiator_name);
kfree(sess->initiator_name);
-
- TRACE_MEM("kfree for sess: %p", sess);
kmem_cache_free(scst_sess_cachep, sess);
TRACE_EXIT();
@@ -939,7 +910,6 @@
TRACE_ENTRY();
cmd = kmem_cache_alloc(scst_cmd_cachep, gfp_mask);
- TRACE_MEM("kmem_cache_alloc() for cmd (%zd): %p", sizeof(*cmd), cmd);
if (cmd != NULL)
memset(cmd, 0, sizeof(*cmd));
else {
@@ -1112,8 +1082,6 @@
TRACE_ENTRY();
mcmd = mempool_alloc(scst_mgmt_mempool, gfp_mask);
- TRACE_MEM("mempool_alloc() for mgmt cmd (%zd): %p", sizeof(*mcmd),
- mcmd);
if (mcmd == NULL) {
PRINT_ERROR("%s", "Allocation of management command "
"failed, some commands and their data could leak");
@@ -1143,7 +1111,6 @@
if (mcmd->mcmd_tgt_dev != NULL)
scst_dec_cmd_count();
- TRACE_MEM("mempool_free for mgmt cmd: %p", mcmd);
mempool_free(mcmd, scst_mgmt_mempool);
TRACE_EXIT();
@@ -1755,8 +1722,6 @@
list_del(&UA_entry->UA_list_entry);
-
- TRACE_MEM("mempool_free for UA_entry: %p", UA_entry);
mempool_free(UA_entry, scst_ua_mempool);
if (list_empty(&cmd->tgt_dev->UA_list)) {
@@ -1784,8 +1749,6 @@
TRACE_ENTRY();
UA_entry = mempool_alloc(scst_ua_mempool, GFP_ATOMIC);
- TRACE_MEM("mempool_alloc(GFP_ATOMIC) for UA_entry (%zd): %p",
- sizeof(*UA_entry), UA_entry);
if (UA_entry == NULL) {
PRINT_ERROR_PR("%s", "UNIT ATTENTION memory "
"allocation failed. The UNIT ATTENTION "
@@ -1876,7 +1839,6 @@
TRACE_MGMT_DBG("Clearing UA for tgt_dev lun %d",
tgt_dev->acg_dev->lun);
list_del(&UA_entry->UA_list_entry);
- TRACE_MEM("kfree for UA_entry: %p", UA_entry);
kfree(UA_entry);
}
INIT_LIST_HEAD(&tgt_dev->UA_list);
Modified: trunk/scst/src/scst_priv.h
===================================================================
--- trunk/scst/src/scst_priv.h 2006-11-02 10:54:10 UTC (rev 22)
+++ trunk/scst/src/scst_priv.h 2006-11-02 11:20:46 UTC (rev 23)
@@ -251,7 +251,6 @@
void scst_free_cmd(struct scst_cmd *cmd);
static inline void scst_destroy_cmd(struct scst_cmd *cmd)
{
- TRACE_MEM("kfree for cmd: %p", cmd);
kmem_cache_free(scst_cmd_cachep, cmd);
return;
}
Modified: trunk/scst/src/scst_proc.c
===================================================================
--- trunk/scst/src/scst_proc.c 2006-11-02 10:54:10 UTC (rev 22)
+++ trunk/scst/src/scst_proc.c 2006-11-02 11:20:46 UTC (rev 23)
@@ -619,7 +619,6 @@
TRACE_ENTRY();
name = kmalloc(len, GFP_KERNEL);
- TRACE_MEM("kmalloc() for acg_dev (%d): %p", len, name);
if (name == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of name failed");
goto out_nomem;
@@ -644,7 +643,6 @@
scst_proc_del_free_acg(acg, 0);
out_free:
- TRACE_MEM("kfree for name: %p", name);
kfree(name);
out_nomem:
@@ -666,7 +664,6 @@
if (res == 0) {
if (remove_proc)
scst_proc_del_acg_tree(acg_proc_root, name);
- TRACE_MEM("kfree for name: %p", name);
kfree(name);
}
}
@@ -2231,9 +2228,7 @@
list_for_each_entry_safe(n, nn, &acg->acn_list,
acn_list_entry) {
list_del(&n->acn_list_entry);
- TRACE_MEM("kfree() for scst_acn->name: %p", n->name);
kfree(n->name);
- TRACE_MEM("kfree() for scst_acn: %p", n);
kfree(n);
}
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-11-02 18:38:52
|
Revision: 21
http://svn.sourceforge.net/scst/?rev=21&view=rev
Author: vlnb
Date: 2006-11-02 02:43:29 -0800 (Thu, 02 Nov 2006)
Log Message:
-----------
Updates
Modified Paths:
--------------
trunk/qla2x00t/qla2x00-target/ChangeLog
Modified: trunk/qla2x00t/qla2x00-target/ChangeLog
===================================================================
--- trunk/qla2x00t/qla2x00-target/ChangeLog 2006-11-02 10:43:12 UTC (rev 20)
+++ trunk/qla2x00t/qla2x00-target/ChangeLog 2006-11-02 10:43:29 UTC (rev 21)
@@ -1,3 +1,13 @@
+Summary of changes between versions 0.9.3.8 and 0.9.5
+-----------------------------------------------------
+
+ - Ported to 2.6.17.x and 2.6.18.
+
+ - Updated for the latest SCST interfaces changes.
+
+ - Cleanups and minor bug fixes.
+
+
Summary of changes between versions 0.9.3.8 and 0.9.3.9
-------------------------------------------------------
Patch vs: qla2xxx v8.01.03-k (in kernels 2.6.15.x+, including 2.6.16-prex)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-10-27 10:44:07
|
Revision: 19
http://svn.sourceforge.net/scst/?rev=19&view=rev
Author: vlnb
Date: 2006-10-27 03:43:58 -0700 (Fri, 27 Oct 2006)
Log Message:
-----------
Small ORDERED commands handling optimization
Modified Paths:
--------------
trunk/scst/src/dev_handlers/scst_fileio.c
Modified: trunk/scst/src/dev_handlers/scst_fileio.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_fileio.c 2006-10-27 09:45:12 UTC (rev 18)
+++ trunk/scst/src/dev_handlers/scst_fileio.c 2006-10-27 10:43:58 UTC (rev 19)
@@ -105,6 +105,7 @@
struct scst_fileio_tgt_dev {
spinlock_t fdev_lock;
+ enum scst_cmd_queue_type last_write_cmd_queue_type;
int shutdown;
struct file *fd;
struct iovec *iv;
@@ -380,6 +381,26 @@
return;
}
+static inline int fileio_sync_queue_type(enum scst_cmd_queue_type qt)
+{
+ switch(qt) {
+ case SCST_CMD_QUEUE_ORDERED:
+ case SCST_CMD_QUEUE_HEAD_OF_QUEUE:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+static inline int fileio_need_pre_sync(enum scst_cmd_queue_type cwqt,
+ enum scst_cmd_queue_type lwqt)
+{
+ if (fileio_sync_queue_type(cwqt))
+ if (!fileio_sync_queue_type(lwqt))
+ return 1;
+ return 0;
+}
+
static void fileio_do_job(struct scst_cmd *cmd)
{
uint64_t lba_start;
@@ -482,11 +503,15 @@
struct scst_fileio_tgt_dev *ftgt_dev =
(struct scst_fileio_tgt_dev*)
cmd->tgt_dev->dh_priv;
- if ((cmd->queue_type == SCST_CMD_QUEUE_ORDERED) &&
+ enum scst_cmd_queue_type last_queue_type =
+ ftgt_dev->last_write_cmd_queue_type;
+ ftgt_dev->last_write_cmd_queue_type = cmd->queue_type;
+ if (fileio_need_pre_sync(cmd->queue_type, last_queue_type) &&
!virt_dev->wt_flag) {
- TRACE(TRACE_SCSI/*|TRACE_SPECIAL*/, "ORDERED WRITE: "
- "loff=%Ld, data_len=%Ld", (uint64_t)loff,
- (uint64_t)data_len);
+ TRACE(TRACE_SCSI/*|TRACE_SPECIAL*/, "ORDERED "
+ "WRITE(%d): loff=%Ld, data_len=%Ld",
+ cmd->queue_type, (uint64_t)loff,
+ (uint64_t)data_len);
do_fsync = 1;
if (fileio_fsync(ftgt_dev, 0, 0, cmd) != 0)
goto done;
@@ -509,11 +534,15 @@
struct scst_fileio_tgt_dev *ftgt_dev =
(struct scst_fileio_tgt_dev*)
cmd->tgt_dev->dh_priv;
- if ((cmd->queue_type == SCST_CMD_QUEUE_ORDERED) &&
+ enum scst_cmd_queue_type last_queue_type =
+ ftgt_dev->last_write_cmd_queue_type;
+ ftgt_dev->last_write_cmd_queue_type = cmd->queue_type;
+ if (fileio_need_pre_sync(cmd->queue_type, last_queue_type) &&
!virt_dev->wt_flag) {
TRACE(TRACE_SCSI/*|TRACE_SPECIAL*/, "ORDERED "
- "WRITE_VERIFY: loff=%Ld, data_len=%Ld",
- (uint64_t)loff, (uint64_t)data_len);
+ "WRITE_VERIFY(%d): loff=%Ld, data_len=%Ld",
+ cmd->queue_type, (uint64_t)loff,
+ (uint64_t)data_len);
do_fsync = 1;
if (fileio_fsync(ftgt_dev, 0, 0, cmd) != 0)
goto done;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-10-27 09:45:34
|
Revision: 18
http://svn.sourceforge.net/scst/?rev=18&view=rev
Author: vlnb
Date: 2006-10-27 02:45:12 -0700 (Fri, 27 Oct 2006)
Log Message:
-----------
Renamed tgt_dev_specific to dh_priv as well as all *_specific to *_priv
Modified Paths:
--------------
trunk/qla2x00t/qla2x00-target/qla2x00t.c
trunk/scst/include/scsi_tgt.h
trunk/scst/src/dev_handlers/scst_cdrom.c
trunk/scst/src/dev_handlers/scst_disk.c
trunk/scst/src/dev_handlers/scst_fileio.c
trunk/scst/src/dev_handlers/scst_modisk.c
trunk/scst/src/dev_handlers/scst_tape.c
trunk/scst/src/scst.c
trunk/scst/src/scst_targ.c
Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c
===================================================================
--- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2006-10-26 16:58:44 UTC (rev 17)
+++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2006-10-27 09:45:12 UTC (rev 18)
@@ -297,7 +297,7 @@
TRACE_ENTRY();
BUG_ON(scst_sess == NULL);
- sess = (struct q2t_sess *)scst_sess_get_tgt_specific(scst_sess);
+ sess = (struct q2t_sess *)scst_sess_get_tgt_priv(scst_sess);
BUG_ON(sess == NULL);
tgt = sess->tgt;
@@ -387,8 +387,7 @@
static int q2t_target_release(struct scst_tgt *scst_tgt)
{
int res = 0;
- struct q2t_tgt *tgt =
- (struct q2t_tgt *)scst_tgt_get_tgt_specific(scst_tgt);
+ struct q2t_tgt *tgt = (struct q2t_tgt *)scst_tgt_get_tgt_priv(scst_tgt);
scsi_qla_host_t *ha = tgt->ha;
unsigned long flags = 0;
@@ -412,7 +411,7 @@
"sess_count=%d", tgt, list_empty(&tgt->sess_list),
atomic_read(&tgt->sess_count));
- scst_tgt_set_tgt_specific(scst_tgt, NULL);
+ scst_tgt_set_tgt_priv(scst_tgt, NULL);
TRACE_MEM("kfree for tgt %p", tgt);
kfree(tgt);
@@ -698,9 +697,9 @@
TRACE_ENTRY();
TRACE(TRACE_SCSI, "tag=%d", scst_cmd_get_tag(scst_cmd));
- prm.cmd = (struct q2t_cmd *)scst_cmd_get_tgt_specific(scst_cmd);
+ prm.cmd = (struct q2t_cmd *)scst_cmd_get_tgt_priv(scst_cmd);
sess = (struct q2t_sess *)
- scst_sess_get_tgt_specific(scst_cmd_get_session(scst_cmd));
+ scst_sess_get_tgt_priv(scst_cmd_get_session(scst_cmd));
if (unlikely(scst_cmd_aborted(scst_cmd))) {
scsi_qla_host_t *ha = sess->tgt->ha;
@@ -844,9 +843,9 @@
TRACE_ENTRY();
TRACE(TRACE_SCSI, "tag=%d", scst_cmd_get_tag(scst_cmd));
- prm.cmd = (struct q2t_cmd *)scst_cmd_get_tgt_specific(scst_cmd);
+ prm.cmd = (struct q2t_cmd *)scst_cmd_get_tgt_priv(scst_cmd);
sess = (struct q2t_sess *)
- scst_sess_get_tgt_specific(scst_cmd_get_session(scst_cmd));
+ scst_sess_get_tgt_priv(scst_cmd_get_session(scst_cmd));
prm.sg = scst_cmd_get_sg(scst_cmd);
prm.bufflen = scst_cmd_get_bufflen(scst_cmd);
@@ -967,13 +966,12 @@
void q2t_on_free_cmd(struct scst_cmd *scst_cmd)
{
- struct q2t_cmd *cmd =
- (struct q2t_cmd *)scst_cmd_get_tgt_specific(scst_cmd);
+ struct q2t_cmd *cmd = (struct q2t_cmd *)scst_cmd_get_tgt_priv(scst_cmd);
TRACE_ENTRY();
TRACE(TRACE_SCSI, "END Command tag %d", scst_cmd_get_tag(scst_cmd));
- scst_cmd_set_tgt_specific(scst_cmd, NULL);
+ scst_cmd_set_tgt_priv(scst_cmd, NULL);
q2t_free_cmd(cmd);
@@ -1082,7 +1080,7 @@
} else
goto out;
- cmd = (struct q2t_cmd *)scst_cmd_get_tgt_specific(scst_cmd);
+ cmd = (struct q2t_cmd *)scst_cmd_get_tgt_priv(scst_cmd);
if (cmd->state == Q2T_STATE_PROCESSED) {
TRACE_DBG("Command %p finished", cmd);
@@ -1205,7 +1203,7 @@
}
scst_cmd_set_tag(cmd->scst_cmd, le16_to_cpu(cmd->atio.exchange_id));
- scst_cmd_set_tgt_specific(cmd->scst_cmd, cmd);
+ scst_cmd_set_tgt_priv(cmd->scst_cmd, cmd);
if (cmd->atio.execution_codes & ATIO_EXEC_READ)
dir = SCST_DATA_READ;
@@ -1402,7 +1400,7 @@
res = -EFAULT;
goto out_free_sess;
}
- scst_sess_set_tgt_specific(sess->scst_sess, sess);
+ scst_sess_set_tgt_priv(sess->scst_sess, sess);
/* add session data to host data structure */
list_add(&sess->list, &tgt->sess_list);
@@ -1591,7 +1589,7 @@
TRACE(TRACE_MGMT, "scst_mcmd (%p) status %#x state %#x", scst_mcmd,
scst_mcmd->status, scst_mcmd->state);
- mcmd = scst_mgmt_cmd_get_tgt_specific(scst_mcmd);
+ mcmd = scst_mgmt_cmd_get_tgt_priv(scst_mcmd);
if (unlikely(mcmd == NULL)) {
PRINT_ERROR("scst_mcmd %p tgt_spec is NULL", mcmd);
goto out;
@@ -1603,8 +1601,8 @@
? 0 : FC_TM_FAILED, 1);
spin_unlock_irqrestore(&mcmd->sess->tgt->ha->hardware_lock, flags);
- /* scst_mgmt_cmd_set_tgt_specific(scst_mcmd, NULL); */
- scst_mcmd->tgt_specific = NULL;
+ /* scst_mgmt_cmd_set_tgt_priv(scst_mcmd, NULL); */
+ scst_mcmd->tgt_priv = NULL;
TRACE_MEM("kfree for mcmd %p", mcmd);
kfree(mcmd);
@@ -2008,7 +2006,7 @@
goto out;
}
- scst_tgt_set_tgt_specific(tgt->scst_tgt, tgt);
+ scst_tgt_set_tgt_priv(tgt->scst_tgt, tgt);
spin_lock_irqsave(&ha->hardware_lock, flags);
ha->tgt = tgt;
Modified: trunk/scst/include/scsi_tgt.h
===================================================================
--- trunk/scst/include/scsi_tgt.h 2006-10-26 16:58:44 UTC (rev 17)
+++ trunk/scst/include/scsi_tgt.h 2006-10-27 09:45:12 UTC (rev 18)
@@ -832,8 +832,8 @@
/* Maximum SG table size */
int sg_tablesize;
- /* Used for storage of target specific stuff */
- void *tgt_specific;
+ /* Used for storage of target driver private stuff */
+ void *tgt_priv;
};
struct scst_session
@@ -870,8 +870,8 @@
/* List entry for the sessions list inside ACG */
struct list_head acg_sess_list_entry;
- /* Used for storage of target specific stuff */
- void *tgt_specific;
+ /* Used for storage of target driver private stuff */
+ void *tgt_priv;
/*
* List of cmds in this session. Used to find a cmd in the
@@ -1114,11 +1114,11 @@
struct list_head fileio_cmd_list_entry;
int fileio_in_list;
- /* Used for storage of target specific stuff */
- void *tgt_specific;
+ /* Used for storage of target driver private stuff */
+ void *tgt_priv;
- /* Used for storage of dev handler specific stuff */
- void *tgt_dev_specific;
+ /* Used for storage of dev handler private stuff */
+ void *dh_priv;
/*
* Used to store previous tgt_dev if dev handler returns
@@ -1162,8 +1162,8 @@
/* completition status, one of the SCST_MGMT_STATUS_* constants */
int status;
- /* Used for storage of target specific stuff */
- void *tgt_specific;
+ /* Used for storage of target driver private stuff */
+ void *tgt_priv;
};
struct scst_device
@@ -1211,8 +1211,8 @@
/* Corresponding real SCSI device, could be NULL for virtual devices */
struct scsi_device *scsi_dev;
- /* Used for storage of dev handler specific stuff */
- void *tgt_dev_specific;
+ /* Used for storage of dev handler private stuff */
+ void *dh_priv;
/* Used to wait for requested amount of "on_dev" commands */
wait_queue_head_t on_dev_waitQ;
@@ -1262,8 +1262,8 @@
unsigned long tgt_dev_flags; /* tgt_dev's flags */
- /* Used for storage of dev handler specific stuff */
- void *tgt_dev_specific;
+ /* Used for storage of dev handler private stuff */
+ void *dh_priv;
/*
* Used to execute cmd's in order of arrival.
@@ -1553,7 +1553,7 @@
* same sess. Returns 0 for success, error code otherwise.
*/
int scst_rx_mgmt_fn_tag(struct scst_session *sess, int fn, uint32_t tag,
- int atomic, void *tgt_specific);
+ int atomic, void *tgt_priv);
/*
* Creates new management command using LUN and sends it for execution.
@@ -1563,7 +1563,7 @@
*/
int scst_rx_mgmt_fn_lun(struct scst_session *sess, int fn,
const uint8_t *lun, int lun_len,
- int atomic, void *tgt_specific);
+ int atomic, void *tgt_priv);
/*
* Provides various CDB info
@@ -1649,30 +1649,30 @@
void scst_unregister_virtual_device(int id);
/*
- * Get/Set functions for tgt's target specific data
+ * Get/Set functions for tgt's target private data
*/
-static inline void *scst_tgt_get_tgt_specific(struct scst_tgt *tgt)
+static inline void *scst_tgt_get_tgt_priv(struct scst_tgt *tgt)
{
- return tgt->tgt_specific;
+ return tgt->tgt_priv;
}
-static inline void scst_tgt_set_tgt_specific(struct scst_tgt *tgt, void *val)
+static inline void scst_tgt_set_tgt_priv(struct scst_tgt *tgt, void *val)
{
- tgt->tgt_specific = val;
+ tgt->tgt_priv = val;
}
/*
- * Get/Set functions for session's target specific data
+ * Get/Set functions for session's target private data
*/
-static inline void *scst_sess_get_tgt_specific(struct scst_session *sess)
+static inline void *scst_sess_get_tgt_priv(struct scst_session *sess)
{
- return sess->tgt_specific;
+ return sess->tgt_priv;
}
-static inline void scst_sess_set_tgt_specific(struct scst_session *sess,
+static inline void scst_sess_set_tgt_priv(struct scst_session *sess,
void *val)
{
- sess->tgt_specific = val;
+ sess->tgt_priv = val;
}
/* Returns TRUE if cmd is being executed in atomic context */
@@ -1811,23 +1811,23 @@
}
/*
- * Get/Set functions for cmd's target specific data.
+ * Get/Set functions for cmd's target private data.
* Variant with *_lock must be used if target driver uses
* scst_find_cmd() to avoid race with it, except inside scst_find_cmd()'s
* callback, where lock is already taken.
*/
-static inline void *scst_cmd_get_tgt_specific(struct scst_cmd *cmd)
+static inline void *scst_cmd_get_tgt_priv(struct scst_cmd *cmd)
{
- return cmd->tgt_specific;
+ return cmd->tgt_priv;
}
-static inline void scst_cmd_set_tgt_specific(struct scst_cmd *cmd, void *val)
+static inline void scst_cmd_set_tgt_priv(struct scst_cmd *cmd, void *val)
{
- cmd->tgt_specific = val;
+ cmd->tgt_priv = val;
}
-void *scst_cmd_get_tgt_specific_lock(struct scst_cmd *cmd);
-void scst_cmd_set_tgt_specific_lock(struct scst_cmd *cmd, void *val);
+void *scst_cmd_get_tgt_priv_lock(struct scst_cmd *cmd);
+void scst_cmd_set_tgt_priv_lock(struct scst_cmd *cmd, void *val);
/*
* Get/Set functions for data_buf_tgt_alloc flag
@@ -1897,17 +1897,17 @@
}
/*
- * Get/Set function for mgmt cmd's target specific data
+ * Get/Set function for mgmt cmd's target private data
*/
-static inline void *scst_mgmt_cmd_get_tgt_specific(struct scst_mgmt_cmd *mcmd)
+static inline void *scst_mgmt_cmd_get_tgt_priv(struct scst_mgmt_cmd *mcmd)
{
- return mcmd->tgt_specific;
+ return mcmd->tgt_priv;
}
-static inline void scst_mgmt_cmd_set_tgt_specific(struct scst_mgmt_cmd *mcmd,
+static inline void scst_mgmt_cmd_set_tgt_priv(struct scst_mgmt_cmd *mcmd,
void *val)
{
- mcmd->tgt_specific = val;
+ mcmd->tgt_priv = val;
}
/*
Modified: trunk/scst/src/dev_handlers/scst_cdrom.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_cdrom.c 2006-10-26 16:58:44 UTC (rev 17)
+++ trunk/scst/src/dev_handlers/scst_cdrom.c 2006-10-27 09:45:12 UTC (rev 18)
@@ -163,7 +163,7 @@
out_free_cdrom:
if (res == 0)
- dev->tgt_dev_specific = cdrom;
+ dev->dh_priv = cdrom;
else {
TRACE_MEM("kfree for cdrom: %p", cdrom);
kfree(cdrom);
@@ -185,14 +185,13 @@
************************************************************/
void cdrom_detach(struct scst_device *dev)
{
- struct cdrom_params *cdrom =
- (struct cdrom_params *)dev->tgt_dev_specific;
+ struct cdrom_params *cdrom = (struct cdrom_params *)dev->dh_priv;
TRACE_ENTRY();
TRACE_MEM("kfree for cdrom: %p", cdrom);
kfree(cdrom);
- dev->tgt_dev_specific = NULL;
+ dev->dh_priv = NULL;
TRACE_EXIT();
return;
@@ -277,7 +276,7 @@
* No need for locks here, since *_detach() can not be
* called, when there are existing commands.
*/
- cdrom = (struct cdrom_params *)cmd->dev->tgt_dev_specific;
+ cdrom = (struct cdrom_params *)cmd->dev->dh_priv;
cmd->bufflen = info_cdb->transfer_len * cdrom->sector_size;
}
@@ -341,8 +340,7 @@
* No need for locks here, since *_detach() can not be
* called, when there are existing commands.
*/
- cdrom =
- (struct cdrom_params *)cmd->dev->tgt_dev_specific;
+ cdrom = (struct cdrom_params *)cmd->dev->dh_priv;
sector_size =
((buffer[4] << 24) | (buffer[5] << 16) |
(buffer[6] << 8) | (buffer[7] << 0));
Modified: trunk/scst/src/dev_handlers/scst_disk.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_disk.c 2006-10-26 16:58:44 UTC (rev 17)
+++ trunk/scst/src/dev_handlers/scst_disk.c 2006-10-27 09:45:12 UTC (rev 18)
@@ -236,7 +236,7 @@
out_free_disk:
if (res == 0)
- dev->tgt_dev_specific = disk;
+ dev->dh_priv = disk;
else {
TRACE_MEM("kfree for disk: %p", disk);
kfree(disk);
@@ -258,13 +258,13 @@
************************************************************/
void disk_detach(struct scst_device *dev)
{
- struct disk_params *disk = (struct disk_params *)dev->tgt_dev_specific;
+ struct disk_params *disk = (struct disk_params *)dev->dh_priv;
TRACE_ENTRY();
TRACE_MEM("kfree for disk: %p", disk);
kfree(disk);
- dev->tgt_dev_specific = NULL;
+ dev->dh_priv = NULL;
TRACE_EXIT();
return;
@@ -337,7 +337,7 @@
* No need for locks here, since *_detach() can not be
* called, when there are existing commands.
*/
- disk = (struct disk_params *)cmd->dev->tgt_dev_specific;
+ disk = (struct disk_params *)cmd->dev->dh_priv;
cmd->bufflen = info_cdb->transfer_len * disk->sector_size;
}
@@ -401,7 +401,7 @@
* No need for locks here, since *_detach() can not be
* called, when there are existing commands.
*/
- disk = (struct disk_params *)cmd->dev->tgt_dev_specific;
+ disk = (struct disk_params *)cmd->dev->dh_priv;
sector_size =
((buffer[4] << 24) | (buffer[5] << 16) |
(buffer[6] << 8) | (buffer[7] << 0));
Modified: trunk/scst/src/dev_handlers/scst_fileio.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_fileio.c 2006-10-26 16:58:44 UTC (rev 17)
+++ trunk/scst/src/dev_handlers/scst_fileio.c 2006-10-27 09:45:12 UTC (rev 18)
@@ -341,7 +341,7 @@
virt_dev->name);
}
- dev->tgt_dev_specific = virt_dev;
+ dev->dh_priv = virt_dev;
out:
TRACE_EXIT();
@@ -364,7 +364,7 @@
static void fileio_detach(struct scst_device *dev)
{
struct scst_fileio_dev *virt_dev =
- (struct scst_fileio_dev *)dev->tgt_dev_specific;
+ (struct scst_fileio_dev *)dev->dh_priv;
TRACE_ENTRY();
@@ -374,7 +374,7 @@
virt_dev->name, virt_dev->file_name);
/* virt_dev will be freed by the caller */
- dev->tgt_dev_specific = NULL;
+ dev->dh_priv = NULL;
TRACE_EXIT();
return;
@@ -388,7 +388,7 @@
loff_t loff;
struct scst_device *dev = cmd->dev;
struct scst_fileio_dev *virt_dev =
- (struct scst_fileio_dev *)dev->tgt_dev_specific;
+ (struct scst_fileio_dev *)dev->dh_priv;
int fua = 0;
TRACE_ENTRY();
@@ -481,7 +481,7 @@
int do_fsync = 0;
struct scst_fileio_tgt_dev *ftgt_dev =
(struct scst_fileio_tgt_dev*)
- cmd->tgt_dev->tgt_dev_specific;
+ cmd->tgt_dev->dh_priv;
if ((cmd->queue_type == SCST_CMD_QUEUE_ORDERED) &&
!virt_dev->wt_flag) {
TRACE(TRACE_SCSI/*|TRACE_SPECIAL*/, "ORDERED WRITE: "
@@ -508,7 +508,7 @@
int do_fsync = 0;
struct scst_fileio_tgt_dev *ftgt_dev =
(struct scst_fileio_tgt_dev*)
- cmd->tgt_dev->tgt_dev_specific;
+ cmd->tgt_dev->dh_priv;
if ((cmd->queue_type == SCST_CMD_QUEUE_ORDERED) &&
!virt_dev->wt_flag) {
TRACE(TRACE_SCSI/*|TRACE_SPECIAL*/, "ORDERED "
@@ -535,7 +535,7 @@
int immed = cmd->cdb[1] & 0x2;
struct scst_fileio_tgt_dev *ftgt_dev =
(struct scst_fileio_tgt_dev*)
- cmd->tgt_dev->tgt_dev_specific;
+ cmd->tgt_dev->dh_priv;
TRACE(TRACE_SCSI, "SYNCHRONIZE_CACHE: "
"loff=%Ld, data_len=%Ld, immed=%d", (uint64_t)loff,
(uint64_t)data_len, immed);
@@ -664,7 +664,7 @@
static int fileio_attach_tgt(struct scst_tgt_dev *tgt_dev)
{
struct scst_fileio_dev *virt_dev =
- (struct scst_fileio_dev *)tgt_dev->acg_dev->dev->tgt_dev_specific;
+ (struct scst_fileio_dev *)tgt_dev->acg_dev->dev->dh_priv;
struct scst_fileio_tgt_dev *ftgt_dev;
int res = 0;
@@ -710,7 +710,7 @@
res = 0;
atomic_inc(&ftgt_dev->threads_count);
- tgt_dev->tgt_dev_specific = ftgt_dev;
+ tgt_dev->dh_priv = ftgt_dev;
down(&virt_dev->ftgt_list_mutex);
list_add_tail(&ftgt_dev->ftgt_list_entry,
@@ -734,9 +734,9 @@
static void fileio_detach_tgt(struct scst_tgt_dev *tgt_dev)
{
struct scst_fileio_tgt_dev *ftgt_dev =
- (struct scst_fileio_tgt_dev *)tgt_dev->tgt_dev_specific;
+ (struct scst_fileio_tgt_dev *)tgt_dev->dh_priv;
struct scst_fileio_dev *virt_dev =
- (struct scst_fileio_dev *)tgt_dev->acg_dev->dev->tgt_dev_specific;
+ (struct scst_fileio_dev *)tgt_dev->acg_dev->dev->dh_priv;
TRACE_ENTRY();
@@ -759,7 +759,7 @@
TRACE_MEM("kfree ftgt_dev: %p", ftgt_dev);
kfree(ftgt_dev);
- tgt_dev->tgt_dev_specific = NULL;
+ tgt_dev->dh_priv = NULL;
TRACE_EXIT();
}
@@ -781,7 +781,7 @@
int res = SCST_CMD_STATE_DEFAULT;
int fixed;
struct scst_fileio_dev *virt_dev =
- (struct scst_fileio_dev *)cmd->dev->tgt_dev_specific;
+ (struct scst_fileio_dev *)cmd->dev->dh_priv;
TRACE_ENTRY();
@@ -842,7 +842,7 @@
static inline void fileio_queue_cmd(struct scst_cmd *cmd)
{
struct scst_fileio_tgt_dev *ftgt_dev =
- (struct scst_fileio_tgt_dev *)cmd->tgt_dev->tgt_dev_specific;
+ (struct scst_fileio_tgt_dev *)cmd->tgt_dev->dh_priv;
spin_lock_bh(&ftgt_dev->fdev_lock);
TRACE_DBG("Pushing cmd %p to IO thread", cmd);
list_add_tail(&cmd->fileio_cmd_list_entry,
@@ -963,7 +963,7 @@
int res = SCST_CMD_STATE_DEFAULT;
int fixed;
struct scst_fileio_dev *virt_dev =
- (struct scst_fileio_dev *)cmd->dev->tgt_dev_specific;
+ (struct scst_fileio_dev *)cmd->dev->dh_priv;
TRACE_ENTRY();
@@ -1029,7 +1029,7 @@
int delayed = 0;
int opcode = cmd->cdb[0];
struct scst_fileio_dev *virt_dev =
- (struct scst_fileio_dev *)cmd->dev->tgt_dev_specific;
+ (struct scst_fileio_dev *)cmd->dev->dh_priv;
TRACE_ENTRY();
@@ -1129,7 +1129,7 @@
uint8_t *address;
uint8_t *buf;
struct scst_fileio_dev *virt_dev =
- (struct scst_fileio_dev *)cmd->dev->tgt_dev_specific;
+ (struct scst_fileio_dev *)cmd->dev->dh_priv;
/* ToDo: Performance Boost:
* 1. remove kzalloc, buf
@@ -1378,7 +1378,7 @@
goto out;
}
- virt_dev = (struct scst_fileio_dev *)cmd->dev->tgt_dev_specific;
+ virt_dev = (struct scst_fileio_dev *)cmd->dev->dh_priv;
blocksize = virt_dev->block_size;
nblocks = virt_dev->nblocks;
@@ -1560,7 +1560,7 @@
TRACE_ENTRY();
- virt_dev = (struct scst_fileio_dev *)cmd->dev->tgt_dev_specific;
+ virt_dev = (struct scst_fileio_dev *)cmd->dev->dh_priv;
mselect_6 = (MODE_SELECT == cmd->cdb[0]);
length = scst_get_buf_first(cmd, &address);
@@ -1640,7 +1640,7 @@
TRACE_ENTRY();
- virt_dev = (struct scst_fileio_dev *)cmd->dev->tgt_dev_specific;
+ virt_dev = (struct scst_fileio_dev *)cmd->dev->dh_priv;
blocksize = virt_dev->block_size;
nblocks = virt_dev->nblocks;
@@ -1691,7 +1691,7 @@
TRACE_ENTRY();
- virt_dev = (struct scst_fileio_dev *)cmd->dev->tgt_dev_specific;
+ virt_dev = (struct scst_fileio_dev *)cmd->dev->dh_priv;
blocksize = virt_dev->block_size;
nblocks = virt_dev->nblocks;
@@ -1763,7 +1763,7 @@
goto out;
}
- virt_dev = (struct scst_fileio_dev *)cmd->dev->tgt_dev_specific;
+ virt_dev = (struct scst_fileio_dev *)cmd->dev->dh_priv;
/* FIXME when you have > 8TB ROM device. */
nblocks = (uint32_t)virt_dev->nblocks;
@@ -1806,7 +1806,7 @@
static void fileio_exec_prevent_allow_medium_removal(struct scst_cmd *cmd)
{
struct scst_fileio_dev *virt_dev =
- (struct scst_fileio_dev *)cmd->dev->tgt_dev_specific;
+ (struct scst_fileio_dev *)cmd->dev->dh_priv;
TRACE_DBG("PERSIST/PREVENT 0x%02x", cmd->cdb[4]);
@@ -1889,9 +1889,9 @@
ssize_t length, full_len;
uint8_t *address;
struct scst_fileio_dev *virt_dev =
- (struct scst_fileio_dev *)cmd->dev->tgt_dev_specific;
+ (struct scst_fileio_dev *)cmd->dev->dh_priv;
struct scst_fileio_tgt_dev *ftgt_dev =
- (struct scst_fileio_tgt_dev *)cmd->tgt_dev->tgt_dev_specific;
+ (struct scst_fileio_tgt_dev *)cmd->tgt_dev->dh_priv;
struct file *fd = ftgt_dev->fd;
struct iovec *iv;
int iv_count, i;
@@ -1974,9 +1974,9 @@
ssize_t length, full_len;
uint8_t *address;
struct scst_fileio_dev *virt_dev =
- (struct scst_fileio_dev *)cmd->dev->tgt_dev_specific;
+ (struct scst_fileio_dev *)cmd->dev->dh_priv;
struct scst_fileio_tgt_dev *ftgt_dev =
- (struct scst_fileio_tgt_dev *)cmd->tgt_dev->tgt_dev_specific;
+ (struct scst_fileio_tgt_dev *)cmd->tgt_dev->dh_priv;
struct file *fd = ftgt_dev->fd;
struct iovec *iv, *eiv;
int iv_count, eiv_count;
@@ -2092,7 +2092,7 @@
uint8_t *address_sav, *address;
int compare;
struct scst_fileio_tgt_dev *ftgt_dev =
- (struct scst_fileio_tgt_dev *)cmd->tgt_dev->tgt_dev_specific;
+ (struct scst_fileio_tgt_dev *)cmd->tgt_dev->dh_priv;
struct file *fd = ftgt_dev->fd;
uint8_t *mem_verify = NULL;
@@ -2205,8 +2205,7 @@
unsigned long flags;
struct scst_cmd *cmd_to_abort = mcmd->cmd_to_abort;
struct scst_fileio_tgt_dev *ftgt_dev =
- (struct scst_fileio_tgt_dev *)cmd_to_abort->tgt_dev->
- tgt_dev_specific;
+ (struct scst_fileio_tgt_dev *)cmd_to_abort->tgt_dev->dh_priv;
/*
* Actually, _bh lock is enough here. But, since we
* could be called with IRQ off, the in-kernel debug check
Modified: trunk/scst/src/dev_handlers/scst_modisk.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_modisk.c 2006-10-26 16:58:44 UTC (rev 17)
+++ trunk/scst/src/dev_handlers/scst_modisk.c 2006-10-27 09:45:12 UTC (rev 18)
@@ -250,7 +250,7 @@
out_free_modisk:
if (res == 0)
- dev->tgt_dev_specific = modisk;
+ dev->dh_priv = modisk;
else {
TRACE_MEM("kfree for modisk: %p", modisk);
kfree(modisk);
@@ -272,14 +272,13 @@
************************************************************/
void modisk_detach(struct scst_device *dev)
{
- struct modisk_params *modisk =
- (struct modisk_params *)dev->tgt_dev_specific;
+ struct modisk_params *modisk = (struct modisk_params *)dev->dh_priv;
TRACE_ENTRY();
TRACE_MEM("kfree for modisk: %p", modisk);
kfree(modisk);
- dev->tgt_dev_specific = NULL;
+ dev->dh_priv = NULL;
TRACE_EXIT();
return;
@@ -364,7 +363,7 @@
* No need for locks here, since *_detach() can not be
* called, when there are existing commands.
*/
- modisk = (struct modisk_params *)cmd->dev->tgt_dev_specific;
+ modisk = (struct modisk_params *)cmd->dev->dh_priv;
cmd->bufflen = info_cdb->transfer_len * modisk->sector_size;
}
@@ -428,8 +427,7 @@
* No need for locks here, since *_detach() can not be
* called, when there are existing commands.
*/
- modisk =
- (struct modisk_params *)cmd->dev->tgt_dev_specific;
+ modisk = (struct modisk_params *)cmd->dev->dh_priv;
sector_size =
((buffer[4] << 24) | (buffer[5] << 16) |
(buffer[6] << 8) | (buffer[7] << 0));
Modified: trunk/scst/src/dev_handlers/scst_tape.c
===================================================================
--- trunk/scst/src/dev_handlers/scst_tape.c 2006-10-26 16:58:44 UTC (rev 17)
+++ trunk/scst/src/dev_handlers/scst_tape.c 2006-10-27 09:45:12 UTC (rev 18)
@@ -248,7 +248,7 @@
out_free_req:
if (res == 0)
- dev->tgt_dev_specific = tape;
+ dev->dh_priv = tape;
else {
TRACE_MEM("kfree for tape: %p", tape);
kfree(tape);
@@ -270,13 +270,13 @@
************************************************************/
void tape_detach(struct scst_device *dev)
{
- struct tape_params *tape = (struct tape_params *)dev->tgt_dev_specific;
+ struct tape_params *tape = (struct tape_params *)dev->dh_priv;
TRACE_ENTRY();
TRACE_MEM("kfree for tape: %p", tape);
kfree(tape);
- dev->tgt_dev_specific = NULL;
+ dev->dh_priv = NULL;
TRACE_EXIT();
return;
@@ -337,7 +337,7 @@
* No need for locks here, since *_detach() can not be called,
* when there are existing commands.
*/
- tape = (struct tape_params *)cmd->dev->tgt_dev_specific;
+ tape = (struct tape_params *)cmd->dev->dh_priv;
cmd->bufflen = info_cdb->transfer_len * tape->block_size;
}
@@ -400,7 +400,7 @@
* can not be called, when there are
* existing commands.
*/
- tape = (struct tape_params *)cmd->dev->tgt_dev_specific;
+ tape = (struct tape_params *)cmd->dev->dh_priv;
spin_lock_bh(&tape->tp_lock);
if (buffer[3] == 8) {
tape->block_size = (buffer[9] << 16) |
@@ -419,7 +419,7 @@
* No need for locks here, since *_detach() can not be
* called, when there are existing commands.
*/
- tape = (struct tape_params *)cmd->dev->tgt_dev_specific;
+ tape = (struct tape_params *)cmd->dev->dh_priv;
spin_lock_bh(&tape->tp_lock);
if (buffer[3] == 8) {
tape->block_size =
@@ -477,7 +477,7 @@
* *_detach() can not be called, when
* there are existing commands.
*/
- tape = (struct tape_params *)cmd->dev->tgt_dev_specific;
+ tape = (struct tape_params *)cmd->dev->dh_priv;
resp_data_len *= tape->block_size;
}
scst_set_resp_data_len(cmd, resp_data_len);
Modified: trunk/scst/src/scst.c
===================================================================
--- trunk/scst/src/scst.c 2006-10-26 16:58:44 UTC (rev 17)
+++ trunk/scst/src/scst.c 2006-10-27 09:45:12 UTC (rev 18)
@@ -1280,8 +1280,8 @@
* Other Commands
*/
EXPORT_SYMBOL(scst_get_cdb_info);
-EXPORT_SYMBOL(scst_cmd_get_tgt_specific_lock);
-EXPORT_SYMBOL(scst_cmd_set_tgt_specific_lock);
+EXPORT_SYMBOL(scst_cmd_get_tgt_priv_lock);
+EXPORT_SYMBOL(scst_cmd_set_tgt_priv_lock);
#ifdef DEBUG
EXPORT_SYMBOL(scst_random);
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2006-10-26 16:58:44 UTC (rev 17)
+++ trunk/scst/src/scst_targ.c 2006-10-27 09:45:12 UTC (rev 18)
@@ -3400,7 +3400,7 @@
break;
}
- mcmd->tgt_specific = NULL;
+ mcmd->tgt_priv = NULL;
TRACE_EXIT();
return;
@@ -3535,7 +3535,7 @@
}
static struct scst_mgmt_cmd *scst_pre_rx_mgmt_cmd(struct scst_session
- *sess, int fn, int atomic, void *tgt_specific)
+ *sess, int fn, int atomic, void *tgt_priv)
{
struct scst_mgmt_cmd *mcmd = NULL;
@@ -3554,7 +3554,7 @@
mcmd->sess = sess;
mcmd->fn = fn;
mcmd->state = SCST_MGMT_CMD_STATE_INIT;
- mcmd->tgt_specific = tgt_specific;
+ mcmd->tgt_priv = tgt_priv;
out:
TRACE_EXIT();
@@ -3623,7 +3623,7 @@
*/
int scst_rx_mgmt_fn_lun(struct scst_session *sess, int fn,
const uint8_t *lun, int lun_len, int atomic,
- void *tgt_specific)
+ void *tgt_priv)
{
int res = -EFAULT;
struct scst_mgmt_cmd *mcmd = NULL;
@@ -3636,7 +3636,7 @@
goto out;
}
- mcmd = scst_pre_rx_mgmt_cmd(sess, fn, atomic, tgt_specific);
+ mcmd = scst_pre_rx_mgmt_cmd(sess, fn, atomic, tgt_priv);
if (mcmd == NULL)
goto out;
@@ -3666,7 +3666,7 @@
* same sess
*/
int scst_rx_mgmt_fn_tag(struct scst_session *sess, int fn, uint32_t tag,
- int atomic, void *tgt_specific)
+ int atomic, void *tgt_priv)
{
int res = -EFAULT;
struct scst_mgmt_cmd *mcmd = NULL;
@@ -3679,7 +3679,7 @@
goto out;
}
- mcmd = scst_pre_rx_mgmt_cmd(sess, fn, atomic, tgt_specific);
+ mcmd = scst_pre_rx_mgmt_cmd(sess, fn, atomic, tgt_priv);
if (mcmd == NULL)
goto out;
@@ -4024,20 +4024,20 @@
return cmd;
}
-void *scst_cmd_get_tgt_specific_lock(struct scst_cmd *cmd)
+void *scst_cmd_get_tgt_priv_lock(struct scst_cmd *cmd)
{
void *res;
unsigned long flags;
spin_lock_irqsave(&scst_list_lock, flags);
- res = cmd->tgt_specific;
+ res = cmd->tgt_priv;
spin_unlock_irqrestore(&scst_list_lock, flags);
return res;
}
-void scst_cmd_set_tgt_specific_lock(struct scst_cmd *cmd, void *val)
+void scst_cmd_set_tgt_priv_lock(struct scst_cmd *cmd, void *val)
{
unsigned long flags;
spin_lock_irqsave(&scst_list_lock, flags);
- cmd->tgt_specific = val;
+ cmd->tgt_priv = val;
spin_unlock_irqrestore(&scst_list_lock, flags);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-10-26 16:59:08
|
Revision: 17
http://svn.sourceforge.net/scst/?rev=17&view=rev
Author: vlnb
Date: 2006-10-26 09:58:44 -0700 (Thu, 26 Oct 2006)
Log Message:
-----------
Property svn:ignore set
Property Changed:
----------------
/
branches/
tags/
trunk/
trunk/doc/
trunk/qla2x00t/
trunk/qla2x00t/qla2x00-target/
trunk/scst/
trunk/scst/include/
trunk/scst/kernel/
trunk/scst/kernel/in-tree/
trunk/scst/src/
trunk/scst/src/dev_handlers/
trunk/www/
Property changes on:
___________________________________________________________________
Name: svn:ignore
- *.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
+ *.o
*.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
Module.symvers
Property changes on: branches
___________________________________________________________________
Name: svn:ignore
- *.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
+ *.o
*.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
Module.symvers
Property changes on: tags
___________________________________________________________________
Name: svn:ignore
- *.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
+ *.o
*.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
Module.symvers
Property changes on: trunk
___________________________________________________________________
Name: svn:ignore
- *.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
+ *.o
*.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
Module.symvers
Property changes on: trunk/doc
___________________________________________________________________
Name: svn:ignore
- *.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
+ *.o
*.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
Module.symvers
Property changes on: trunk/qla2x00t
___________________________________________________________________
Name: svn:ignore
- *.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
+ *.o
*.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
Module.symvers
Property changes on: trunk/qla2x00t/qla2x00-target
___________________________________________________________________
Name: svn:ignore
- *.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
+ *.o
*.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
Module.symvers
Property changes on: trunk/scst
___________________________________________________________________
Name: svn:ignore
- *.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
+ *.o
*.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
Module.symvers
Property changes on: trunk/scst/include
___________________________________________________________________
Name: svn:ignore
- *.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
+ *.o
*.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
Module.symvers
Property changes on: trunk/scst/kernel
___________________________________________________________________
Name: svn:ignore
- *.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
+ *.o
*.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
Module.symvers
Property changes on: trunk/scst/kernel/in-tree
___________________________________________________________________
Name: svn:ignore
- *.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
+ *.o
*.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
Module.symvers
Property changes on: trunk/scst/src
___________________________________________________________________
Name: svn:ignore
- *.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
+ *.o
*.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
Module.symvers
Property changes on: trunk/scst/src/dev_handlers
___________________________________________________________________
Name: svn:ignore
- *.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
+ *.o
*.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
Module.symvers
Property changes on: trunk/www
___________________________________________________________________
Name: svn:ignore
+ *.o
*.mod.c
*.ko
*.ko.cmd
*.o.cmd
.tmp_versions
Modules.symvers
Module.symvers
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-10-26 16:51:54
|
Revision: 16
http://svn.sourceforge.net/scst/?rev=16&view=rev
Author: vlnb
Date: 2006-10-26 09:51:41 -0700 (Thu, 26 Oct 2006)
Log Message:
-----------
Removing of Module.symvers added
Modified Paths:
--------------
trunk/qla2x00t/Makefile
trunk/qla2x00t/qla2x00-target/Makefile
trunk/scst/src/Makefile
trunk/scst/src/dev_handlers/Makefile
Modified: trunk/qla2x00t/Makefile
===================================================================
--- trunk/qla2x00t/Makefile 2006-10-26 16:09:56 UTC (rev 15)
+++ trunk/qla2x00t/Makefile 2006-10-26 16:51:41 UTC (rev 16)
@@ -40,7 +40,7 @@
endif
clean:
- rm -f *.o *.ko .*.cmd *.mod.c .*.d .depend *~ Modules.symvers
+ rm -f *.o *.ko .*.cmd *.mod.c .*.d .depend *~ Modules.symvers Module.symvers
rm -rf .tmp_versions
extraclean: clean
Modified: trunk/qla2x00t/qla2x00-target/Makefile
===================================================================
--- trunk/qla2x00t/qla2x00-target/Makefile 2006-10-26 16:09:56 UTC (rev 15)
+++ trunk/qla2x00t/qla2x00-target/Makefile 2006-10-26 16:51:41 UTC (rev 16)
@@ -91,7 +91,7 @@
endif
clean:
- rm -f *.o *.ko .*.cmd *.mod.c .*.d .depend *~ Modules.symvers
+ rm -f *.o *.ko .*.cmd *.mod.c .*.d .depend *~ Modules.symvers Module.symvers
rm -rf .tmp_versions
extraclean: clean
Modified: trunk/scst/src/Makefile
===================================================================
--- trunk/scst/src/Makefile 2006-10-26 16:09:56 UTC (rev 15)
+++ trunk/scst/src/Makefile 2006-10-26 16:51:41 UTC (rev 16)
@@ -99,7 +99,7 @@
#EXTRA_CFLAGS += -DSCST_HIGHMEM
clean:
- rm -f *.o *.ko .*.cmd *.mod.c .*.d .depend Modules.symvers
+ rm -f *.o *.ko .*.cmd *.mod.c .*.d .depend Modules.symvers Module.symvers
rm -rf .tmp_versions
cd $(DEV_HANDLERS_DIR) && $(MAKE) $@
Modified: trunk/scst/src/dev_handlers/Makefile
===================================================================
--- trunk/scst/src/dev_handlers/Makefile 2006-10-26 16:09:56 UTC (rev 15)
+++ trunk/scst/src/dev_handlers/Makefile 2006-10-26 16:51:41 UTC (rev 16)
@@ -56,7 +56,7 @@
EXTRA_CFLAGS += -DDEBUG
clean:
- rm -f *.o *.ko .*.cmd *.mod.c .*.d .depend Modules.symvers
+ rm -f *.o *.ko .*.cmd *.mod.c .*.d .depend Modules.symvers Module.symvers
rm -rf .tmp_versions
extraclean: clean
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-10-26 16:10:11
|
Revision: 15
http://svn.sourceforge.net/scst/?rev=15&view=rev
Author: vlnb
Date: 2006-10-26 09:09:56 -0700 (Thu, 26 Oct 2006)
Log Message:
-----------
Added support of non-original kernels (i.e. not 2.6.17)
Modified Paths:
--------------
trunk/qla2x00t/Kconfig
trunk/qla2x00t/ql2400.c
trunk/qla2x00t/qla2x00-target/Makefile
trunk/qla2x00t/qla2x00-target/README
trunk/qla2x00t/qla_os.c
Modified: trunk/qla2x00t/Kconfig
===================================================================
--- trunk/qla2x00t/Kconfig 2006-10-26 16:08:29 UTC (rev 14)
+++ trunk/qla2x00t/Kconfig 2006-10-26 16:09:56 UTC (rev 15)
@@ -41,7 +41,7 @@
You will also need the SCST middle level drivers from http://scst.sf.net/.
config SCSI_QLA2XXX_EMBEDDED_FIRMWARE
- bool " Use firmware-loader modules (DEPRECATED)"
+ bool "Use firmware-loader modules (DEPRECATED)"
depends on SCSI_QLA_FC
help
This option offers you the deprecated firmware-loader
@@ -49,33 +49,33 @@
Firmware Loader interface in the qla2xxx driver.
config SCSI_QLA21XX
- tristate " Build QLogic ISP2100 firmware-module"
+ tristate "Build QLogic ISP2100 firmware-module"
depends on SCSI_QLA_FC && SCSI_QLA2XXX_EMBEDDED_FIRMWARE
---help---
This driver supports the QLogic 21xx (ISP2100) host adapter family.
config SCSI_QLA22XX
- tristate " Build QLogic ISP2200 firmware-module"
+ tristate "Build QLogic ISP2200 firmware-module"
depends on SCSI_QLA_FC && SCSI_QLA2XXX_EMBEDDED_FIRMWARE
---help---
This driver supports the QLogic 22xx (ISP2200) host adapter family.
config SCSI_QLA2300
- tristate " Build QLogic ISP2300/ISP6312 firmware-module"
+ tristate "Build QLogic ISP2300/ISP6312 firmware-module"
depends on SCSI_QLA_FC && SCSI_QLA2XXX_EMBEDDED_FIRMWARE
---help---
This driver supports the QLogic 2300 (ISP2300, ISP2312 and
ISP6312) host adapter family.
config SCSI_QLA2322
- tristate " Build QLogic ISP2322/ISP6322 firmware-module"
+ tristate "Build QLogic ISP2322/ISP6322 firmware-module"
depends on SCSI_QLA_FC && SCSI_QLA2XXX_EMBEDDED_FIRMWARE
---help---
This driver supports the QLogic 2322 (ISP2322 and ISP6322) host
adapter family.
config SCSI_QLA24XX
- tristate " Build QLogic ISP24xx firmware-module"
+ tristate "Build QLogic ISP24xx firmware-module"
depends on SCSI_QLA_FC && SCSI_QLA2XXX_EMBEDDED_FIRMWARE
---help---
This driver supports the QLogic 24xx (ISP2422 and ISP2432) host
Modified: trunk/qla2x00t/ql2400.c
===================================================================
--- trunk/qla2x00t/ql2400.c 2006-10-26 16:08:29 UTC (rev 14)
+++ trunk/qla2x00t/ql2400.c 2006-10-26 16:09:56 UTC (rev 15)
@@ -78,6 +78,7 @@
.subdevice = PCI_ANY_ID,
.driver_data = (unsigned long)&qla_board_tbl[1],
},
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
{
.vendor = PCI_VENDOR_ID_QLOGIC,
.device = PCI_DEVICE_ID_QLOGIC_ISP5422,
@@ -92,7 +93,7 @@
.subdevice = PCI_ANY_ID,
.driver_data = (unsigned long)&qla_board_tbl[3],
},
-
+#endif
{0, 0},
};
MODULE_DEVICE_TABLE(pci, qla24xx_pci_tbl);
Modified: trunk/qla2x00t/qla2x00-target/Makefile
===================================================================
--- trunk/qla2x00t/qla2x00-target/Makefile 2006-10-26 16:08:29 UTC (rev 14)
+++ trunk/qla2x00t/qla2x00-target/Makefile 2006-10-26 16:09:56 UTC (rev 15)
@@ -56,10 +56,10 @@
else
-all: Modules.symvers
+all: Modules.symvers Module.symvers
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_INI=m
-tgt: Modules.symvers
+tgt: Modules.symvers Module.symvers
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_INI=n
install: all
@@ -67,9 +67,24 @@
modules_install
-depmod -a
+SCST_MOD_VERS := $(shell ls $(SCST_DIR)/Modules.symvers 2>/dev/null)
+ifneq ($(SCST_MOD_VERS),)
Modules.symvers: $(SCST_DIR)/Modules.symvers
- -cp $(SCST_DIR)/Modules.symvers .
+ echo $(SCST_MOD_VERS)
+ cp $(SCST_DIR)/Modules.symvers .
+else
+.PHONY: Modules.symvers
+endif
+# It's renamed in 2.6.18
+SCST_MOD_VERS := $(shell ls $(SCST_DIR)/Module.symvers 2>/dev/null)
+ifneq ($(SCST_MOD_VERS),)
+Module.symvers: $(SCST_DIR)/Module.symvers
+ cp $(SCST_DIR)/Module.symvers .
+else
+.PHONY: Module.symvers
+endif
+
uninstall:
rm -f $(INSTALL_DIR)/qla2[23x]00tgt.ko
-/sbin/depmod -a
Modified: trunk/qla2x00t/qla2x00-target/README
===================================================================
--- trunk/qla2x00t/qla2x00-target/README 2006-10-26 16:08:29 UTC (rev 14)
+++ trunk/qla2x00t/qla2x00-target/README 2006-10-26 16:09:56 UTC (rev 15)
@@ -20,7 +20,9 @@
This version is compatible with SCST version 0.9.5 and higher.
-Tested on stable kernels from http://www.kernel.org
+Tested on stable kernels from http://www.kernel.org. The original
+initiator driver was taken from kernel version 2.6.17.8, but it should
+also work on other versions, including 2.6.18.x and 2.6.16.x.
NOTE: WWN-based authentification on 2200 cards doesn't always work from
---- the first "connect", but works on all subsequent attempts.
Modified: trunk/qla2x00t/qla_os.c
===================================================================
--- trunk/qla2x00t/qla_os.c 2006-10-26 16:08:29 UTC (rev 14)
+++ trunk/qla2x00t/qla_os.c 2006-10-26 16:09:56 UTC (rev 15)
@@ -10,6 +10,7 @@
#include <linux/vmalloc.h>
#include <linux/delay.h>
#include <linux/kthread.h>
+#include <linux/version.h>
#include <scsi/scsi_tcq.h>
#include <scsi/scsicam.h>
@@ -1197,12 +1198,14 @@
ha->device_type |= DT_ISP2432;
ha->device_type |= DT_ZIO_SUPPORTED;
break;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
case PCI_DEVICE_ID_QLOGIC_ISP5422:
ha->device_type |= DT_ISP5422;
break;
case PCI_DEVICE_ID_QLOGIC_ISP5432:
ha->device_type |= DT_ISP5432;
break;
+#endif
}
}
@@ -2168,7 +2171,12 @@
int rval;
rval = QLA_SUCCESS;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
ha->srb_mempool = mempool_create_slab_pool(SRB_MIN_REQ, srb_cachep);
+#else
+ ha->srb_mempool = mempool_create(SRB_MIN_REQ, mempool_alloc_slab,
+ mempool_free_slab, srb_cachep);
+#endif
if (ha->srb_mempool == NULL) {
qla_printk(KERN_INFO, ha, "Unable to allocate SRB mempool.\n");
rval = QLA_FUNCTION_FAILED;
@@ -2701,10 +2709,12 @@
PCI_ANY_ID, PCI_ANY_ID, },
{ PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2432,
PCI_ANY_ID, PCI_ANY_ID, },
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
{ PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP5422,
PCI_ANY_ID, PCI_ANY_ID, },
{ PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP5432,
PCI_ANY_ID, PCI_ANY_ID, },
+#endif
{ 0 },
};
MODULE_DEVICE_TABLE(pci, qla2xxx_pci_tbl);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-10-26 16:08:53
|
Revision: 14
http://svn.sourceforge.net/scst/?rev=14&view=rev
Author: vlnb
Date: 2006-10-26 09:08:29 -0700 (Thu, 26 Oct 2006)
Log Message:
-----------
1. Added support of 2.6.18 kernels
2. FILEIO_ONLY added
Modified Paths:
--------------
trunk/scst/ChangeLog
trunk/scst/README
trunk/scst/include/scsi_tgt.h
trunk/scst/src/Makefile
trunk/scst/src/scst.c
trunk/scst/src/scst_lib.c
trunk/scst/src/scst_priv.h
trunk/scst/src/scst_targ.c
Added Paths:
-----------
trunk/scst/kernel/26_scst-2.6.18.patch
Modified: trunk/scst/ChangeLog
===================================================================
--- trunk/scst/ChangeLog 2006-10-26 13:58:39 UTC (rev 13)
+++ trunk/scst/ChangeLog 2006-10-26 16:08:29 UTC (rev 14)
@@ -4,6 +4,12 @@
- Fixed many found task management related problems, especially in the
RESETs area. DEBUG_TM compilation option added (see README).
+ - Updated to work on kernels version 2.6.18+.
+
+ - FILEIO_ONLY added. If it's defined, there is no need to patch the
+ kernel, but pass-through modules (scst_disk, scst_tape, etc.) are not
+ supported).
+
- Timer-based retries for targets after SCST_TGT_RES_QUEUE_FULL status
implemented.
Modified: trunk/scst/README
===================================================================
--- trunk/scst/README 2006-10-26 13:58:39 UTC (rev 13)
+++ trunk/scst/README 2006-10-26 16:08:29 UTC (rev 14)
@@ -134,6 +134,11 @@
There are the following compilation options, that could be commented
in/out in Makefile:
+ - FILEIO_ONLY - if defined, the pass-through device handlers
+ (scst_disk, scst_tape) will not work, but SCST will not require the
+ kernel patching. Defined by default to ease new people try SCST on
+ their kernels.
+
- DEBUG - turns on some debugging code, including some logging. Makes
the driver considerably bigger and slower, producing large amount of
log data.
@@ -424,12 +429,18 @@
IMPORTANT: If you use on initiator some versions of Windows (at least W2K)
========= you can't get good write performance for FILEIO devices with
- default 512 bytes block sizes. You could get about 10% of
- the expected one. This is because of "unusual" write access
+ default 512 bytes block sizes. You could get about 10% of the
+ expected one. This is because of "unusual" write access
pattern, with which Windows'es write data and which is
- (simplifying) incompatible with how Linux page cache works.
+ (simplifying) incompatible with how Linux page cache works,
+ so for each write the corresponding block must be read first.
With 4096 bytes block sizes for FILEIO devices the write
- performance will be as expected.
+ performance will be as expected. Actually, any system on
+ initiator, not only Windows, will benefit from block size
+ max(PAGE_SIZE, BLOCK_SIZE_ON_UNDERLYING_FS), where PAGE_SIZE
+ is the page size, BLOCK_SIZE_ON_UNDERLYING_FS is block size on
+ the underlying FS, on which the device file located, or 0, if
+ a device node is used. Both values are on the target.
Just for reference: we had with 0.9.2 and "old" Qlogic driver on 2.4.2x
kernel, where we did carefull performance study, aggregate throuhput
Modified: trunk/scst/include/scsi_tgt.h
===================================================================
--- trunk/scst/include/scsi_tgt.h 2006-10-26 13:58:39 UTC (rev 13)
+++ trunk/scst/include/scsi_tgt.h 2006-10-26 16:08:29 UTC (rev 14)
@@ -1026,7 +1026,9 @@
struct scst_tgt_dev *tgt_dev; /* corresponding device for this cmd */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
struct scsi_request *scsi_req; /* SCSI request */
+#endif
/* List entry for tgt_dev's SN related lists */
struct list_head sn_cmd_list_entry;
Added: trunk/scst/kernel/26_scst-2.6.18.patch
===================================================================
--- trunk/scst/kernel/26_scst-2.6.18.patch (rev 0)
+++ trunk/scst/kernel/26_scst-2.6.18.patch 2006-10-26 16:08:29 UTC (rev 14)
@@ -0,0 +1,106 @@
+--- linux-2.6.18.1-scst-dbg/drivers/scsi/scsi_lib.c_scst 2006-09-20 07:42:06.000000000 +0400
++++ linux-2.6.18.1-scst-dbg/drivers/scsi/scsi_lib.c 2006-10-25 20:52:58.000000000 +0400
+@@ -367,7 +367,7 @@
+ }
+
+ /**
+- * scsi_execute_async - insert request
++ * __scsi_execute_async - insert request
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+@@ -378,11 +378,14 @@
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
++ * @at_head: insert request at head or tail of queue
+ **/
+-int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
++static inline int __scsi_execute_async(struct scsi_device *sdev,
++ const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
+ int use_sg, int timeout, int retries, void *privdata,
+- void (*done)(void *, char *, int, int), gfp_t gfp)
++ void (*done)(void *, char *, int, int), gfp_t gfp,
++ int at_head)
+ {
+ struct request *req;
+ struct scsi_io_context *sioc;
+@@ -418,7 +421,7 @@
+ sioc->data = privdata;
+ sioc->done = done;
+
+- blk_execute_rq_nowait(req->q, NULL, req, 1, scsi_end_async);
++ blk_execute_rq_nowait(req->q, NULL, req, at_head, scsi_end_async);
+ return 0;
+
+ free_req:
+@@ -427,8 +430,53 @@
+ kfree(sioc);
+ return DRIVER_ERROR << 24;
+ }
++
++/**
++ * scsi_execute_async - insert request
++ * @sdev: scsi device
++ * @cmd: scsi command
++ * @cmd_len: length of scsi cdb
++ * @data_direction: data direction
++ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
++ * @bufflen: len of buffer
++ * @use_sg: if buffer is a scatterlist this is the number of elements
++ * @timeout: request timeout in seconds
++ * @retries: number of times to retry request
++ * @flags: or into request flags
++ **/
++int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
++ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
++ int use_sg, int timeout, int retries, void *privdata,
++ void (*done)(void *, char *, int, int), gfp_t gfp)
++{
++ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
++ bufflen, use_sg, timeout, retries, privdata, done, gfp, 1);
++}
+ EXPORT_SYMBOL_GPL(scsi_execute_async);
+
++/**
++ * scsi_execute_async_fifi - insert request at tail, in FIFO order
++ * @sdev: scsi device
++ * @cmd: scsi command
++ * @cmd_len: length of scsi cdb
++ * @data_direction: data direction
++ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
++ * @bufflen: len of buffer
++ * @use_sg: if buffer is a scatterlist this is the number of elements
++ * @timeout: request timeout in seconds
++ * @retries: number of times to retry request
++ * @flags: or into request flags
++ **/
++int scsi_execute_async_fifo(struct scsi_device *sdev, const unsigned char *cmd,
++ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
++ int use_sg, int timeout, int retries, void *privdata,
++ void (*done)(void *, char *, int, int), gfp_t gfp)
++{
++ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
++ bufflen, use_sg, timeout, retries, privdata, done, gfp, 0);
++}
++EXPORT_SYMBOL_GPL(scsi_execute_async_fifo);
++
+ /*
+ * Function: scsi_init_cmd_errh()
+ *
+--- linux-2.6.18.1-scst-dbg/include/scsi/scsi_device.h_scst 2006-09-20 07:42:06.000000000 +0400
++++ linux-2.6.18.1-scst-dbg/include/scsi/scsi_device.h 2006-10-25 20:09:23.000000000 +0400
+@@ -297,6 +297,12 @@
+ int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int),
+ gfp_t gfp);
++extern int scsi_execute_async_fifo(struct scsi_device *sdev,
++ const unsigned char *cmd, int cmd_len, int data_direction,
++ void *buffer, unsigned bufflen, int use_sg,
++ int timeout, int retries, void *privdata,
++ void (*done)(void *, char *, int, int),
++ gfp_t gfp);
+
+ static inline void scsi_device_reprobe(struct scsi_device *sdev)
+ {
Modified: trunk/scst/src/Makefile
===================================================================
--- trunk/scst/src/Makefile 2006-10-26 13:58:39 UTC (rev 13)
+++ trunk/scst/src/Makefile 2006-10-26 16:08:29 UTC (rev 14)
@@ -75,7 +75,8 @@
#EXTRA_CFLAGS += -DSTRICT_SERIALIZING
-EXTRA_CFLAGS += -DEXTRACHECKS
+EXTRA_CFLAGS += -DEXTRACHECKS
+#EXTRA_CFLAGS += -DFILEIO_ONLY
#EXTRA_CFLAGS += -fno-inline
Modified: trunk/scst/src/scst.c
===================================================================
--- trunk/scst/src/scst.c 2006-10-26 13:58:39 UTC (rev 13)
+++ trunk/scst/src/scst.c 2006-10-26 16:08:29 UTC (rev 14)
@@ -631,6 +631,16 @@
goto out;
}
+#ifdef FILEIO_ONLY
+ if (dev_type->exec == NULL) {
+ PRINT_ERROR_PR("Pass-through dev handlers (handler %s) not "
+ "supported. Recompile SCST with undefined FILEIO_ONLY",
+ dev_type->name);
+ res = -EINVAL;
+ goto out;
+ }
+#endif
+
if (down_interruptible(&scst_mutex) != 0) {
res = -EINTR;
goto out;
@@ -950,11 +960,22 @@
{
int res = 0, i;
struct scst_cmd *cmd;
- struct scsi_request *req;
TRACE_ENTRY();
- BUILD_BUG_ON(sizeof(cmd->sense_buffer) != sizeof(req->sr_sense_buffer));
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+ {
+ struct scsi_request *req;
+ BUILD_BUG_ON(sizeof(cmd->sense_buffer) !=
+ sizeof(req->sr_sense_buffer));
+ }
+#else
+ {
+ struct scsi_sense_hdr *shdr;
+ BUILD_BUG_ON((sizeof(cmd->sense_buffer) < sizeof(*shdr)) &&
+ (sizeof(cmd->sense_buffer) >= SCSI_SENSE_BUFFERSIZE));
+ }
+#endif
scst_num_cpus = get_cpus_count();
@@ -1130,6 +1151,9 @@
static void __exit exit_scst(void)
{
+#ifdef CONFIG_LOCKDEP
+ static /* To hide the lockdep's warning about non-static key */
+#endif
DECLARE_MUTEX_LOCKED(shm);
TRACE_ENTRY();
Modified: trunk/scst/src/scst_lib.c
===================================================================
--- trunk/scst/src/scst_lib.c 2006-10-26 13:58:39 UTC (rev 13)
+++ trunk/scst/src/scst_lib.c 2006-10-26 16:08:29 UTC (rev 14)
@@ -711,6 +711,7 @@
return res;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
static void scst_req_done(struct scsi_cmnd *scsi_cmd)
{
struct scsi_request *req;
@@ -776,7 +777,42 @@
TRACE_EXIT();
return;
}
+#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) */
+static void scst_send_release(struct scst_tgt_dev *tgt_dev)
+{
+ struct scsi_device *scsi_dev;
+ unsigned char cdb[6];
+ unsigned char sense[SCSI_SENSE_BUFFERSIZE];
+ int rc;
+ TRACE_ENTRY();
+
+ if (tgt_dev->acg_dev->dev->scsi_dev == NULL)
+ goto out;
+
+ scsi_dev = tgt_dev->acg_dev->dev->scsi_dev;
+
+ memset(cdb, 0, sizeof(cdb));
+ cdb[0] = RELEASE;
+ cdb[1] = (scsi_dev->scsi_level <= SCSI_2) ?
+ ((scsi_dev->lun << 5) & 0xe0) : 0;
+
+ TRACE(TRACE_DEBUG | TRACE_SCSI, "%s", "Sending RELEASE req to SCSI "
+ "mid-level");
+ rc = scsi_execute(scsi_dev, cdb, SCST_DATA_NONE, NULL, 0,
+ sense, SCST_DEFAULT_TIMEOUT,
+ 3, GFP_KERNEL);
+ if (rc) {
+ PRINT_INFO_PR("scsi_execute() failed: %d", rc);
+ goto out;
+ }
+
+out:
+ TRACE_EXIT();
+ return;
+}
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) */
+
struct scst_session *scst_alloc_session(struct scst_tgt *tgt, int gfp_mask,
const char *initiator_name)
{
@@ -944,7 +980,7 @@
BUG_ON(cmd->blocking);
-#ifdef EXTRACHECKS
+#if defined(EXTRACHECKS) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18))
if (cmd->scsi_req) {
PRINT_ERROR_PR("%s: %s", __FUNCTION__, "Cmd with unfreed "
"scsi_req!");
@@ -1114,6 +1150,7 @@
return;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
int scst_alloc_request(struct scst_cmd *cmd)
{
int res = 0;
@@ -1154,6 +1191,7 @@
scsi_release_request(cmd->scsi_req);
cmd->scsi_req = NULL;
}
+#endif
int scst_alloc_space(struct scst_cmd *cmd)
{
Modified: trunk/scst/src/scst_priv.h
===================================================================
--- trunk/scst/src/scst_priv.h 2006-10-26 13:58:39 UTC (rev 13)
+++ trunk/scst/src/scst_priv.h 2006-10-26 16:08:29 UTC (rev 14)
@@ -24,9 +24,12 @@
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_driver.h>
#include <scsi/scsi_device.h>
-#include <scsi/scsi_request.h>
#include <scsi/scsi_host.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+#include <scsi/scsi_request.h>
+#endif
+
#define SCST_MAJOR 177
#define TRACE_RETRY 0x80000000
@@ -250,6 +253,7 @@
void scst_check_retries(struct scst_tgt *tgt, int processible_env);
void scst_tgt_retry_timer_fn(unsigned long arg);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
int scst_alloc_request(struct scst_cmd *cmd);
void scst_release_request(struct scst_cmd *cmd);
@@ -257,12 +261,33 @@
const void *cmnd, void *buffer, unsigned bufflen,
void (*done)(struct scsi_cmnd *), int timeout, int retries)
{
-#ifdef STRICT_SERIALIZING
+ #ifdef STRICT_SERIALIZING
scsi_do_req(sreq, cmnd, buffer, bufflen, done, timeout, retries);
+ #elif defined(FILEIO_ONLY)
+ BUG();
+ #else
+ scsi_do_req_fifo(sreq, cmnd, buffer, bufflen, done, timeout, retries);
+ #endif
+}
#else
- scsi_do_req_fifo(sreq, cmnd, buffer, bufflen, done, timeout, retries);
+static inline int scst_exec_req(struct scsi_device *sdev,
+ const unsigned char *cmd, int cmd_len, int data_direction,
+ void *buffer, unsigned bufflen, int use_sg, int timeout, int retries,
+ void *privdata, void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ #ifdef STRICT_SERIALIZING
+ return scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp);
+ #elif defined(FILEIO_ONLY)
+ BUG();
+ return -1;
+ #else
+ return scsi_execute_async_fifo(sdev, cmd, cmd_len, data_direction,
+ buffer, bufflen, use_sg, timeout, retries, privdata, done, gfp);
+ #endif
+}
#endif
-}
+
int scst_alloc_space(struct scst_cmd *cmd);
void scst_release_space(struct scst_cmd *cmd);
void scst_scsi_op_list_init(void);
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2006-10-26 13:58:39 UTC (rev 13)
+++ trunk/scst/src/scst_targ.c 2006-10-26 16:08:29 UTC (rev 14)
@@ -823,8 +823,8 @@
}
/* No locks supposed to be held */
-static void scst_check_sense(struct scst_cmd *cmd, struct scsi_request *req,
- int *next_state)
+static void scst_check_sense(struct scst_cmd *cmd, const uint8_t *rq_sense,
+ int rq_sense_len, int *next_state)
{
int sense_valid;
struct scst_device *dev = cmd->dev;
@@ -848,11 +848,15 @@
smp_mb();
}
- if (req != NULL) {
- sense_valid = SCST_SENSE_VALID(req->sr_sense_buffer);
+ if (rq_sense != NULL) {
+ sense_valid = SCST_SENSE_VALID(rq_sense);
if (sense_valid) {
- memcpy(cmd->sense_buffer, req->sr_sense_buffer,
- sizeof(cmd->sense_buffer));
+ memset(cmd->sense_buffer, 0, sizeof(cmd->sense_buffer));
+ /*
+ * We checked that rq_sense_len < sizeof(cmd->sense_buffer)
+ * in init_scst()
+ */
+ memcpy(cmd->sense_buffer, rq_sense, rq_sense_len);
}
} else
sense_valid = SCST_SENSE_VALID(cmd->sense_buffer);
@@ -971,38 +975,60 @@
return res;
}
-static void scst_do_cmd_done(struct scst_cmd *cmd,
- struct scsi_request *req, int *next_state)
+static void scst_do_cmd_done(struct scst_cmd *cmd, int result,
+ const uint8_t *rq_sense, int rq_sense_len, int *next_state)
{
+ unsigned char type;
+
TRACE_ENTRY();
- cmd->status = req->sr_result & 0xff;
- cmd->masked_status = status_byte(req->sr_result);
- cmd->msg_status = msg_byte(req->sr_result);
- cmd->host_status = host_byte(req->sr_result);
- cmd->driver_status = driver_byte(req->sr_result);
- TRACE(TRACE_SCSI, "req->sr_result=%x, cmd->status=%x, "
+ cmd->status = result & 0xff;
+ cmd->masked_status = status_byte(result);
+ cmd->msg_status = msg_byte(result);
+ cmd->host_status = host_byte(result);
+ cmd->driver_status = driver_byte(result);
+ TRACE(TRACE_SCSI, "result=%x, cmd->status=%x, "
"cmd->masked_status=%x, cmd->msg_status=%x, cmd->host_status=%x, "
- "cmd->driver_status=%x", req->sr_result, cmd->status,
+ "cmd->driver_status=%x", result, cmd->status,
cmd->masked_status, cmd->msg_status, cmd->host_status,
cmd->driver_status);
- scst_check_sense(cmd, req, next_state);
+ cmd->completed = 1;
- cmd->bufflen = req->sr_bufflen; //??
+ scst_dec_on_dev_cmd(cmd);
- /* Clear out request structure */
- req->sr_use_sg = 0;
- req->sr_sglist_len = 0;
- req->sr_bufflen = 0;
- req->sr_buffer = NULL;
- req->sr_underflow = 0;
- req->sr_request->rq_disk = NULL; /* disown request blk */ ;
+ type = cmd->dev->handler->type;
+ if ((cmd->cdb[0] == MODE_SENSE || cmd->cdb[0] == MODE_SENSE_10) &&
+ cmd->tgt_dev->acg_dev->rd_only_flag &&
+ (type == TYPE_DISK || type == TYPE_WORM || type == TYPE_MOD ||
+ type == TYPE_TAPE)) {
+ int32_t length;
+ uint8_t *address;
+ length = scst_get_buf_first(cmd, &address);
+ TRACE_DBG("length %d", length);
+ if (unlikely(length <= 0)) {
+ PRINT_ERROR_PR("%s: scst_get_buf_first() failed",
+ __func__);
+ goto next;
+ }
+ if (length > 2 && cmd->cdb[0] == MODE_SENSE) {
+ address[2] |= 0x80; /* Write Protect*/
+ }
+ else if (length > 3 && cmd->cdb[0] == MODE_SENSE_10) {
+ address[3] |= 0x80; /* Write Protect*/
+ }
+ scst_put_buf(cmd, address);
+ }
+
+next:
+ scst_check_sense(cmd, rq_sense, rq_sense_len, next_state);
+
TRACE_EXIT();
return;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
static inline struct scst_cmd *scst_get_cmd(struct scsi_cmnd *scsi_cmd,
struct scsi_request **req)
{
@@ -1025,7 +1051,6 @@
struct scsi_request *req = NULL;
struct scst_cmd *cmd;
int next_state;
- unsigned char type;
TRACE_ENTRY();
@@ -1044,38 +1069,58 @@
if (cmd == NULL)
goto out;
- cmd->completed = 1;
+ next_state = SCST_CMD_STATE_DEV_DONE;
+ scst_do_cmd_done(cmd, req->sr_result, req->sr_sense_buffer,
+ sizeof(req->sr_sense_buffer), &next_state);
- scst_dec_on_dev_cmd(cmd);
+ /* Clear out request structure */
+ req->sr_use_sg = 0;
+ req->sr_sglist_len = 0;
+ req->sr_bufflen = 0;
+ req->sr_buffer = NULL;
+ req->sr_underflow = 0;
+ req->sr_request->rq_disk = NULL; /* disown request blk */
- type = cmd->dev->handler->type;
- if ((cmd->cdb[0] == MODE_SENSE || cmd->cdb[0] == MODE_SENSE_10) &&
- cmd->tgt_dev->acg_dev->rd_only_flag &&
- (type == TYPE_DISK || type == TYPE_WORM || type == TYPE_MOD ||
- type == TYPE_TAPE)) {
- int32_t length;
- uint8_t *address;
+ cmd->bufflen = req->sr_bufflen; //??
- length = scst_get_buf_first(cmd, &address);
- TRACE_DBG("length %d", length);
- if (unlikely(length <= 0)) {
- goto out;
- }
- if (length > 2 && cmd->cdb[0] == MODE_SENSE) {
- address[2] |= 0x80; /* Write Protect*/
- }
- else if (length > 3 && cmd->cdb[0] == MODE_SENSE_10) {
- address[3] |= 0x80; /* Write Protect*/
- }
- scst_put_buf(cmd, address);
- }
+ scst_release_request(cmd);
- next_state = SCST_CMD_STATE_DEV_DONE;
+ cmd->state = next_state;
+ cmd->non_atomic_only = 0;
- scst_do_cmd_done(cmd, req, &next_state);
+ __scst_process_active_cmd(cmd, scst_get_context(), 0);
- scst_release_request(cmd);
+out:
+ TRACE_EXIT();
+ return;
+}
+#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) */
+static void scst_cmd_done(void *data, char *sense, int result, int resid)
+{
+ struct scst_cmd *cmd;
+ int next_state;
+ TRACE_ENTRY();
+
+ WARN_ON(in_irq());
+
+ /*
+ * We don't use resid, because:
+ * 1. Many low level initiator drivers don't use (set) this field
+ * 2. We determine the command's buffer size directly from CDB,
+ * so resid is not relevant for us, and target drivers
+ * should know the residual, if necessary, by comparing expected
+ * and actual transfer sizes.
+ */
+
+ cmd = (struct scst_cmd *)data;
+ if (cmd == NULL)
+ goto out;
+
+ next_state = SCST_CMD_STATE_DEV_DONE;
+ scst_do_cmd_done(cmd, result, sense, SCSI_SENSE_BUFFERSIZE,
+ &next_state);
+
cmd->state = next_state;
cmd->non_atomic_only = 0;
@@ -1085,6 +1130,7 @@
TRACE_EXIT();
return;
}
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) */
static void scst_cmd_done_local(struct scst_cmd *cmd, int next_state)
{
@@ -1133,7 +1179,7 @@
}
#endif
- scst_check_sense(cmd, NULL, &next_state);
+ scst_check_sense(cmd, NULL, 0, &next_state);
cmd->state = next_state;
cmd->non_atomic_only = 0;
@@ -1557,7 +1603,8 @@
(uint64_t)cmd->lun);
goto out_error;
}
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
if (scst_alloc_request(cmd) != 0) {
PRINT_INFO_PR("%s", "Unable to allocate request, "
"sending BUSY status");
@@ -1568,6 +1615,16 @@
(void *)cmd->scsi_req->sr_buffer,
cmd->scsi_req->sr_bufflen, scst_cmd_done, cmd->timeout,
cmd->retries);
+#else
+ rc = scst_exec_req(cmd->dev->scsi_dev, cmd->cdb, cmd->cdb_len,
+ cmd->data_direction, cmd->sg, cmd->bufflen, cmd->sg_cnt,
+ cmd->timeout, cmd->retries, cmd, scst_cmd_done,
+ GFP_KERNEL);
+ if (rc) {
+ PRINT_INFO_PR("scst_exec_req() failed: %d", rc);
+ goto out_error;
+ }
+#endif
rc = SCST_EXEC_COMPLETED;
@@ -1593,7 +1650,8 @@
rc = SCST_EXEC_COMPLETED;
scst_cmd_done_local(cmd, SCST_CMD_STATE_DEFAULT);
goto out;
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
out_busy:
scst_set_busy(cmd);
cmd->completed = 1;
@@ -1601,6 +1659,7 @@
rc = SCST_EXEC_COMPLETED;
scst_cmd_done_local(cmd, SCST_CMD_STATE_DEFAULT);
goto out;
+#endif
out_aborted:
rc = SCST_EXEC_COMPLETED;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-10-26 13:58:46
|
Revision: 13
http://svn.sourceforge.net/scst/?rev=13&view=rev
Author: vlnb
Date: 2006-10-26 06:58:39 -0700 (Thu, 26 Oct 2006)
Log Message:
-----------
Oops, previous commit erased ERASE16. Fixed.
Modified Paths:
--------------
trunk/scst/src/scst_cdbprobe.h
Modified: trunk/scst/src/scst_cdbprobe.h
===================================================================
--- trunk/scst/src/scst_cdbprobe.h 2006-10-26 13:56:42 UTC (rev 12)
+++ trunk/scst/src/scst_cdbprobe.h 2006-10-26 13:58:39 UTC (rev 13)
@@ -383,6 +383,8 @@
SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0},
{0x93, "O O ", "WRITE SAME(16)",
SCST_DATA_WRITE, 4, SCST_UNKNOWN_LENGTH, 1, 0}, /*N2! */
+ {0x93, " M ", "ERASE(16)",
+ SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0},
{0x9E, "M ", "SERVICE ACTION IN",
SCST_DATA_READ, 4, 0, 0, 0},
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-10-26 13:57:20
|
Revision: 12
http://svn.sourceforge.net/scst/?rev=12&view=rev
Author: vlnb
Date: 2006-10-26 06:56:42 -0700 (Thu, 26 Oct 2006)
Log Message:
-----------
Added SERVICE ACTION IN in scst_scsi_op_table
Modified Paths:
--------------
trunk/scst/src/scst_cdbprobe.h
Modified: trunk/scst/src/scst_cdbprobe.h
===================================================================
--- trunk/scst/src/scst_cdbprobe.h 2006-10-20 18:29:55 UTC (rev 11)
+++ trunk/scst/src/scst_cdbprobe.h 2006-10-26 13:56:42 UTC (rev 12)
@@ -383,8 +383,8 @@
SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0},
{0x93, "O O ", "WRITE SAME(16)",
SCST_DATA_WRITE, 4, SCST_UNKNOWN_LENGTH, 1, 0}, /*N2! */
- {0x93, " M ", "ERASE(16)",
- SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0},
+ {0x9E, "M ", "SERVICE ACTION IN",
+ SCST_DATA_READ, 4, 0, 0, 0},
/* 12-bytes length CDB */
{0xA0, "VVVVVVVVVV M ", "REPORT LUN",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2006-10-20 18:30:02
|
Revision: 11
http://svn.sourceforge.net/scst/?rev=11&view=rev
Author: vlnb
Date: 2006-10-20 11:29:55 -0700 (Fri, 20 Oct 2006)
Log Message:
-----------
Debugging cleanups
Modified Paths:
--------------
trunk/qla2x00t/qla2x00-target/qla2x00t.c
Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c
===================================================================
--- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2006-10-20 18:18:46 UTC (rev 10)
+++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2006-10-20 18:29:55 UTC (rev 11)
@@ -772,10 +772,10 @@
prm.residual =
le32_to_cpu(prm.cmd->atio.data_length) - prm.bufflen;
if (prm.residual > 0) {
- TRACE_MGMT_DBG("Residual underflow: %d", prm.residual);
+ TRACE_DBG("Residual underflow: %d", prm.residual);
prm.rq_result |= SS_RESIDUAL_UNDER;
} else if (prm.residual < 0) {
- TRACE_MGMT_DBG("Residual overflow: %d", prm.residual);
+ TRACE_DBG("Residual overflow: %d", prm.residual);
prm.rq_result |= SS_RESIDUAL_OVER;
prm.residual = -prm.residual;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|