From: <vl...@us...> - 2008-02-18 18:44:39
|
Revision: 288 http://scst.svn.sourceforge.net/scst/?rev=288&view=rev Author: vlnb Date: 2008-02-18 10:44:29 -0800 (Mon, 18 Feb 2008) Log Message: ----------- Some cleanups and performance works Modified Paths: -------------- trunk/iscsi-scst/kernel/nthread.c trunk/scst/README trunk/scst/include/scsi_tgt.h trunk/scst/src/scst_targ.c Modified: trunk/iscsi-scst/kernel/nthread.c =================================================================== --- trunk/iscsi-scst/kernel/nthread.c 2008-02-13 17:15:47 UTC (rev 287) +++ trunk/iscsi-scst/kernel/nthread.c 2008-02-18 18:44:29 UTC (rev 288) @@ -622,7 +622,7 @@ break; case RX_CHECK_DDIGEST: conn->read_state = RX_END; - if (cmnd->pdu.datasize <= 16*1024) { + if (cmnd->pdu.datasize <= 256*1024) { /* It's cache hot, so let's compute it inline */ TRACE_DBG("cmnd %p, opcode %x: checking RX " "ddigest inline", cmnd, cmnd_opcode(cmnd)); Modified: trunk/scst/README =================================================================== --- trunk/scst/README 2008-02-13 17:15:47 UTC (rev 287) +++ trunk/scst/README 2008-02-18 18:44:29 UTC (rev 288) @@ -684,8 +684,9 @@ - On the target deadline IO scheduler with read_expire and write_expire increased on all exported devices to 5000 and 15000 - correspondingly used to be the fastest, but currently seems CFQ often - outperforms it. So, try on your load and use the best one. + correspondingly should be the fastest for BLOCKIO, but for FILEIO + seems CFQ often outperforms it. So, try on your load and use the best + one. - It is recommended to turn the kernel preemption off, i.e. set the kernel preemption model to "No Forced Preemption (Server)". Modified: trunk/scst/include/scsi_tgt.h =================================================================== --- trunk/scst/include/scsi_tgt.h 2008-02-13 17:15:47 UTC (rev 287) +++ trunk/scst/include/scsi_tgt.h 2008-02-18 18:44:29 UTC (rev 288) @@ -1328,11 +1328,11 @@ unsigned long swp:1; /* - * Set if device implements own ordered commands management. - * Particularly, if set, expected_sn will be incremented immediately - * after exec() returned. + * Set if device implements own ordered commands management. If not set + * and queue_alg is SCST_CONTR_MODE_QUEUE_ALG_RESTRICTED_REORDER, + * expected_sn will be incremented only after commands finished. */ - unsigned long has_own_order_mgmt:1; + unsigned long has_own_order_mgmt:1; /**************************************************************/ Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-02-13 17:15:47 UTC (rev 287) +++ trunk/scst/src/scst_targ.c 2008-02-18 18:44:29 UTC (rev 288) @@ -316,7 +316,8 @@ TRACE_ENTRY(); - cmd->inc_expected_sn_on_done = !dev->has_own_order_mgmt; + cmd->inc_expected_sn_on_done = !dev->has_own_order_mgmt && + (dev->queue_alg == SCST_CONTR_MODE_QUEUE_ALG_RESTRICTED_REORDER); sBUG_ON(cmd->internal); @@ -2710,8 +2711,14 @@ scst_check_debug_sn(cmd); - if (cmd->dev->queue_alg == SCST_CONTR_MODE_QUEUE_ALG_RESTRICTED_REORDER) + if (cmd->dev->queue_alg == SCST_CONTR_MODE_QUEUE_ALG_RESTRICTED_REORDER) { + /* + * Not the best way, but well enough until there will be a + * possibility to specify queue type during pass-through + * commands submission. + */ cmd->queue_type = SCST_CMD_QUEUE_ORDERED; + } switch(cmd->queue_type) { case SCST_CMD_QUEUE_SIMPLE: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-03-05 18:22:07
|
Revision: 298 http://scst.svn.sourceforge.net/scst/?rev=298&view=rev Author: vlnb Date: 2008-03-05 10:22:01 -0800 (Wed, 05 Mar 2008) Log Message: ----------- - Fixed race on TM processing leading to BUG() - Fixed dev_cdrom and dev_modisk load failures if there are no media in the drives - Other minor fixes and cleanups Modified Paths: -------------- trunk/iscsi-scst/kernel/param.c trunk/iscsi-scst/usr/plain.c trunk/scst/include/scsi_tgt.h trunk/scst/src/dev_handlers/scst_cdrom.c trunk/scst/src/dev_handlers/scst_modisk.c trunk/scst/src/scst_targ.c Modified: trunk/iscsi-scst/kernel/param.c =================================================================== --- trunk/iscsi-scst/kernel/param.c 2008-02-29 18:25:56 UTC (rev 297) +++ trunk/iscsi-scst/kernel/param.c 2008-03-05 18:22:01 UTC (rev 298) @@ -16,31 +16,34 @@ #include "iscsi.h" #include "digest.h" -#define CHECK_PARAM(info, iparam, word, min, max) \ -do { \ - if (!info->partial || (info->partial & 1 << key_##word)) \ - if (iparam[key_##word] < min || \ - iparam[key_##word] > max) { \ - PRINT_ERROR("%s: %u is out of range (%u %u)",\ - #word, iparam[key_##word], min, max); \ - iparam[key_##word] = min; \ - } \ +#define CHECK_PARAM(info, iparam, word, min, max) \ +do { \ + if (!(info)->partial || ((info)->partial & 1 << key_##word)) \ + if ((iparam)[key_##word] < (min) || \ + (iparam)[key_##word] > (max)) { \ + PRINT_ERROR("%s: %u is out of range (%u %u)", \ + #word, (iparam)[key_##word], (min), (max)); \ + if ((iparam)[key_##word] < (min)) \ + (iparam)[key_##word] = (min); \ + else \ + (iparam)[key_##word] = (max); \ + } \ } while (0) -#define SET_PARAM(param, info, iparam, word) \ -({ \ - int changed = 0; \ - if (!info->partial || (info->partial & 1 << key_##word)) { \ - if (param->word != iparam[key_##word]) \ - changed = 1; \ - param->word = iparam[key_##word]; \ - } \ - changed; \ +#define SET_PARAM(param, info, iparam, word) \ +({ \ + int changed = 0; \ + if (!(info)->partial || ((info)->partial & 1 << key_##word)) { \ + if ((param)->word != (iparam)[key_##word]) \ + changed = 1; \ + (param)->word = (iparam)[key_##word]; \ + } \ + changed; \ }) -#define GET_PARAM(param, info, iparam, word) \ -do { \ - iparam[key_##word] = param->word; \ +#define GET_PARAM(param, info, iparam, word) \ +do { \ + (iparam)[key_##word] = (param)->word; \ } while (0) static const char *get_bool_name(int val) @@ -191,7 +194,7 @@ trgt_param_set(target, info); prm = &target->trgt_param; - PRINT_INFO("Target parameter changed: queued_cmnds %d", + PRINT_INFO("Target parameter changed: QueuedCommands %d", prm->queued_cmnds); } else trgt_param_get(&target->trgt_param, info); Modified: trunk/iscsi-scst/usr/plain.c =================================================================== --- trunk/iscsi-scst/usr/plain.c 2008-02-29 18:25:56 UTC (rev 297) +++ trunk/iscsi-scst/usr/plain.c 2008-03-05 18:22:01 UTC (rev 298) @@ -102,8 +102,9 @@ u32 tid; int idx, res = 0; - if (!(fp = fopen(filename, "r"))) - return -EIO; + if (!(fp = fopen(filename, "r"))) { + return errno == ENOENT ? 0 : -errno; + } tid = 0; while (fgets(buf, sizeof(buf), fp)) { @@ -520,8 +521,9 @@ u32 tid, val; int res = 0; - if (!(config = fopen(filename, "r"))) - return -errno; + if (!(config = fopen(filename, "r"))) { + return errno == ENOENT ? 0 : -errno; + } tid = 0; while (fgets(buf, BUFSIZE, config)) { Modified: trunk/scst/include/scsi_tgt.h =================================================================== --- trunk/scst/include/scsi_tgt.h 2008-02-29 18:25:56 UTC (rev 297) +++ trunk/scst/include/scsi_tgt.h 2008-03-05 18:22:01 UTC (rev 298) @@ -1077,12 +1077,6 @@ unsigned int sg_buff_modified:1; /* - * Set if the cmd's memory requirements are checked and found - * acceptable - */ - unsigned int mem_checked:1; - - /* * Set if scst_cmd_init_stage1_done() called and the target * want that preprocessing_done() will be called */ @@ -1147,6 +1141,8 @@ lun_t lun; /* LUN for this cmd */ + unsigned long start_time; + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) struct scsi_request *scsi_req; /* SCSI request */ #endif Modified: trunk/scst/src/dev_handlers/scst_cdrom.c =================================================================== --- trunk/scst/src/dev_handlers/scst_cdrom.c 2008-02-29 18:25:56 UTC (rev 297) +++ trunk/scst/src/dev_handlers/scst_cdrom.c 2008-03-05 18:22:01 UTC (rev 298) @@ -119,18 +119,17 @@ TRACE_DBG("READ_CAPACITY done: %x", res); - if (!res || (sbuff[12] != 0x28 && sbuff[12] != 0x29)) - { + if ((res == 0) || (sbuff[2] != UNIT_ATTENTION)) break; - } + if (!--retries) { - PRINT_ERROR("UA not clear after %d retries", + PRINT_ERROR("UA not cleared after %d retries", SCST_DEV_UA_RETRIES); params->block_shift = CDROM_DEF_BLOCK_SHIFT; -// res = -ENODEV; goto out_free_buf; } } + if (res == 0) { int sector_size = ((buffer[4] << 24) | (buffer[5] << 16) | (buffer[6] << 8) | (buffer[7] << 0)); @@ -143,8 +142,6 @@ } else { TRACE_BUFFER("Sense set", sbuff, SCST_SENSE_BUFFERSIZE); params->block_shift = CDROM_DEF_BLOCK_SHIFT; -// res = -ENODEV; - goto out_free_buf; } res = scst_obtain_device_parameters(dev); Modified: trunk/scst/src/dev_handlers/scst_modisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_modisk.c 2008-02-29 18:25:56 UTC (rev 297) +++ trunk/scst/src/dev_handlers/scst_modisk.c 2008-03-05 18:22:01 UTC (rev 298) @@ -207,16 +207,16 @@ TRACE_DBG("READ_CAPACITY done: %x", res); - if (!res || (sbuff[2] != UNIT_ATTENTION)) - { + if (!res || (sbuff[2] != UNIT_ATTENTION)) break; - } + if (!--retries) { - PRINT_ERROR("UA not clear after %d retries", + PRINT_ERROR("UA not cleared after %d retries", SCST_DEV_UA_RETRIES); goto out_free_buf; } } + if (res == 0) { int sector_size = ((buffer[4] << 24) | (buffer[5] << 16) | (buffer[6] << 8) | (buffer[7] << 0)); @@ -229,9 +229,10 @@ } else { TRACE_BUFFER("Sense set", sbuff, SCST_SENSE_BUFFERSIZE); - if (sbuff[2] != NOT_READY) + if (sbuff[2] != NOT_READY) { res = -ENODEV; - goto out_free_buf; + goto out_free_buf; + } } res = scst_obtain_device_parameters(dev); Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-02-29 18:25:56 UTC (rev 297) +++ trunk/scst/src/scst_targ.c 2008-03-05 18:22:01 UTC (rev 298) @@ -76,6 +76,8 @@ cmd->tgt = sess->tgt; cmd->tgtt = sess->tgt->tgtt; + cmd->start_time = jiffies; + /* * For both wrong lun and CDB defer the error reporting for * scst_cmd_init_done() @@ -3566,9 +3568,10 @@ * we must wait here to be sure that we won't receive * double commands with the same tag. */ - TRACE_MGMT_DBG("cmd %p (tag %llu) being executed/" - "xmitted (state %d), deferring ABORT...", - cmd, cmd->tag, cmd->state); + TRACE_MGMT_DBG("cmd %p (tag %llu) being executed/xmitted " + "(state %d, proc time %ld sec.), deferring ABORT...", + cmd, cmd->tag, cmd->state, + (long)(jiffies - cmd->start_time)/HZ); mcmd->cmd_finish_wait_count++; @@ -4346,7 +4349,9 @@ sess->unreg_cmds_done_fn = NULL; } + spin_lock_irq(&scst_mcmd_lock); mcmd->nexus_loss_check_done = 1; + spin_unlock_irq(&scst_mcmd_lock); res = scst_set_mcmd_next_state(mcmd); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-03-17 11:29:52
|
Revision: 304 http://scst.svn.sourceforge.net/scst/?rev=304&view=rev Author: vlnb Date: 2008-03-17 04:29:50 -0700 (Mon, 17 Mar 2008) Log Message: ----------- Patch from Vu Pham <vu...@me...>: SRP target driver Modified Paths: -------------- trunk/Makefile Added Paths: ----------- trunk/srpt/ trunk/srpt/LICENSE trunk/srpt/Makefile trunk/srpt/README trunk/srpt/README.ofed trunk/srpt/patches/ trunk/srpt/patches/scst_increase_max_tgt_cmds.patch trunk/srpt/src/ trunk/srpt/src/Kconfig trunk/srpt/src/Makefile trunk/srpt/src/Makefile.in_kernel trunk/srpt/src/ib_dm_mad.h trunk/srpt/src/ib_srpt.c trunk/srpt/src/ib_srpt.h Modified: trunk/Makefile =================================================================== --- trunk/Makefile 2008-03-14 10:42:03 UTC (rev 303) +++ trunk/Makefile 2008-03-17 11:29:50 UTC (rev 304) @@ -23,6 +23,7 @@ QLA_DIR=qla2x00t/qla2x00-target LSI_DIR=mpt USR_DIR=usr/fileio +SRP_DIR=srpt ISCSI_DIR=iscsi-scst #ISCSI_DISTDIR=../../../iscsi_scst_inst @@ -58,6 +59,12 @@ @echo " lsi_install : lsi target: install" @echo " lsi_uninstall : lsi target: uninstall" @echo "" + @echo " srpt : make SRP target" + @echo " srpt_clean : srp target: clean " + @echo " srpt_extraclean : srp target: clean + clean dependencies" + @echo " srpt_install : srp target: install" + @echo " srpt_uninstall : srp target: uninstall" + @echo "" @echo " usr : make user space fileio_tgt target" @echo " usr_clean : usr target: clean " @echo " usr_extraclean : usr target: clean + clean dependencies" @@ -76,6 +83,7 @@ cd $(SCST_DIR) && $(MAKE) $@ @if [ -d $(QLA_DIR) ]; then cd $(QLA_DIR) && $(MAKE) $@; fi # @if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi + @if [ -d $(SRP_DIR) ]; then cd $(SRP_DIR) && $(MAKE) $@; fi @if [ -d $(ISCSI_DIR) ]; then cd $(ISCSI_DIR) && $(MAKE) $@; fi @if [ -d $(USR_DIR) ]; then cd $(USR_DIR) && $(MAKE) $@; fi @@ -83,6 +91,7 @@ cd $(SCST_DIR) && $(MAKE) $@ @if [ -d $(QLA_DIR) ]; then cd $(QLA_DIR) && $(MAKE) $@; fi # @if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi + @if [ -d $(SRP_DIR) ]; then cd $(SRP_DIR) && $(MAKE) $@; fi @if [ -d $(ISCSI_DIR) ]; then cd $(ISCSI_DIR) && $(MAKE) DISTDIR=$(ISCSI_DISTDIR) $@; fi @if [ -d $(USR_DIR) ]; then cd $(USR_DIR) && $(MAKE) $@; fi @@ -90,6 +99,7 @@ cd $(SCST_DIR) && $(MAKE) $@ @if [ -d $(QLA_DIR) ]; then cd $(QLA_DIR) && $(MAKE) $@; fi @if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi + @if [ -d $(SRP_DIR) ]; then cd $(SRP_DIR) && $(MAKE) $@; fi @if [ -d $(ISCSI_DIR) ]; then cd $(ISCSI_DIR) && $(MAKE) $@; fi @if [ -d $(USR_DIR) ]; then cd $(USR_DIR) && $(MAKE) $@; fi @@ -98,6 +108,7 @@ @if [ -d $(QLA_INI_DIR) ]; then cd $(QLA_INI_DIR) && $(MAKE) $@; fi @if [ -d $(QLA_DIR) ]; then cd $(QLA_DIR) && $(MAKE) $@; fi @if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi + @if [ -d $(SRP_DIR) ]; then cd $(SRP_DIR) && $(MAKE) $@; fi @if [ -d $(ISCSI_DIR) ]; then cd $(ISCSI_DIR) && $(MAKE) $@; fi @if [ -d $(USR_DIR) ]; then cd $(USR_DIR) && $(MAKE) $@; fi @@ -106,6 +117,7 @@ @if [ -d $(QLA_INI_DIR) ]; then cd $(QLA_INI_DIR) && $(MAKE) $@; fi @if [ -d $(QLA_DIR) ]; then cd $(QLA_DIR) && $(MAKE) $@; fi @if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi + @if [ -d $(SRP_DIR) ]; then cd $(SRP_DIR) && $(MAKE) $@; fi @if [ -d $(ISCSI_DIR) ]; then cd $(ISCSI_DIR) && $(MAKE) $@; fi @if [ -d $(USR_DIR) ]; then cd $(USR_DIR) && $(MAKE) $@; fi @@ -171,6 +183,21 @@ lsi_extraclean: cd $(LSI_DIR) && $(MAKE) extraclean +srpt: + cd $(SRP_DIR) && $(MAKE) + +srpt_install: + cd $(SRP_DIR) && $(MAKE) install + +srpt_uninstall: + cd $(SRP_DIR) && $(MAKE) uninstall + +srpt_clean: + cd $(SRP_DIR) && $(MAKE) clean + +srpt_extraclean: + cd $(SRP_DIR) && $(MAKE) extraclean + usr: cd $(USR_DIR) && $(MAKE) Property changes on: trunk/srpt ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers Added: trunk/srpt/LICENSE =================================================================== --- trunk/srpt/LICENSE (rev 0) +++ trunk/srpt/LICENSE 2008-03-17 11:29:50 UTC (rev 304) @@ -0,0 +1,45 @@ +OpenIB.org BSD license: + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following +disclaimer in the documentation and/or other materials provided +with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + + +Alternatively, this software may be distributed under the terms of the +the GNU Public License ("GPL") with platforms where the prevalant license +is the GNU Public License: + + This program is free software; you can redistribute it and/or modify + it under the terms of The Version 2 GNU General Public License as published + by the Free Software Foundation. + + 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., 675 Mass Ave, Cambridge, MA 02139, USA. + Added: trunk/srpt/Makefile =================================================================== --- trunk/srpt/Makefile (rev 0) +++ trunk/srpt/Makefile 2008-03-17 11:29:50 UTC (rev 304) @@ -0,0 +1,57 @@ +# +# Makefile for the Linux kernel device drivers. +# +# Note! Dependencies are done automagically by 'make dep', which also +# removes any old dependencies. DON'T put your own dependencies here +# unless it's something special (not a .c file). +# +# Note 2! The CFLAGS definitions are now in the main makefile. + +SCST_DIR := $(shell pwd)/../scst/src +SUBDIRS := $(shell pwd) + +ifeq ($(KVER),) + ifeq ($(KDIR),) + KVER = $(shell uname -r) + KDIR ?= /lib/modules/$(KVER)/build + else + KVER = $$KERNELRELEASE + endif +else + KDIR ?= /lib/modules/$(KVER)/build +endif + +all: Modules.symvers Module.symvers + $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/src modules + +install: all src/ib_srpt.ko + @eval `sed -n 's/#define UTS_RELEASE /KERNELRELEASE=/p' $(KDIR)/include/linux/version.h $(KDIR)/include/linux/utsrelease.h 2>/dev/null`; \ + install -vD -m 644 src/ib_srpt.ko \ + $(DISTDIR)$(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra/ib_srpt.ko + -/sbin/depmod -aq $(KVER) + +SCST_MOD_VERS := $(shell ls $(SCST_DIR)/Modules.symvers 2>/dev/null) +ifneq ($(SCST_MOD_VERS),) +Modules.symvers: $(SCST_DIR)/Modules.symvers + echo $(SCST_MOD_VERS) + cp $(SCST_DIR)/Modules.symvers src/ +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 src/ +else +.PHONY: Module.symvers +endif + +clean: + $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/src clean + rm -f src/Modules.symvers src/Module.symvers + +extraclean: clean + +.PHONY: all install clean extraclean Added: trunk/srpt/README =================================================================== --- trunk/srpt/README (rev 0) +++ trunk/srpt/README 2008-03-17 11:29:50 UTC (rev 304) @@ -0,0 +1,106 @@ +SCSI RDMA Protocol (SRP) Target driver for Linux +================================================= + +SRP Target driver is designed to work directly on top of OpenFabrics +OFED-1.x software stack (http://www.openfabrics.org) or Infiniband +drivers in Linux kernel tree (kernel.org). It also interfaces with +Generic SCSI target mid-level driver - SCST (http://scst.sourceforge.net) + +NOTES: This SRP Target driver can only compile and work with IB driver + in Linux vanilla kernel. It does not compile and work with IB + driver in OFED-1.x packages + + If you want to work with IB driver in OFED-1.x package, you should + read and follow instruction in README.ofed file + + +Installation +------------ +$ make +$ make install + +To minimize QUEUEFULL conditions, please apply scst_increase_max_tgt_cmds +patch and recompile scst + +$ cd ~scst/trunk +$ patch -p0 < srpt/patches/scst_increasa_max_tgt_cmds.patch +$ make scst scst_install srpt srpt_install + + +How-to run +----------- +A. On srp target machine +1. Please refer to SCST's README for loading scst driver and its +dev_handlers drivers (scst_disk, scst_vdisk block or file IO mode, nullio, ...) + +Example 1: working with real back-end scsi disks +a. modprobe scst +b. modprobe scst_disk +c. cat /proc/scsi_tgt/scsi_tgt + +ibstor00:~ # cat /proc/scsi_tgt/scsi_tgt +Device (host:ch:id:lun or name) Device handler +0:0:0:0 dev_disk +4:0:0:0 dev_disk +5:0:0:0 dev_disk +6:0:0:0 dev_disk +7:0:0:0 dev_disk + +Now you want to exclude the first scsi disk and expose the last 4 scsi disks as +IB/SRP luns for I/O +echo "add 4:0:0:0 0" >/proc/scsi_tgt/groups/Default/devices +echo "add 5:0:0:0 1" >/proc/scsi_tgt/groups/Default/devices +echo "add 6:0:0:0 2" >/proc/scsi_tgt/groups/Default/devices +echo "add 7:0:0:0 3" >/proc/scsi_tgt/groups/Default/devices + +Example 2: working with VDISK FILEIO mode (using md0 device and file 10G-file) +a. modprobe scst +b. modprobe scst_vdisk +c. echo "open vdisk0 /dev/md0" > /proc/scsi_tgt/vdisk/vdisk +d. echo "open vdisk1 /10G-file" > /proc/scsi_tgt/vdisk/vdisk +e. echo "add vdisk0 0" >/proc/scsi_tgt/groups/Default/devices +f. echo "add vdisk1 1" >/proc/scsi_tgt/groups/Default/devices + +Example 3: working with VDISK BLOCKIO mode (using md0 device, sda, and cciss/c1d0) +a. modprobe scst +b. modprobe scst_vdisk +c. echo "open vdisk0 /dev/md0 BLOCKIO" > /proc/scsi_tgt/vdisk/vdisk +d. echo "open vdisk1 /dev/sda BLOCKIO" > /proc/scsi_tgt/vdisk/vdisk +e. echo "open vdisk2 /dev/cciss/c1d0 BLOCKIO" > /proc/scsi_tgt/vdisk/vdisk +f. echo "add vdisk0 0" >/proc/scsi_tgt/groups/Default/devices +g. echo "add vdisk1 1" >/proc/scsi_tgt/groups/Default/devices +h. echo "add vdisk2 2" >/proc/scsi_tgt/groups/Default/devices + +2. modprobe ib_srpt + + +B. On initiator machines you can manualy do the following steps: +1. modprobe ib_srp +2. ipsrpdm -c (to discover new SRP target) +3. echo <new target info> > /sys/class/infiniband_srp/srp-mthca0-1/add_target +4. fdisk -l (will show new discovered scsi disks) + +Example: +Assume that you use port 1 of first HCA in the system ie. mthca0 + +[root@lab104 ~]# ibsrpdm -c -d /dev/infiniband/umad0 +id_ext=0002c90200226cf4,ioc_guid=0002c90200226cf4, +dgid=fe800000000000000002c90200226cf5,pkey=ffff,service_id=0002c90200226cf4 +[root@lab104 ~]# echo id_ext=0002c90200226cf4,ioc_guid=0002c90200226cf4, +dgid=fe800000000000000002c90200226cf5,pkey=ffff,service_id=0002c90200226cf4 > +/sys/class/infiniband_srp/srp-mthca0-1/add_target + +OR + ++ You can edit /etc/infiniband/openib.conf to load srp driver and srp HA daemon +automatically ie. set SRP_LOAD=yes, and SRPHA_ENABLE=yes ++ To set up and use high availability feature you need dm-multipath driver +and multipath tool ++ Please refer to OFED-1.x SRP's user manual for more in-details instructions +on how-to enable/use HA feature + + +TO DO +------ ++ Stress test and stabilize the code ++ Performance tuning Added: trunk/srpt/README.ofed =================================================================== --- trunk/srpt/README.ofed (rev 0) +++ trunk/srpt/README.ofed 2008-03-17 11:29:50 UTC (rev 304) @@ -0,0 +1,165 @@ +SCSI RDMA Protocol (SRP) Target driver for Linux +================================================= + +SRP Target driver is designed to work directly on top of OpenFabrics +OFED-1.x software stack (http://www.openfabrics.org) or Infiniband +drivers in Linux kernel tree (kernel.org). It also interfaces with +Generic SCSI target mid-level driver - SCST (http://scst.sourceforge.net) + +By interfacing with SCST driver we are able to work and support a lot IO +modes on real or virtual devices in the backend +1. scst_disk -- interfacing with scsi sub-system to claim and export real +scsi devices ie. disks, hardware raid volumes, tape library as SRP's luns + +2. scst_vdisk -- fileio and blockio modes. This allows you to turn software raid +volumes, LVM volumes, IDE disks, and normal files into SRP's luns (required to +work with latest scst's svn tree) + +3. NULLIO mode will allow you to measure the performance without sending IOs +to *real* devices + + +Prerequisites +------------- +1. First it is required to download and install SCST driver. Please +refer to SCST's Internet page http://scst.sourceforge.net for download +and installation instructions. You can also find SCST's design document, +svn repository development tree and utility tools for basic storage +management + +a. git clone git://git.openfabrics.org/~vu/srpt_inc ~/srpt_inc +b. Checking out scst's svn development tree revision 245 +svn co https://scst.svn.sourceforge.net/svnroot/scst/trunk/scst -r 245 +c. cd scst +d. patch -p0 < ~/srpt_inc/scst_r245.patch +e. make and make install + +2. Download/install IB low-level driver from OFED package or linux kernel tree +a. SRP target is part of OFED-1.3 +or +b. Download and install OFED-1.x (x > 1) with kernel_ib development package rpm +or +c. Built and installed Infiniband driver in Linux "vanilla" kernel tree + from kernel.org + +3. Download SRP target driver from openfabrics.org (needed for 2b, 2c) +git clone git://git.openfabrics.org/~vu/srpt.git ~/srpt + + +Installation +------------ +A. For OFED-1.3 +---------------- +SRP target is part of ofed-1.3. Go through normal installation with srpt enable + + +B. Instruction to included in and built with OFED-1.2.5 development tree +----------------------------------------------------------------------- +1. cd /usr/src/ofa_kernel-1.2.5 or /usr/src/ofa_kernel-1.2.c or +~/ofa_1_2_c_kernel-200708xx-yyyy +2. patch -p1 < ~/srpt_inc/add_srpt_01.patch +3. patch -p1 < ~/srpt_inc/add_srpt_03.patch +4. patch -p1 < ~/srpt_inc/add_srpt_04.patch +5. cp -r ~/srpt drivers/infiniband/ulp/srpt +6. ./configure --with-core-mod --with-mthca-mod --without-mthca_debug-mod + --with-srp-target-mod <and any other modules/drivers as needed> +7. make and make install + +C. Instruction to be included in and built with OFED-1.2 development tree +-------------------------------------------------------------------------- +1. cd /usr/src/ofa_kernel-1.2 or /usr/src/ofa_kernel-1.2 or +~/ofa_1_2_kernel-200708xx-yyyy +2. patch -p1 < ~/srpt_inc/add_srpt_01.patch +3. patch -p1 < ~/srpt_inc/add_srpt_03.patch +4. patch -p1 < ~/srpt_inc/add_srpt_04.patch +5. cp -r ~/srpt drivers/infiniband/ulp/srpt +6. patch -p1 < ~/srpt_inc/add_srpt_ofed_1_2.patch +7. ./configure --with-core-mod --with-mthca-mod --without-mthca_debug-mod + --with-srp-target-mod <and any other modules/drivers as needed> +8. make and make install + +D. Instruction to be included in and built with "vanilla" kernel development tree +---------------------------------------------------------------------------------- +1. cd /usr/src/linux-2.6.1x +2. patch -p1 < ~/srpt_inc/add_srpt_03.patch +3. cp -r ~/srpt drivers/infiniband/ulp/srpt +4. configure and build SRP target module driver as normal + + +How-to run +----------- +A. On srp target machine +1. Please refer to SCST's README for loading scst driver and its +dev_handlers drivers (scst_disk, scst_vdisk block or file IO mode, nullio, ...) + +Example 1: working with real back-end scsi disks +a. modprobe scst +b. modprobe scst_disk +c. cat /proc/scsi_tgt/scsi_tgt + +ibstor00:~ # cat /proc/scsi_tgt/scsi_tgt +Device (host:ch:id:lun or name) Device handler +0:0:0:0 dev_disk +4:0:0:0 dev_disk +5:0:0:0 dev_disk +6:0:0:0 dev_disk +7:0:0:0 dev_disk + +Now you want to exclude the first scsi disk and expose the last 4 scsi disks as +IB/SRP luns for I/O +echo "add 4:0:0:0 0" >/proc/scsi_tgt/groups/Default/devices +echo "add 5:0:0:0 1" >/proc/scsi_tgt/groups/Default/devices +echo "add 6:0:0:0 2" >/proc/scsi_tgt/groups/Default/devices +echo "add 7:0:0:0 3" >/proc/scsi_tgt/groups/Default/devices + +Example 2: working with VDISK FILEIO mode (using md0 device and file 10G-file) +a. modprobe scst +b. modprobe scst_vdisk +c. echo "open vdisk0 /dev/md0" > /proc/scsi_tgt/vdisk/vdisk +d. echo "open vdisk1 /10G-file" > /proc/scsi_tgt/vdisk/vdisk +e. echo "add vdisk0 0" >/proc/scsi_tgt/groups/Default/devices +f. echo "add vdisk1 1" >/proc/scsi_tgt/groups/Default/devices + +Example 3: working with VDISK BLOCKIO mode (using md0 device, sda, and cciss/c1d0) +a. modprobe scst +b. modprobe scst_vdisk +c. echo "open vdisk0 /dev/md0 BLOCKIO" > /proc/scsi_tgt/vdisk/vdisk +d. echo "open vdisk1 /dev/sda BLOCKIO" > /proc/scsi_tgt/vdisk/vdisk +e. echo "open vdisk2 /dev/cciss/c1d0 BLOCKIO" > /proc/scsi_tgt/vdisk/vdisk +f. echo "add vdisk0 0" >/proc/scsi_tgt/groups/Default/devices +g. echo "add vdisk1 1" >/proc/scsi_tgt/groups/Default/devices +h. echo "add vdisk2 2" >/proc/scsi_tgt/groups/Default/devices + +2. modprobe ib_srpt + + +B. On initiator machines you can manualy do the following steps: +1. modprobe ib_srp +2. ipsrpdm -c (to discover new SRP target) +3. echo <new target info> > /sys/class/infiniband_srp/srp-mthca0-1/add_target +4. fdisk -l (will show new discovered scsi disks) + +Example: +Assume that you use port 1 of first HCA in the system ie. mthca0 + +[root@lab104 ~]# ibsrpdm -c -d /dev/infiniband/umad0 +id_ext=0002c90200226cf4,ioc_guid=0002c90200226cf4, +dgid=fe800000000000000002c90200226cf5,pkey=ffff,service_id=0002c90200226cf4 +[root@lab104 ~]# echo id_ext=0002c90200226cf4,ioc_guid=0002c90200226cf4, +dgid=fe800000000000000002c90200226cf5,pkey=ffff,service_id=0002c90200226cf4 > +/sys/class/infiniband_srp/srp-mthca0-1/add_target + +OR + ++ You can edit /etc/infiniband/openib.conf to load srp driver and srp HA daemon +automatically ie. set SRP_LOAD=yes, and SRPHA_ENABLE=yes ++ To set up and use high availability feature you need dm-multipath driver +and multipath tool ++ Please refer to OFED-1.x SRP's user manual for more in-details instructions +on how-to enable/use HA feature + + +TO DO +------ ++ Stress test and stabilize the code ++ Performance tuning Property changes on: trunk/srpt/patches ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers Added: trunk/srpt/patches/scst_increase_max_tgt_cmds.patch =================================================================== --- trunk/srpt/patches/scst_increase_max_tgt_cmds.patch (rev 0) +++ trunk/srpt/patches/scst_increase_max_tgt_cmds.patch 2008-03-17 11:29:50 UTC (rev 304) @@ -0,0 +1,13 @@ +Index: scst/src/scst_priv.h +=================================================================== +--- scst/src/scst_priv.h (revision 303) ++++ scst/src/scst_priv.h (working copy) +@@ -110,7 +110,7 @@ extern unsigned long scst_trace_flag; + ** Maximum count of uncompleted commands that an initiator could + ** queue on any device. Then it will start getting TASK QUEUE FULL status. + **/ +-#define SCST_MAX_TGT_DEV_COMMANDS 48 ++#define SCST_MAX_TGT_DEV_COMMANDS 64 + + /** + ** Maximum count of uncompleted commands that could be queued on any device. Property changes on: trunk/srpt/src ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers Added: trunk/srpt/src/Kconfig =================================================================== --- trunk/srpt/src/Kconfig (rev 0) +++ trunk/srpt/src/Kconfig 2008-03-17 11:29:50 UTC (rev 304) @@ -0,0 +1,12 @@ +config INFINIBAND_SRPT + tristate "InfiniBand SCSI RDMA Protocol Target Mode" + depends on INFINIBAND + ---help--- + Support for the SCSI RDMA Protocol Target mode over InfiniBand. + This allows you to turn a standard Linux box to native Infiniband + storage using SRP protocol. + + You will also need the SCST middle level drivers from + http://scst.sf.net/ + The SRP protocol is defined by the INCITS T10 technical + committee. See <http://www.t10.org/>. Added: trunk/srpt/src/Makefile =================================================================== --- trunk/srpt/src/Makefile (rev 0) +++ trunk/srpt/src/Makefile 2008-03-17 11:29:50 UTC (rev 304) @@ -0,0 +1,7 @@ +SCST_INC_DIR := $(SUBDIRS)/../../scst/include + +EXTRA_CFLAGS += -I$(SCST_INC_DIR) +EXTRA_CFLAGS += -DDEBUG -g +#EXTRA_CFLAGS += -Wextra -Wno-unused-parameter + +obj-m += ib_srpt.o Added: trunk/srpt/src/Makefile.in_kernel =================================================================== --- trunk/srpt/src/Makefile.in_kernel (rev 0) +++ trunk/srpt/src/Makefile.in_kernel 2008-03-17 11:29:50 UTC (rev 304) @@ -0,0 +1,4 @@ +EXTRA_CFLAGS += -Idrivers/infiniband/include +EXTRA_CFLAGS += -I/usr/local/include/scst + +obj-$(CONFIG_INFINIBAND_SRPT) += ib_srpt.o Added: trunk/srpt/src/ib_dm_mad.h =================================================================== --- trunk/srpt/src/ib_dm_mad.h (rev 0) +++ trunk/srpt/src/ib_dm_mad.h 2008-03-17 11:29:50 UTC (rev 304) @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2006 Mellanox Technology Inc. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef IB_DM_MAD_H +#define IB_DM_MAD_H + +#include <linux/types.h> + +#include <rdma/ib_mad.h> + +enum { + DM_MAD_STATUS_UNSUP_METHOD = 0x0008, + DM_MAD_STATUS_UNSUP_METHOD_ATTR = 0x000c, + DM_MAD_STATUS_INVALID_FIELD = 0x001c, + DM_MAD_STATUS_NO_IOC = 0x0100, + + DM_ATTR_CLASS_PORT_INFO = 0x01, + DM_ATTR_IOU_INFO = 0x10, + DM_ATTR_IOC_PROFILE = 0x11, + DM_ATTR_SVC_ENTRIES = 0x12 +}; + +struct ib_dm_hdr { + u8 reserved[28]; +}; + +struct ib_dm_mad { + struct ib_mad_hdr mad_hdr; + struct ib_rmpp_hdr rmpp_hdr; + struct ib_dm_hdr dm_hdr; + u8 data[IB_MGMT_DEVICE_DATA]; +}; + +struct ib_dm_iou_info { + __be16 change_id; + u8 max_controllers; + u8 op_rom; + u8 controller_list[128]; +}; + +struct ib_dm_ioc_profile { + __be64 guid; + __be32 vendor_id; + __be32 device_id; + __be16 device_version; + __be16 reserved1; + __be32 subsys_vendor_id; + __be32 subsys_device_id; + __be16 io_class; + __be16 io_subclass; + __be16 protocol; + __be16 protocol_version; + __be16 service_conn; + __be16 initiators_supported; + __be16 send_queue_depth; + u8 reserved2; + u8 rdma_read_depth; + __be32 send_size; + __be32 rdma_size; + u8 op_cap_mask; + u8 svc_cap_mask; + u8 num_svc_entries; + u8 reserved3[9]; + u8 id_string[64]; +}; + +struct ib_dm_svc_entry { + u8 name[40]; + u64 id; +}; + +struct ib_dm_svc_entries { + struct ib_dm_svc_entry service_entries[4]; +}; + +#endif Added: trunk/srpt/src/ib_srpt.c =================================================================== --- trunk/srpt/src/ib_srpt.c (rev 0) +++ trunk/srpt/src/ib_srpt.c 2008-03-17 11:29:50 UTC (rev 304) @@ -0,0 +1,2317 @@ +/* + * Copyright (c) 2006 Mellanox Technology Inc. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include <linux/module.h> +#include <linux/init.h> +#include <linux/slab.h> +#include <linux/err.h> +#include <linux/string.h> +#include <linux/kthread.h> + +#include <asm/atomic.h> + +#include "ib_srpt.h" + +#define DRV_NAME "ib_srpt" +#define PFX DRV_NAME ": " +#define DRV_VERSION "0.1" +#define DRV_RELDATE "January 10, 2007" + +#define MELLANOX_SRPT_ID_STRING "Mellanox OFED SRP target" + +MODULE_AUTHOR("Vu Pham"); +MODULE_DESCRIPTION("InfiniBand SCSI RDMA Protocol target " + "v" DRV_VERSION " (" DRV_RELDATE ")"); +MODULE_LICENSE("Dual BSD/GPL"); + +struct srpt_thread { + spinlock_t thread_lock; + struct list_head thread_ioctx_list; + struct task_struct *thread; +}; + +static u64 mellanox_ioc_guid = 0; +static struct list_head srpt_devices; +static int thread = 1; +static struct srpt_thread srpt_thread; +DECLARE_WAIT_QUEUE_HEAD(ioctx_list_waitQ); + +module_param(thread, int, 0444); +MODULE_PARM_DESC(thread, + "Executing ioctx in thread context. Default thread = 1"); + +static void srpt_add_one(struct ib_device *device); +static void srpt_remove_one(struct ib_device *device); +static int srpt_disconnect_channel(struct srpt_rdma_ch *ch, int dreq); + +static struct ib_client srpt_client = { + .name = DRV_NAME, + .add = srpt_add_one, + .remove = srpt_remove_one +}; + +static void srpt_event_handler(struct ib_event_handler *handler, + struct ib_event *event) +{ + struct srpt_device *sdev = + ib_get_client_data(event->device, &srpt_client); + struct srpt_port *sport; + + if (!sdev || sdev->device != event->device) + return; + + printk(KERN_WARNING PFX "ASYNC event= %d on device= %s\n", + event->event, sdev->device->name); + + switch (event->event) { + case IB_EVENT_PORT_ERR: + if (event->element.port_num <= sdev->device->phys_port_cnt) { + sport = &sdev->port[event->element.port_num - 1]; + sport->lid = 0; + sport->sm_lid = 0; + } + break; + case IB_EVENT_PORT_ACTIVE: + case IB_EVENT_LID_CHANGE: + case IB_EVENT_PKEY_CHANGE: + case IB_EVENT_SM_CHANGE: + case IB_EVENT_CLIENT_REREGISTER: + if (event->element.port_num <= sdev->device->phys_port_cnt) { + sport = &sdev->port[event->element.port_num - 1]; + if (!sport->lid && !sport->sm_lid) + schedule_work(&sport->work); + } + break; + default: + break; + } + +} + +static void srpt_srq_event(struct ib_event *event, void *ctx) +{ + printk(KERN_WARNING PFX "SRQ event %d\n", event->event); +} + +static void srpt_qp_event(struct ib_event *event, void *ctx) +{ + struct srpt_rdma_ch *ch = ctx; + + printk(KERN_WARNING PFX "QP event %d on cm_id= %p sess_name= %s state= %d\n", + event->event, ch->cm_id, ch->sess_name, ch->state); + + switch (event->event) { + case IB_EVENT_COMM_EST: + ib_cm_notify(ch->cm_id, event->event); + break; + case IB_EVENT_QP_LAST_WQE_REACHED: + if (ch->state == RDMA_CHANNEL_LIVE) { + printk(KERN_WARNING PFX "Schedule CM_DISCONNECT_WORK\n"); + srpt_disconnect_channel(ch, 1); + } + break; + default: + break; + } +} + +static void srpt_set_ioc(u8 * c_list, u32 slot, u8 value) +{ + u16 id; + u8 tmp; + + id = (slot - 1) / 2; + if (slot & 0x1) { + tmp = c_list[id] & 0xf; + c_list[id] = (value << 4) | tmp; + } else { + tmp = c_list[id] & 0xf0; + c_list[id] = (value & 0xf) | tmp; + } +} + +static void srpt_get_class_port_info(struct ib_dm_mad *mad) +{ + struct ib_class_port_info *cif; + + cif = (struct ib_class_port_info *)mad->data; + memset(cif, 0, sizeof *cif); + cif->base_version = 1; + cif->class_version = 1; + cif->resp_time_value = 20; + + mad->mad_hdr.status = 0; +} + +static void srpt_get_iou(struct ib_dm_mad *mad) +{ + struct ib_dm_iou_info *ioui; + u8 slot; + int i; + + ioui = (struct ib_dm_iou_info *)mad->data; + ioui->change_id = 1; + ioui->max_controllers = 16; + + /* set present for slot 1 and empty for the rest */ + srpt_set_ioc(ioui->controller_list, 1, 1); + for (i = 1, slot = 2; i < 16; i++, slot++) + srpt_set_ioc(ioui->controller_list, slot, 0); + + mad->mad_hdr.status = 0; +} + +static void srpt_get_ioc(struct srpt_device *sdev, u32 slot, + struct ib_dm_mad *mad) +{ + struct ib_dm_ioc_profile *iocp; + + iocp = (struct ib_dm_ioc_profile *)mad->data; + + if (!slot || slot > 16) { + mad->mad_hdr.status = cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD); + return; + } + + if (slot > 2) { + mad->mad_hdr.status = cpu_to_be16(DM_MAD_STATUS_NO_IOC); + return; + } + + memset(iocp, 0, sizeof *iocp); + strcpy(iocp->id_string, MELLANOX_SRPT_ID_STRING); + iocp->guid = cpu_to_be64(mellanox_ioc_guid); + iocp->vendor_id = cpu_to_be32(sdev->dev_attr.vendor_id); + iocp->device_id = cpu_to_be32(sdev->dev_attr.vendor_part_id); + iocp->device_version = cpu_to_be16(sdev->dev_attr.hw_ver); + iocp->subsys_vendor_id = cpu_to_be32(sdev->dev_attr.vendor_id); + iocp->subsys_device_id = 0x0; + iocp->io_class = cpu_to_be16(SRP_REV16A_IB_IO_CLASS); + iocp->io_subclass = cpu_to_be16(SRP_IO_SUBCLASS); + iocp->protocol = cpu_to_be16(SRP_PROTOCOL); + iocp->protocol_version = cpu_to_be16(SRP_PROTOCOL_VERSION); + iocp->send_queue_depth = cpu_to_be16(SRPT_SRQ_SIZE); + iocp->rdma_read_depth = 4; + iocp->send_size = cpu_to_be32(MAX_MESSAGE_SIZE); + iocp->rdma_size = cpu_to_be32(MAX_RDMA_SIZE); + iocp->num_svc_entries = 1; + iocp->op_cap_mask = SRP_SEND_TO_IOC | SRP_SEND_FROM_IOC | + SRP_RDMA_READ_FROM_IOC | SRP_RDMA_WRITE_FROM_IOC; + + mad->mad_hdr.status = 0; +} + +static void srpt_get_svc_entries(u16 slot, u8 hi, u8 lo, struct ib_dm_mad *mad) +{ + struct ib_dm_svc_entries *svc_entries; + + if (!slot || slot > 16) { + mad->mad_hdr.status = cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD); + return; + } + + if (slot > 2 || lo > hi || hi > 1) { + mad->mad_hdr.status = cpu_to_be16(DM_MAD_STATUS_NO_IOC); + return; + } + + svc_entries = (struct ib_dm_svc_entries *)mad->data; + memset(svc_entries, 0, sizeof *svc_entries); + svc_entries->service_entries[0].id = cpu_to_be64(mellanox_ioc_guid); + sprintf(svc_entries->service_entries[0].name, "%s%016llx", + SRP_SERVICE_NAME_PREFIX, (unsigned long long)mellanox_ioc_guid); + + mad->mad_hdr.status = 0; +} + +static void srpt_mgmt_method_get(struct srpt_port *sp, struct ib_mad *rq_mad, + struct ib_dm_mad *rsp_mad) +{ + u16 attr_id; + u32 slot; + u8 hi, lo; + + attr_id = be16_to_cpu(rq_mad->mad_hdr.attr_id); + switch (attr_id) { + case DM_ATTR_CLASS_PORT_INFO: + srpt_get_class_port_info(rsp_mad); + break; + case DM_ATTR_IOU_INFO: + srpt_get_iou(rsp_mad); + break; + case DM_ATTR_IOC_PROFILE: + slot = be32_to_cpu(rq_mad->mad_hdr.attr_mod); + srpt_get_ioc(sp->sdev, slot, rsp_mad); + break; + case DM_ATTR_SVC_ENTRIES: + slot = be32_to_cpu(rq_mad->mad_hdr.attr_mod); + hi = (u8) ((slot >> 8) & 0xff); + lo = (u8) (slot & 0xff); + slot = (u16) ((slot >> 16) & 0xffff); + srpt_get_svc_entries(slot, hi, lo, rsp_mad); + break; + default: + rsp_mad->mad_hdr.status = + cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD_ATTR); + break; + } +} + +static void srpt_mad_send_handler(struct ib_mad_agent *mad_agent, + struct ib_mad_send_wc *mad_wc) +{ + ib_destroy_ah(mad_wc->send_buf->ah); + ib_free_send_mad(mad_wc->send_buf); +} + +static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent, + struct ib_mad_recv_wc *mad_wc) +{ + struct srpt_port *sport = (struct srpt_port *)mad_agent->context; + struct ib_ah *ah; + struct ib_mad_send_buf *rsp; + struct ib_dm_mad *dm_mad; + + if (!mad_wc || !mad_wc->recv_buf.mad) + return; + + ah = ib_create_ah_from_wc(mad_agent->qp->pd, mad_wc->wc, + mad_wc->recv_buf.grh, mad_agent->port_num); + if (IS_ERR(ah)) + goto err; + + rsp = ib_create_send_mad(mad_agent, mad_wc->wc->src_qp, + mad_wc->wc->pkey_index, 0, + IB_MGMT_DEVICE_HDR, IB_MGMT_DEVICE_DATA, + GFP_KERNEL); + if (IS_ERR(rsp)) + goto err_rsp; + + rsp->ah = ah; + + dm_mad = rsp->mad; + memcpy(dm_mad, mad_wc->recv_buf.mad, sizeof *dm_mad); + dm_mad->mad_hdr.method = IB_MGMT_METHOD_GET_RESP; + dm_mad->mad_hdr.status = 0; + + switch (mad_wc->recv_buf.mad->mad_hdr.method) { + case IB_MGMT_METHOD_GET: + srpt_mgmt_method_get(sport, mad_wc->recv_buf.mad, dm_mad); + break; + case IB_MGMT_METHOD_SET: + dm_mad->mad_hdr.status = + cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD_ATTR); + break; + default: + dm_mad->mad_hdr.status = + cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD); + break; + } + + if (!ib_post_send_mad(rsp, NULL)) { + ib_free_recv_mad(mad_wc); + /* will destroy_ah & free_send_mad in send completion */ + return; + } + + ib_free_send_mad(rsp); + + err_rsp: + ib_destroy_ah(ah); + err: + ib_free_recv_mad(mad_wc); +} + +static int srpt_refresh_port(struct srpt_port *sport) +{ + struct ib_mad_reg_req reg_req; + struct ib_port_modify port_modify; + struct ib_port_attr port_attr; + int ret; + + memset(&port_modify, 0, sizeof port_modify); + port_modify.set_port_cap_mask = IB_PORT_DEVICE_MGMT_SUP; + port_modify.clr_port_cap_mask = 0; + + ret = ib_modify_port(sport->sdev->device, sport->port, 0, &port_modify); + if (ret) + goto err_mod_port; + + ret = ib_query_port(sport->sdev->device, sport->port, &port_attr); + if (ret) + goto err_query_port; + + sport->sm_lid = port_attr.sm_lid; + sport->lid = port_attr.lid; + + ret = ib_query_gid(sport->sdev->device, sport->port, 0, &sport->gid); + if (ret) + goto err_query_port; + + if (!sport->mad_agent) { + memset(®_req, 0, sizeof reg_req); + reg_req.mgmt_class = IB_MGMT_CLASS_DEVICE_MGMT; + reg_req.mgmt_class_version = IB_MGMT_BASE_VERSION; + set_bit(IB_MGMT_METHOD_GET, reg_req.method_mask); + set_bit(IB_MGMT_METHOD_SET, reg_req.method_mask); + + sport->mad_agent = ib_register_mad_agent(sport->sdev->device, + sport->port, + IB_QPT_GSI, + ®_req, 0, + srpt_mad_send_handler, + srpt_mad_recv_handler, + sport); + if (IS_ERR(sport->mad_agent)) + goto err_query_port; + } + + return 0; + + err_query_port: + + port_modify.set_port_cap_mask = 0; + port_modify.clr_port_cap_mask = IB_PORT_DEVICE_MGMT_SUP; + ib_modify_port(sport->sdev->device, sport->port, 0, &port_modify); + + err_mod_port: + + return ret; +} + +static struct srpt_ioctx *srpt_alloc_ioctx(struct srpt_device *sdev) +{ + struct srpt_ioctx *ioctx; + + ioctx = kmalloc(sizeof *ioctx, GFP_KERNEL); + if (!ioctx) + goto out; + + ioctx->buf = kzalloc(MAX_MESSAGE_SIZE, GFP_KERNEL); + if (!ioctx->buf) + goto out_free_ioctx; + + ioctx->dma = dma_map_single(sdev->device->dma_device, ioctx->buf, + MAX_MESSAGE_SIZE, DMA_BIDIRECTIONAL); + if (dma_mapping_error(ioctx->dma)) + goto out_free_buf; + + return ioctx; + + out_free_buf: + kfree(ioctx->buf); + out_free_ioctx: + kfree(ioctx); + out: + return NULL; +} + +static void srpt_free_ioctx(struct srpt_device *sdev, struct srpt_ioctx *ioctx) +{ + if (!ioctx) + return; + + dma_unmap_single(sdev->device->dma_device, ioctx->dma, + MAX_MESSAGE_SIZE, DMA_BIDIRECTIONAL); + kfree(ioctx->buf); + kfree(ioctx); +} + +static int srpt_alloc_ioctx_ring(struct srpt_device *sdev) +{ + int i; + + for (i = 0; i < SRPT_SRQ_SIZE; ++i) { + sdev->ioctx_ring[i] = srpt_alloc_ioctx(sdev); + + if (!sdev->ioctx_ring[i]) + goto err; + + sdev->ioctx_ring[i]->index = i; + } + + return 0; + + err: + while (--i > 0) { + srpt_free_ioctx(sdev, sdev->ioctx_ring[i]); + sdev->ioctx_ring[i] = NULL; + } + return -ENOMEM; +} + +static int srpt_post_recv(struct srpt_device *sdev, struct srpt_ioctx *ioctx) +{ + struct ib_sge list; + struct ib_recv_wr wr, *bad_wr; + + wr.wr_id = ioctx->index | SRPT_OP_RECV; + + list.addr = ioctx->dma; + list.length = MAX_MESSAGE_SIZE; + list.lkey = sdev->mr->lkey; + + wr.next = NULL; + wr.sg_list = &list; + wr.num_sge = 1; + + return ib_post_srq_recv(sdev->srq, &wr, &bad_wr); +} + +static int srpt_post_send(struct srpt_rdma_ch *ch, struct srpt_ioctx *ioctx, + int len) +{ + struct ib_sge list; + struct ib_send_wr wr, *bad_wr; + struct srpt_device *sdev = ch->sport->sdev; + + dma_sync_single_for_device(sdev->device->dma_device, ioctx->dma, + MAX_MESSAGE_SIZE, DMA_TO_DEVICE); + + list.addr = ioctx->dma; + list.length = len; + list.lkey = sdev->mr->lkey; + + wr.next = NULL; + wr.wr_id = ioctx->index; + wr.sg_list = &list; + wr.num_sge = 1; + wr.opcode = IB_WR_SEND; + wr.send_flags = IB_SEND_SIGNALED; + + return ib_post_send(ch->qp, &wr, &bad_wr); +} + +static int srpt_get_desc_tbl(struct srpt_ioctx *ioctx, struct srp_cmd *srp_cmd, + int *ind) +{ + struct srp_indirect_buf *idb; + struct srp_direct_buf *db; + + *ind = 0; + if (((srp_cmd->buf_fmt & 0xf) == SRP_DATA_DESC_DIRECT) || + ((srp_cmd->buf_fmt >> 4) == SRP_DATA_DESC_DIRECT)) { + ioctx->n_rbuf = 1; + ioctx->rbufs = &ioctx->single_rbuf; + + db = (void *)srp_cmd->add_data; + memcpy(ioctx->rbufs, db, sizeof *db); + ioctx->data_len = be32_to_cpu(db->len); + } else { + idb = (void *)srp_cmd->add_data; + + ioctx->n_rbuf = be32_to_cpu(idb->table_desc.len) / sizeof *db; + + if (ioctx->n_rbuf > + (srp_cmd->data_out_desc_cnt + srp_cmd->data_in_desc_cnt)) { + *ind = 1; + ioctx->n_rbuf = 0; + goto out; + } + + if (ioctx->n_rbuf == 1) + ioctx->rbufs = &ioctx->single_rbuf; + else + ioctx->rbufs = kmalloc(ioctx->n_rbuf * sizeof *db, GFP_ATOMIC); + if (!ioctx->rbufs) { + ioctx->n_rbuf = 0; + return -ENOMEM; + } + + db = idb->desc_list; + memcpy(ioctx->rbufs, db, ioctx->n_rbuf * sizeof *db); + ioctx->data_len = be32_to_cpu(idb->len); + } + out: + return 0; +} + +static int srpt_init_ch_qp(struct srpt_rdma_ch *ch, struct ib_qp *qp) +{ + struct ib_qp_attr *attr; + int ret; + + attr = kzalloc(sizeof *attr, GFP_KERNEL); + if (!attr) + return -ENOMEM; + + attr->qp_state = IB_QPS_INIT; + attr->qp_access_flags = IB_ACCESS_LOCAL_WRITE | IB_ACCESS_REMOTE_READ | + IB_ACCESS_REMOTE_WRITE; + attr->port_num = ch->sport->port; + attr->pkey_index = 0; + + ret = ib_modify_qp(qp, attr, + IB_QP_STATE | IB_QP_ACCESS_FLAGS | IB_QP_PORT | + IB_QP_PKEY_INDEX); + + kfree(attr); + return ret; +} + +static int srpt_ch_qp_rtr_rts(struct srpt_rdma_ch *ch, struct ib_qp *qp, + enum ib_qp_state qp_state) +{ + struct ib_qp_attr *qp_attr; + int attr_mask; + int ret; + + qp_attr = kmalloc(sizeof *qp_attr, GFP_KERNEL); + if (!qp_attr) + return -ENOMEM; + + qp_attr->qp_state = qp_state; + ret = ib_cm_init_qp_attr(ch->cm_id, qp_attr, &attr_mask); + if (ret) + goto out; + + if (qp_state == IB_QPS_RTR) + qp_attr->max_dest_rd_atomic = 4; + else + qp_attr->max_rd_atomic = 4; + + ret = ib_modify_qp(qp, qp_attr, attr_mask); + + out: + kfree(qp_attr); + return ret; +} + +static void srpt_reset_ioctx(struct srpt_rdma_ch *ch, struct srpt_ioctx *ioctx) +{ + int i; + + if (ioctx->n_rdma_ius > 0 && ioctx->rdma_ius) { + struct rdma_iu *riu = ioctx->rdma_ius; + + for (i = 0; i < ioctx->n_rdma_ius; ++i, ++riu) { + if (riu->sge) + kfree(riu->sge); + } + kfree(ioctx->rdma_ius); + } + + if (ioctx->n_rbuf > 1 && ioctx->rbufs) + kfree(ioctx->rbufs); + + if (srpt_post_recv(ch->sport->sdev, ioctx)) + printk(KERN_ERR PFX "SRQ post_recv failed - this is serious\n"); + /* we should queue it back to free_ioctx queue */ + else + atomic_inc(&ch->req_lim_delta); +} + +static void srpt_handle_err_comp(struct srpt_rdma_ch *ch, struct ib_wc *wc) +{ + struct srpt_ioctx *ioctx; + struct srpt_device *sdev = ch->sport->sdev; + scst_data_direction dir = SCST_DATA_NONE; + + if (wc->wr_id & SRPT_OP_RECV) { + ioctx = sdev->ioctx_ring[wc->wr_id & ~SRPT_OP_RECV]; + printk(KERN_ERR PFX "This is serious - SRQ is in bad state\n"); + } else { + ioctx = sdev->ioctx_ring[wc->wr_id]; + + if (ioctx->scmnd) { + struct scst_cmd *scmnd = ioctx->scmnd; + + dir = scst_cmd_get_data_direction(scmnd); + + if (dir == SCST_DATA_NONE) + scst_tgt_cmd_done(scmnd); + else { + dma_unmap_sg(sdev->device->dma_device, + scst_cmd_get_sg(scmnd), + scst_cmd_get_sg_cnt(scmnd), + scst_to_tgt_dma_dir(dir)); + + if (scmnd->data_buf_tgt_alloc && + scmnd->data_buf_alloced) { + kfree(scmnd->sg); + scmnd->sg = NULL; + scmnd->sg_cnt = 0; + } + + if (scmnd->state == SCST_CMD_STATE_RDY_TO_XFER) + scst_rx_data(scmnd, + SCST_RX_STATUS_ERROR, + SCST_CONTEXT_THREAD); + else if (scmnd->state == SCST_CMD_STATE_XMIT_WAIT) + scst_tgt_cmd_done(scmnd); + } + } else + srpt_reset_ioctx(ch, ioctx); + } + +} + +static void srpt_handle_send_comp(struct srpt_rdma_ch *ch, + struct srpt_ioctx *ioctx) +{ + if (ioctx->scmnd) { + scst_data_direction dir = scst_cmd_get_data_direction(ioctx->scmnd); + + if (dir != SCST_DATA_NONE) + dma_unmap_sg(ch->sport->sdev->device->dma_device, + scst_cmd_get_sg(ioctx->scmnd), + scst_cmd_get_sg_cnt(ioctx->scmnd), + scst_to_tgt_dma_dir(dir)); + + if (ioctx->scmnd->data_buf_tgt_alloc && + ioctx->scmnd->data_buf_alloced) { + kfree(ioctx->scmnd->sg); + ioctx->scmnd->sg = NULL; + ioctx->scmnd->sg_cnt = 0; + } + + scst_tgt_cmd_done(ioctx->scmnd); + } else + srpt_reset_ioctx(ch, ioctx); +} + +static void srpt_handle_rdma_comp(struct srpt_rdma_ch *ch, + struct srpt_ioctx *ioctx) +{ + if (!ioctx->scmnd) { + srpt_reset_ioctx(ch, ioctx); + return; + } + + if (scst_cmd_get_data_direction(ioctx->scmnd) == SCST_DATA_WRITE) + scst_rx_data(ioctx->scmnd, SCST_RX_STATUS_SUCCESS, + SCST_CONTEXT_THREAD); +} + +static void srpt_build_cmd_rsp(struct srpt_rdma_ch *ch, + struct srpt_ioctx *ioctx, u8 s_key, u8 s_code, + u64 tag) +{ + struct srp_rsp *srp_rsp; + struct sense_data *sense; + int limit_delta; + + srp_rsp = ioctx->buf; + memset(srp_rsp, 0, sizeof *srp_rsp); + + limit_delta = atomic_read(&ch->req_lim_delta); + atomic_sub(limit_delta, &ch->req_lim_delta); + + srp_rsp->opcode = SRP_RSP; + srp_rsp->req_lim_delta = cpu_to_be32(limit_delta); + srp_rsp->tag = tag; + + if (s_key != NO_SENSE) { + srp_rsp->flags |= SRP_RSP_FLAG_SNSVALID; + srp_rsp->status = SAM_STAT_CHECK_CONDITION; + srp_rsp->sense_data_len = + cpu_to_be32(sizeof *sense + (sizeof *sense % 4)); + + sense = (struct sense_data *)(srp_rsp + 1); + sense->err_code = 0x70; + sense->key = s_key; + sense->asc_ascq = s_code; + } +} + +static void srpt_build_tskmgmt_rsp(struct srpt_rdma_ch *ch, + struct srpt_ioctx *ioctx, u8 rsp_code, + u64 tag) +{ + struct srp_rsp *srp_rsp; + int limit_delta; + + dma_sync_single_for_cpu(ch->sport->sdev->device->dma_device, ioctx->dma, + MAX_MESSAGE_SIZE, DMA_TO_DEVICE); + + srp_rsp = ioctx->buf; + memset(srp_rsp, 0, sizeof *srp_rsp); + + limit_delta = atomic_read(&ch->req_lim_delta); + atomic_sub(limit_delta, &ch->req_lim_delta); + + srp_rsp->opcode = SRP_RSP; + srp_rsp->req_lim_delta = cpu_to_be32(limit_delta); + srp_rsp->tag = tag; + + if (rsp_code != SRP_TSK_MGMT_SUCCESS) { + srp_rsp->flags |= SRP_RSP_FLAG_RSPVALID; + srp_rsp->resp_data_len = cpu_to_be32(4); + srp_rsp->data[3] = rsp_code; + } +} + +static void srpt_handle_new_iu(struct srpt_rdma_ch *ch, + struct srpt_ioctx *ioctx) +{ + struct scst_cmd *scmnd = NULL; + struct srp_cmd *srp_cmd = NULL; + struct srp_tsk_mgmt *srp_tsk = NULL; + struct srpt_mgmt_ioctx *mgmt_ioctx; + scst_data_direction dir = SCST_DATA_NONE; + int indirect_desc = 0; + u8 op; + int ret; + + if (ch->state != RDMA_CHANNEL_LIVE) { + if (ch->state == RDMA_CHANNEL_CONNECTING) { + spin_lock_irq(&ch->spinlock); + list_add_tail(&ioctx->wait_list, &ch->cmd_wait_list); + spin_unlock_irq(&ch->spinlock); + } else + srpt_reset_ioctx(ch, ioctx); + + return; + } + + dma_sync_single_for_cpu(ch->sport->sdev->device->dma_device, ioctx->dma, + MAX_MESSAGE_SIZE, DMA_FROM_DEVICE); + + ioctx->data_len = 0; + ioctx->n_rbuf = 0; + ioctx->rbufs = NULL; + ioctx->n_rdma = 0; + ioctx->n_rdma_ius = 0; + ioctx->rdma_ius = NULL; + ioctx->scmnd = NULL; + + op = *(u8 *) ioctx->buf; + switch (op) { + case SRP_CMD: + srp_cmd = ioctx->buf; + + if (srp_cmd->buf_fmt) { + ret = srpt_get_desc_tbl(ioctx, srp_cmd, &indirect_desc); + if (ret) { + srpt_build_cmd_rsp(ch, ioctx, NO_SENSE, + NO_ADD_SENSE, srp_cmd->tag); + ((struct srp_rsp*)ioctx->buf)->status = + SAM_STAT_TASK_SET_FULL; + goto send_rsp; + } + + if (indirect_desc) { + srpt_build_cmd_rsp(ch, ioctx, NO_SENSE, + NO_ADD_SENSE, srp_cmd->tag); + ((struct srp_rsp*)ioctx->buf)->status = + SAM_STAT_TASK_SET_FULL; + goto send_rsp; + } + + if (srp_cmd->buf_fmt & 0xf) + dir = SCST_DATA_READ; + else if (srp_cmd->buf_fmt >> 4) + dir = SCST_DATA_WRITE; + else + dir = SCST_DATA_NONE; + } else + dir = SCST_DATA_NONE; + + scmnd = scst_rx_cmd(ch->scst_sess, (u8 *) & srp_cmd->lun, + sizeof srp_cmd->lun, srp_cmd->cdb, 16, + thread ? SCST_NON_ATOMIC : SCST_ATOMIC); + if (!scmnd) { + srpt_build_cmd_rsp(ch, ioctx, NO_SENSE, + NO_ADD_SENSE, srp_cmd->tag); + ((struct srp_rsp*)ioctx->buf)->status = + SAM_STAT_TASK_SET_FULL; + goto send_rsp; + } + + ioctx->scmnd = scmnd; + + switch (srp_cmd->task_attr) { + case SRP_CMD_HEAD_OF_Q: + scmnd->queue_type = SCST_CMD_QUEUE_HEAD_OF_QUEUE; + break; + case SRP_CMD_ORDERED_Q: + scmnd->queue_type = SCST_CMD_QUEUE_ORDERED; + break; + case SRP_CMD_SIMPLE_Q: + scmnd->queue_type = SCST_CMD_QUEUE_SIMPLE; + break; + case SRP_CMD_ACA: + scmnd->queue_type = SCST_CMD_QUEUE_ACA; + break; + default: + scmnd->queue_type = SCST_CMD_QUEUE_ORDERED; + break; + } + + scst_cmd_set_tag(scmnd, srp_cmd->tag); + scst_cmd_set_tgt_priv(scmnd, ioctx); + scst_cmd_set_expected(scmnd, dir, ioctx->data_len); + + spin_lock_irq(&ch->spinlock); + list_add_tail(&ioctx->scmnd_list, &ch->active_scmnd_list); + ch->active_scmnd_cnt++; + scst_cmd_init_done(scmnd, SCST_CONTEXT_THREAD); + spin_unlock_irq(&ch->spinlock); + + break; + + case SRP_TSK_MGMT: + srp_tsk = ioctx->buf; + + printk(KERN_WARNING PFX + "recv_tsk_mgmt= %d for task_tag= %lld" + " using tag= %lld cm_id= %p sess= %p\n", + srp_tsk->tsk_mgmt_func, + (unsigned long long) srp_tsk->task_tag, + (unsigned long long) srp_tsk->tag, + ch->cm_id, ch->scst_sess); + + mgmt_ioctx = kmalloc(sizeof *mgmt_ioctx, GFP_ATOMIC); + if (!mgmt_ioctx) { + srpt_build_tskmgmt_rsp(ch, ioctx, SRP_TSK_MGMT_FAILED, + srp_tsk->tag); + goto send_rsp; + } + + mgmt_ioctx->ioctx = ioctx; + mgmt_ioctx->ch = ch; + mgmt_ioctx->tag = srp_tsk->tag; + + switch (srp_tsk->tsk_mgmt_func) { + case SRP_TSK_ABORT_TASK: + ret = scst_rx_mgmt_fn_tag(ch->scst_sess, + SCST_ABORT_TASK, + srp_tsk->task_tag, + thread ? SCST_NON_ATOMIC : SCST_ATOMIC, + mgmt_ioctx); + break; + case SRP_TSK_ABORT_TASK_SET: + ret = scst_rx_mgmt_fn_lun(ch->scst_sess, + SCST_ABORT_TASK_SET, + (u8 *) & srp_tsk->lun, + sizeof srp_tsk->lun, + thread ? SCST_NON_ATOMIC : SCST_ATOMIC, + mgmt_ioctx); + break; + case SRP_TSK_CLEAR_TASK_SET: + ret = scst_rx_mgmt_fn_lun(ch->scst_sess, + SCST_CLEAR_TASK_SET, + (u8 *) & srp_tsk->lun, + sizeof srp_tsk->lun, + thread ? SCST_NON_ATOMIC : SCST_ATOMIC, + mgmt_ioctx); + break; +#if 0 + case SRP_TSK_LUN_RESET: + ret = scst_rx_mgmt_fn_lun(ch->scst_sess, + SCST_LUN_RESET, + (u8 *) & srp_tsk->lun, + sizeof srp_tsk->lun, + thread ? SCST_NON_ATOMIC : SCST_ATOMIC, + mgmt_ioctx); + break; +#endif + case SRP_TSK_CLEAR_ACA: + ret = scst_rx_mgmt_fn_lun(ch->scst_sess, + SCST_CLEAR_ACA, + (u8 *) & srp_tsk->lun, + sizeof srp_tsk->lun, + thread ? SCST_NON_ATOMIC : SCST_ATOMIC, + mgmt_ioctx); + break; + default: + srpt_build_tskmgmt_rsp(ch, ioctx, + SRP_TSK_MGMT_FUNC_NOT_SUPP, + srp_tsk->tag); + goto send_rsp; + } + + break; + case SRP_I_LOGOUT: + case SRP_AER_REQ: + default: + srpt_build_cmd_rsp(ch, ioctx, ILLEGAL_REQUEST, INVALID_CDB, + ((struct srp_cmd *)ioctx->buf)->tag); + + goto send_rsp; + } + + dma_sync_single_for_device(ch->sport->sdev->device->dma_device, + ioctx->dma, MAX_MESSAGE_SIZE, + DMA_FROM_DEVICE); + + return; + + send_rsp: + if (ch->state != RDMA_CHANNEL_LIVE || + srpt_post_send(ch, ioctx, + sizeof(struct srp_rsp) + + be32_to_cpu(((struct srp_rsp *)ioctx->buf)-> + sense_data_len))) + srpt_reset_ioctx(ch, ioctx); +} + +static inline int srpt_test_ioctx_list(void) +{ + int res = (!list_empty(&srpt_thread.thread_ioctx_list) || + unlikely(kthread_should_stop())); + return res; +} + +static inline void srpt_schedule_thread(struct srpt_ioctx *ioctx) +{ + unsigned long flags; + + spin_lock_irqsave(&srpt_thread.thread_lock, flags); + list_add_tail(&ioctx->comp_list, &srpt_thread.thread_ioctx_list); + spin_unlock_irqrestore(&srpt_thread.thread_lock, flags); + wake_up(&ioctx_list_waitQ); +} + +static void srpt_completion(struct ib_cq *cq, void *ctx) +{ + struct srpt_rdma_ch *ch = ctx; + struct srpt_device *sdev = ch->sport->sdev; + struct ib_wc wc; + struct srpt_ioctx *ioctx; + + ib_req_notify_cq(ch->cq, IB_CQ_NEXT_COMP); + while (ib_poll_cq(ch->cq, 1, &wc) > 0) { + if (wc.status) { + printk(KERN_ERR PFX "failed %s status= %d\n", + wc.wr_id & SRPT_OP_RECV ? "receive" : "send", + wc.status); + srpt_handle_err_comp(ch, &wc); + break; + } + + if (wc.wr_id & SRPT_OP_RECV) { + ioctx = sdev->ioctx_ring[wc.wr_id & ~SRPT_OP_RECV]; + if (thread) { + ioctx->ch = ch; + ioctx->op = IB_WC_RECV; + srpt_schedule_thread(ioctx); + } else + srpt_handle_new_iu(ch, ioctx); + continue; + } else + ioctx = sdev->ioctx_ring[wc.wr_id]; + + if (thread) { + ioctx->ch = ch; + ioctx->op = wc.opcode; + srpt_schedule_thread(ioctx); + } else { + switch (wc.opcode) { + case IB_WC_SEND: + srpt_handle_send_comp(ch, ioctx); + break; + case IB_WC_RDMA_WRITE: + case IB_WC_RDMA_READ: + srpt_handle_rdma_comp(ch, ioctx); + break; + default: + break; + } + } + } +} + +static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) +{ + struct ib_qp_init_attr *qp_init; + struct srpt_device *sdev = ch->sport->sdev; + int cqe; + int ret; + + qp_init = kzalloc(sizeof *qp_init, GFP_KERNEL); + if (!qp_init) + return -ENOMEM; + + cqe = SRPT_RQ_SIZE + SRPT_SQ_SIZE - 1; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) + ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, cqe); +#else + ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, cqe, 0); +#endif + if (IS_ERR(ch->cq)) { + ret = PTR_ERR(ch->cq); + printk(KERN_ERR PFX "failed to create_cq cqe= %d ret= %d\n", + cqe, ret); + goto out; + } + + ib_req_notify_cq(ch->cq, IB_CQ_NEXT_COMP); + + qp_init->qp_context = (void *)ch; + qp_init->event_handler = srpt_qp_event; + qp_init->send_cq = ch->cq; + qp_init->recv_cq = ch->cq; + qp_init->srq = sdev->srq; + qp_init->sq_sig_type = IB_SIGNAL_REQ_WR; + qp_init->qp_type = IB_QPT_RC; + qp_init->cap.max_send_wr = SRPT_SQ_SIZE; + qp_init->cap.max_send_sge = SRPT_DEF_SG_PER_WQE; + + ch->qp = ib_create_qp(sdev->pd, qp_init); + if (IS_ERR(ch->qp)) { + ret = PTR_ERR(ch->qp); + ib_destroy_cq(ch->cq); + printk(KERN_ERR PFX "failed to create_qp ret= %d\n", ret); + goto out; + } + + printk(KERN_DEBUG PFX "%s[%d] max_cqe= %d max_sge= %d cm_id= %p\n", + __FUNCTION__, __LINE__, ch->cq->cqe, qp_init->cap.max_send_sge, + ch->cm_id); + + ret = srpt_init_ch_qp(ch, ch->qp); + if (ret) { + ib_destroy_qp(ch->qp); + ib_destroy_cq(ch->cq); + goto out; + } + + atomic_set(&ch->req_lim_delta, SRPT_RQ_SIZE); + out: + kfree(qp_init); + return ret; +} + +static struct srpt_rdma_ch *srpt_find_channel(struct ib_cm_id *cm_id) +{ + struct srpt_device *sdev = cm_id->context; + struct srpt_rdma_ch *ch, *tmp_ch; + + spin_lock_irq(&sdev->spinlock); + list_for_each_entry_safe(ch, tmp_ch, &sdev->rch_list, list) { + if (ch->cm_id == cm_id) { + spin_unlock_irq(&sdev->spinlock); + return ch; + } + } + + spin_unlock_irq(&sdev->spinlock); + + return NULL; +} + +static int srpt_release_channel(struct srpt_rdma_ch *ch, int destroy_cmid) +{ + spin_lock_irq(&ch->sport->sdev->spinlock); + list_del(&ch->list); + spin_unlock_irq(&ch->sport->sdev->spinlock); + + if (ch->cm_id && destroy_cmid) { + printk(KERN_WARNING PFX + "%s Destroy cm_id= %p\n", __FUNCTION__, ch->cm_id); + ib_destroy_cm_id(ch->cm_id); + ch->cm_id = NULL; + } + + ib_destroy_qp(ch->qp); + ib_destroy_cq(ch->cq); + + if (ch->scst_sess) { + struct srpt_ioctx *ioctx, *ioctx_tmp; + + printk(KERN_WARNING PFX + "%s: Release sess= %p sess_name= %s active_cmd= %d\n", + __FUNCTION__, ch->scst_sess, ch->sess_name, + ch->active_scmnd_cnt); + + list_for_each_entry_safe(ioctx, ioctx_tmp, + &ch->active_scmnd_list, scmnd_list) { + list_del(&ioctx->scmnd_list); + ch->active_scmnd_cnt--; + } + + scst_unregister_session(ch->scst_sess, 0, NULL); + ch->scst_sess = NULL; + } + + kfree(ch); + + return (destroy_cmid ? 0 : 1); +} + +static void srpt_register_channel_done(struct scst_session *scst_sess, + void *data, int status) +{ + struct srpt_rdma_ch *ch = data; + + BUG_ON(!ch); + + if (status) { + if (ch->scst_sess) { + scst_unregister_session(ch->scst_sess, 0, NULL); + ch->scst_sess = NULL; + } + printk(KERN_ERR PFX + "%s[%d] Failed to establish sess= %p status= %d\n", + __FUNCTION__, __LINE__, scst_sess, status); + } + + complete(&ch->scst_sess_done); +} + +static int srpt_disconnect_channel(struct srpt_rdma_ch *ch, int dreq) +{ + spin_lock_irq(&ch->spinlock); + ch->state = RDMA_CHANNEL_DISCONNECTING; + spin_unlock_irq(&ch->spinlock); + + if (dreq) + ib_send_cm_dreq(ch->cm_id, NULL, 0); + else + ib_send_cm_drep(ch->cm_id, NULL, 0); + + return 0; +} + +static int srpt_cm_req_recv(struct ib_cm_id *cm_id, + struct ib_cm_req_event_param *param, + void *private_data) +{ + struct srpt_device *sdev = cm_id->context; + struct srp_login_req *req; + struct srp_login_rsp *rsp; + struct srp_login_rej *rej; + struct ib_cm_rep_param *rep_param; + struct srpt_rdma_ch *ch, *tmp_ch; + u32 it_iu_len; + int ret = 0; + + if (!sdev || !private_data) + return -EINVAL; + + rsp = kzalloc(sizeof *rsp, GFP_KERNEL); + rej = kzalloc(sizeof *rej, GFP_KERNEL); + rep_param = kzalloc(sizeof *rep_param, GFP_KERNEL); + + if (!rsp || !rej || !rep_param) { + ret = -ENOMEM; + goto out; + } + + req = (struct srp_login_req *)private_data; + + it_iu_len = be32_to_cpu(req->req_it_iu_len); + + printk(KERN_ERR PFX + "Host login i_port_id=0x%llx:0x%llx t_port_id=0x%llx:0x%llx" + " it_iu_len=%d\n", + (unsigned long long)be64_to_cpu(*(u64 *)&req->initiator_port_id[0]), + (unsigned long long)be64_to_cpu(*(u64 *)&req->initiator_port_id[8]), + (unsigned long long)be64_to_cpu(*(u64 *)&req->target_port_id[0]), + (unsigned long long)be64_to_cpu(*(u64 *)&req->target_port_id[8]), it_iu_len); + + if (it_iu_len > MAX_MESSAGE_SIZE || it_iu_len < 64) { + rej->reason = + cpu_to_be32(SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE); + ret = -EINVAL; + printk(KERN_WARNING PFX + "Reject invalid it_iu_len=%d\n", it_iu_len); + goto reject; + } + + if ((req->req_flags & 0x3) == SRP_MULTICHAN_SINGLE) { + rsp->rsp_flags = SRP_LOGIN_RSP_MULTICHAN_NO_CHAN; + + spin_lock_irq(&sdev->spinlock); + + list_for_each_entry_safe(ch, tmp_ch, &sdev->rch_list, list) { + if (!memcmp(ch->i_port_id, req->initiator_port_id, 16) + && !memcmp(ch->t_port_id, req->target_port_id, 16) + && param->port == ch->sport->port + && param->listen_id == ch->sport->sdev->cm_id + && ch->cm_id) { + /* found an existing channel */ + printk(KERN_WARNING PFX + "Found existing channel name= %s" + " cm_id= %p state= %d\n", + ch->sess_name, ch->cm_id, ch->state); + + spin_unlock_irq(&sdev->spinlock); + + rsp->rsp_flags = + SRP_LOGIN_RSP_MULTICHAN_TERMINATED; + + if (ch->state == RDMA_CHANNEL_LIVE) + srpt_disconnect_channel(ch, 1); + else if (ch->state == RDMA_CHANNEL_CONNECTING) { + ib_send_cm_rej(ch->cm_id, + IB_CM_REJ_NO_RESOURCES, + NULL, 0, NULL, 0); + srpt_release_channel(ch, 1); + } + + spin_lock_irq(&sdev->spinlock); + } + } + + spin_unlock_irq(&sdev->spinlock); + + } else + rsp->rsp_flags = SRP_LOGIN_RSP_MULTICHAN_MAINTAINED; + + if (((u64) (*(u64 *) req->target_port_id) != + cpu_to_be64(mellanox_ioc_guid)) || + ((u64) (*(u64 *) (req->target_port_id + 8)) != + cpu_to_be64(mellanox_ioc_guid))) { + rej->reason = + cpu_to_be32(SRP_LOGIN_REJ_UNABLE_ASSOCIATE_CHANNEL); + ret = -ENOMEM; + printk(KERN_WARNING PFX "Reject invalid target_port_id\n"); + goto reject; + } + + ch = kzalloc(sizeof *ch, GFP_KERNEL); + if (!ch) { + rej->reason = cpu_to_be32(SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); + printk(KERN_WARNING PFX "Reject failed allocate rdma_ch\n"); + ret = -ENOMEM; + goto reject; + } + + spin_lock_init(&ch->spinlock); + memcpy(ch->i_port_id, req->initiator_port_id, 16)... [truncated message content] |
From: <vl...@us...> - 2008-04-18 16:39:03
|
Revision: 338 http://scst.svn.sourceforge.net/scst/?rev=338&view=rev Author: vlnb Date: 2008-04-18 09:38:39 -0700 (Fri, 18 Apr 2008) Log Message: ----------- Update for 2.6.25 Modified Paths: -------------- trunk/qla2x00t/qla_dbg.c trunk/qla2x00t/qla_gbl.h trunk/qla2x00t/qla_iocb.c trunk/qla2x00t/qla_isr.c trunk/qla2x00t/qla_os.c trunk/scst/src/dev_handlers/scst_changer.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 Property Changed: ---------------- trunk/ trunk/doc/ trunk/iscsi-scst/ trunk/iscsi-scst/doc/ trunk/iscsi-scst/doc/manpages/ trunk/iscsi-scst/etc/ trunk/iscsi-scst/etc/initd/ trunk/iscsi-scst/include/ trunk/iscsi-scst/kernel/ trunk/iscsi-scst/kernel/patches/ trunk/iscsi-scst/usr/ trunk/mpt/ trunk/mpt/in-tree/ trunk/qla2x00t/ trunk/qla2x00t/qla2x00-target/ trunk/qla_isp/ trunk/qla_isp/common/ trunk/qla_isp/doc/ trunk/qla_isp/firmware/ trunk/qla_isp/linux/ trunk/qla_isp/linux-2.6/ trunk/qla_isp/linux-2.6/build/ trunk/scst/ trunk/scst/include/ trunk/scst/kernel/ trunk/scst/kernel/in-tree/ trunk/scst/kernel/old_unsupported/ trunk/scst/src/ trunk/scst/src/dev_handlers/ trunk/scstadmin/ trunk/scstadmin/SCST/ trunk/scstadmin/examples/ trunk/scstadmin/init.d/ trunk/scstadmin/scst_db/ trunk/srpt/ trunk/srpt/patches/ trunk/srpt/src/ trunk/usr/ trunk/usr/fileio/ trunk/www/ Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/doc ___________________________________________________________________ Name: svn:ignore - *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/iscsi-scst ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/iscsi-scst/doc ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/iscsi-scst/doc/manpages ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/iscsi-scst/etc ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/iscsi-scst/etc/initd ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/iscsi-scst/include ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/iscsi-scst/kernel ___________________________________________________________________ Name: svn:ignore - *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/iscsi-scst/kernel/patches ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/iscsi-scst/usr ___________________________________________________________________ Name: svn:ignore - *.o .depend* iscsi-scst-adm iscsi-scstd + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/mpt ___________________________________________________________________ Name: svn:ignore - *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/mpt/in-tree ___________________________________________________________________ Name: svn:ignore - *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/qla2x00t ___________________________________________________________________ Name: svn:ignore - *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/qla2x00t/qla2x00-target ___________________________________________________________________ Name: svn:ignore - *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Modified: trunk/qla2x00t/qla_dbg.c =================================================================== --- trunk/qla2x00t/qla_dbg.c 2008-04-17 17:35:37 UTC (rev 337) +++ trunk/qla2x00t/qla_dbg.c 2008-04-18 16:38:39 UTC (rev 338) @@ -1999,9 +1999,9 @@ printk("0x%02x ", cmd->cmnd[i]); } printk("\n seg_cnt=%d, allowed=%d, retries=%d\n", - cmd->use_sg, cmd->allowed, cmd->retries); + scsi_sg_count(cmd), cmd->allowed, cmd->retries); printk(" request buffer=0x%p, request buffer len=0x%x\n", - cmd->request_buffer, cmd->request_bufflen); + scsi_sglist(cmd), scsi_bufflen(cmd)); printk(" tag=%d, transfersize=0x%x\n", cmd->tag, cmd->transfersize); printk(" serial_number=%lx, SP=%p\n", cmd->serial_number, sp); Modified: trunk/qla2x00t/qla_gbl.h =================================================================== --- trunk/qla2x00t/qla_gbl.h 2008-04-17 17:35:37 UTC (rev 337) +++ trunk/qla2x00t/qla_gbl.h 2008-04-18 16:38:39 UTC (rev 338) @@ -319,4 +319,27 @@ extern void qla2x00_init_host_attr(scsi_qla_host_t *); extern void qla2x00_alloc_sysfs_attr(scsi_qla_host_t *); extern void qla2x00_free_sysfs_attr(scsi_qla_host_t *); + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) +static inline void scsi_set_resid(struct scsi_cmnd *cmd, int resid) +{ + cmd->resid = resid; +} + +static inline struct scatterlist *scsi_sglist(struct scsi_cmnd *cmd) +{ + return (struct scatterlist *)cmd->request_buffer; +} + +static inline unsigned scsi_bufflen(struct scsi_cmnd *cmd) +{ + return cmd->request_bufflen; +} + +static inline unsigned scsi_sg_count(struct scsi_cmnd *cmd) +{ + return cmd->use_sg; +} +#endif + #endif /* _QLA_GBL_H */ Modified: trunk/qla2x00t/qla_iocb.c =================================================================== --- trunk/qla2x00t/qla_iocb.c 2008-04-17 17:35:37 UTC (rev 337) +++ trunk/qla2x00t/qla_iocb.c 2008-04-18 16:38:39 UTC (rev 338) @@ -162,7 +162,7 @@ __constant_cpu_to_le32(COMMAND_TYPE); /* No data transfer */ - if (cmd->request_bufflen == 0 || cmd->sc_data_direction == DMA_NONE) { + if (scsi_bufflen(cmd) == 0 || cmd->sc_data_direction == DMA_NONE) { cmd_pkt->byte_count = __constant_cpu_to_le32(0); return; } @@ -176,11 +176,11 @@ cur_dsd = (uint32_t *)&cmd_pkt->dseg_0_address; /* Load data segments */ - if (cmd->use_sg != 0) { + if (scsi_sg_count(cmd) != 0) { struct scatterlist *cur_seg; struct scatterlist *end_seg; - cur_seg = (struct scatterlist *)cmd->request_buffer; + cur_seg = scsi_sglist(cmd); end_seg = cur_seg + tot_dsds; while (cur_seg < end_seg) { cont_entry_t *cont_pkt; @@ -204,7 +204,7 @@ } } else { *cur_dsd++ = cpu_to_le32(sp->dma_handle); - *cur_dsd++ = cpu_to_le32(cmd->request_bufflen); + *cur_dsd++ = cpu_to_le32(scsi_bufflen(cmd)); } } @@ -231,7 +231,7 @@ __constant_cpu_to_le32(COMMAND_A64_TYPE); /* No data transfer */ - if (cmd->request_bufflen == 0 || cmd->sc_data_direction == DMA_NONE) { + if (scsi_bufflen(cmd) == 0 || cmd->sc_data_direction == DMA_NONE) { cmd_pkt->byte_count = __constant_cpu_to_le32(0); return; } @@ -245,11 +245,11 @@ cur_dsd = (uint32_t *)&cmd_pkt->dseg_0_address; /* Load data segments */ - if (cmd->use_sg != 0) { + if (scsi_sg_count(cmd) != 0) { struct scatterlist *cur_seg; struct scatterlist *end_seg; - cur_seg = (struct scatterlist *)cmd->request_buffer; + cur_seg = scsi_sglist(cmd); end_seg = cur_seg + tot_dsds; while (cur_seg < end_seg) { dma_addr_t sle_dma; @@ -277,7 +277,7 @@ } else { *cur_dsd++ = cpu_to_le32(LSD(sp->dma_handle)); *cur_dsd++ = cpu_to_le32(MSD(sp->dma_handle)); - *cur_dsd++ = cpu_to_le32(cmd->request_bufflen); + *cur_dsd++ = cpu_to_le32(scsi_bufflen(cmd)); } } @@ -336,17 +336,17 @@ goto queuing_error; /* Map the sg table so we have an accurate count of sg entries needed */ - if (cmd->use_sg) { - sg = (struct scatterlist *) cmd->request_buffer; - tot_dsds = pci_map_sg(ha->pdev, sg, cmd->use_sg, + if (scsi_sg_count(cmd)) { + sg = scsi_sglist(cmd); + tot_dsds = pci_map_sg(ha->pdev, sg, scsi_sg_count(cmd), cmd->sc_data_direction); if (tot_dsds == 0) goto queuing_error; - } else if (cmd->request_bufflen) { + } else if (scsi_bufflen(cmd)) { dma_addr_t req_dma; - req_dma = pci_map_single(ha->pdev, cmd->request_buffer, - cmd->request_bufflen, cmd->sc_data_direction); + req_dma = pci_map_single(ha->pdev, scsi_sglist(cmd), + scsi_bufflen(cmd), cmd->sc_data_direction); if (dma_mapping_error(req_dma)) goto queuing_error; @@ -390,7 +390,7 @@ /* Load SCSI command packet. */ memcpy(cmd_pkt->scsi_cdb, cmd->cmnd, cmd->cmd_len); - cmd_pkt->byte_count = cpu_to_le32((uint32_t)cmd->request_bufflen); + cmd_pkt->byte_count = cpu_to_le32((uint32_t)scsi_bufflen(cmd)); /* Build IOCB segments */ ha->isp_ops.build_iocbs(sp, cmd_pkt, tot_dsds); @@ -427,13 +427,13 @@ return (QLA_SUCCESS); queuing_error: - if (cmd->use_sg && tot_dsds) { - sg = (struct scatterlist *) cmd->request_buffer; - pci_unmap_sg(ha->pdev, sg, cmd->use_sg, + if (scsi_sg_count(cmd) && tot_dsds) { + sg = scsi_sglist(cmd); + pci_unmap_sg(ha->pdev, sg, scsi_sg_count(cmd), cmd->sc_data_direction); } else if (tot_dsds) { pci_unmap_single(ha->pdev, sp->dma_handle, - cmd->request_bufflen, cmd->sc_data_direction); + scsi_bufflen(cmd), cmd->sc_data_direction); } spin_unlock_irqrestore(&ha->hardware_lock, flags); @@ -653,7 +653,7 @@ __constant_cpu_to_le32(COMMAND_TYPE_7); /* No data transfer */ - if (cmd->request_bufflen == 0 || cmd->sc_data_direction == DMA_NONE) { + if (scsi_bufflen(cmd) == 0 || cmd->sc_data_direction == DMA_NONE) { cmd_pkt->byte_count = __constant_cpu_to_le32(0); return; } @@ -673,11 +673,11 @@ cur_dsd = (uint32_t *)&cmd_pkt->dseg_0_address; /* Load data segments */ - if (cmd->use_sg != 0) { + if (scsi_sg_count(cmd) != 0) { struct scatterlist *cur_seg; struct scatterlist *end_seg; - cur_seg = (struct scatterlist *)cmd->request_buffer; + cur_seg = scsi_sglist(cmd); end_seg = cur_seg + tot_dsds; while (cur_seg < end_seg) { dma_addr_t sle_dma; @@ -705,7 +705,7 @@ } else { *cur_dsd++ = cpu_to_le32(LSD(sp->dma_handle)); *cur_dsd++ = cpu_to_le32(MSD(sp->dma_handle)); - *cur_dsd++ = cpu_to_le32(cmd->request_bufflen); + *cur_dsd++ = cpu_to_le32(scsi_bufflen(cmd)); } } @@ -765,17 +765,17 @@ goto queuing_error; /* Map the sg table so we have an accurate count of sg entries needed */ - if (cmd->use_sg) { - sg = (struct scatterlist *) cmd->request_buffer; - tot_dsds = pci_map_sg(ha->pdev, sg, cmd->use_sg, + if (scsi_sg_count(cmd)) { + sg = scsi_sglist(cmd); + tot_dsds = pci_map_sg(ha->pdev, sg, scsi_sg_count(cmd), cmd->sc_data_direction); if (tot_dsds == 0) goto queuing_error; - } else if (cmd->request_bufflen) { + } else if (scsi_bufflen(cmd)) { dma_addr_t req_dma; - req_dma = pci_map_single(ha->pdev, cmd->request_buffer, - cmd->request_bufflen, cmd->sc_data_direction); + req_dma = pci_map_single(ha->pdev, scsi_sglist(cmd), + scsi_bufflen(cmd), cmd->sc_data_direction); if (dma_mapping_error(req_dma)) goto queuing_error; @@ -824,7 +824,7 @@ memcpy(cmd_pkt->fcp_cdb, cmd->cmnd, cmd->cmd_len); host_to_fcp_swap(cmd_pkt->fcp_cdb, sizeof(cmd_pkt->fcp_cdb)); - cmd_pkt->byte_count = cpu_to_le32((uint32_t)cmd->request_bufflen); + cmd_pkt->byte_count = cpu_to_le32((uint32_t)scsi_bufflen(cmd)); /* Build IOCB segments */ qla24xx_build_scsi_iocbs(sp, cmd_pkt, tot_dsds); @@ -861,13 +861,13 @@ return QLA_SUCCESS; queuing_error: - if (cmd->use_sg && tot_dsds) { - sg = (struct scatterlist *) cmd->request_buffer; - pci_unmap_sg(ha->pdev, sg, cmd->use_sg, + if (scsi_sg_count(cmd) && tot_dsds) { + sg = scsi_sglist(cmd); + pci_unmap_sg(ha->pdev, sg, scsi_sg_count(cmd), cmd->sc_data_direction); } else if (tot_dsds) { pci_unmap_single(ha->pdev, sp->dma_handle, - cmd->request_bufflen, cmd->sc_data_direction); + scsi_bufflen(cmd), cmd->sc_data_direction); } spin_unlock_irqrestore(&ha->hardware_lock, flags); Modified: trunk/qla2x00t/qla_isr.c =================================================================== --- trunk/qla2x00t/qla_isr.c 2008-04-17 17:35:37 UTC (rev 337) +++ trunk/qla2x00t/qla_isr.c 2008-04-18 16:38:39 UTC (rev 338) @@ -1053,11 +1053,11 @@ } if (scsi_status & (SS_RESIDUAL_UNDER | SS_RESIDUAL_OVER)) { resid = resid_len; - cp->resid = resid; + scsi_set_resid(cp, resid); CMD_RESID_LEN(cp) = resid; if (!lscsi_status && - ((unsigned)(cp->request_bufflen - resid) < + ((unsigned)(scsi_bufflen(cp) - resid) < cp->underflow)) { qla_printk(KERN_INFO, ha, "scsi(%ld:%d:%d:%d): Mid-layer underflow " @@ -1065,7 +1065,7 @@ "error status.\n", ha->host_no, cp->device->channel, cp->device->id, cp->device->lun, resid, - cp->request_bufflen); + scsi_bufflen(cp)); cp->result = DID_ERROR << 16; break; @@ -1111,7 +1111,7 @@ case CS_DATA_UNDERRUN: resid = resid_len; if (scsi_status & SS_RESIDUAL_UNDER) { - cp->resid = resid; + scsi_set_resid(cp, resid); CMD_RESID_LEN(cp) = resid; } else { DEBUG2(printk(KERN_INFO @@ -1175,14 +1175,14 @@ "retrying command.\n", ha->host_no, cp->device->channel, cp->device->id, cp->device->lun, resid, - cp->request_bufflen)); + scsi_bufflen(cp))); cp->result = DID_BUS_BUSY << 16; break; } /* Handle mid-layer underflow */ - if ((unsigned)(cp->request_bufflen - resid) < + if ((unsigned)(scsi_bufflen(cp) - resid) < cp->underflow) { qla_printk(KERN_INFO, ha, "scsi(%ld:%d:%d:%d): Mid-layer underflow " @@ -1190,7 +1190,7 @@ "error status.\n", ha->host_no, cp->device->channel, cp->device->id, cp->device->lun, resid, - cp->request_bufflen); + scsi_bufflen(cp)); cp->result = DID_ERROR << 16; break; @@ -1213,7 +1213,7 @@ DEBUG2(printk(KERN_INFO "PID=0x%lx req=0x%x xtra=0x%x -- returning DID_ERROR " "status!\n", - cp->serial_number, cp->request_bufflen, resid_len)); + cp->serial_number, scsi_bufflen(cp), resid_len)); cp->result = DID_ERROR << 16; break; Modified: trunk/qla2x00t/qla_os.c =================================================================== --- trunk/qla2x00t/qla_os.c 2008-04-17 17:35:37 UTC (rev 337) +++ trunk/qla2x00t/qla_os.c 2008-04-18 16:38:39 UTC (rev 338) @@ -2453,12 +2453,12 @@ struct scsi_cmnd *cmd = sp->cmd; if (sp->flags & SRB_DMA_VALID) { - if (cmd->use_sg) { - dma_unmap_sg(&ha->pdev->dev, cmd->request_buffer, - cmd->use_sg, cmd->sc_data_direction); - } else if (cmd->request_bufflen) { + if (scsi_sg_count(cmd)) { + dma_unmap_sg(&ha->pdev->dev, scsi_sglist(cmd), + scsi_sg_count(cmd), cmd->sc_data_direction); + } else if (scsi_bufflen(cmd)) { dma_unmap_single(&ha->pdev->dev, sp->dma_handle, - cmd->request_bufflen, cmd->sc_data_direction); + scsi_bufflen(cmd), cmd->sc_data_direction); } sp->flags &= ~SRB_DMA_VALID; } Property changes on: trunk/qla_isp ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/qla_isp/common ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/qla_isp/doc ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/qla_isp/firmware ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/qla_isp/linux ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/qla_isp/linux-2.6 ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/qla_isp/linux-2.6/build ___________________________________________________________________ Name: svn:ignore - * + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/scst ___________________________________________________________________ Name: svn:ignore - *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/scst/include ___________________________________________________________________ Name: svn:ignore - *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/scst/kernel ___________________________________________________________________ Name: svn:ignore - *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/scst/kernel/in-tree ___________________________________________________________________ Name: svn:ignore - *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/scst/kernel/old_unsupported ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/scst/src ___________________________________________________________________ Name: svn:ignore - *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/scst/src/dev_handlers ___________________________________________________________________ Name: svn:ignore - *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Modified: trunk/scst/src/dev_handlers/scst_changer.c =================================================================== --- trunk/scst/src/dev_handlers/scst_changer.c 2008-04-17 17:35:37 UTC (rev 337) +++ trunk/scst/src/dev_handlers/scst_changer.c 2008-04-18 16:38:39 UTC (rev 338) @@ -87,7 +87,12 @@ do { TRACE_DBG("%s", "Doing TEST_UNIT_READY"); res = scsi_test_unit_ready(dev->scsi_dev, CHANGER_TIMEOUT, - CHANGER_RETRIES); + CHANGER_RETRIES +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) + ); +#else + , NULL); +#endif TRACE_DBG("TEST_UNIT_READY done: %x", res); } while ((--retries > 0) && res); if (res) { Modified: trunk/scst/src/dev_handlers/scst_processor.c =================================================================== --- trunk/scst/src/dev_handlers/scst_processor.c 2008-04-17 17:35:37 UTC (rev 337) +++ trunk/scst/src/dev_handlers/scst_processor.c 2008-04-18 16:38:39 UTC (rev 338) @@ -87,7 +87,12 @@ do { TRACE_DBG("%s", "Doing TEST_UNIT_READY"); res = scsi_test_unit_ready(dev->scsi_dev, PROCESSOR_TIMEOUT, - PROCESSOR_RETRIES); + PROCESSOR_RETRIES +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) + ); +#else + , NULL); +#endif TRACE_DBG("TEST_UNIT_READY done: %x", res); } while ((--retries > 0) && res); if (res) { Modified: trunk/scst/src/dev_handlers/scst_raid.c =================================================================== --- trunk/scst/src/dev_handlers/scst_raid.c 2008-04-17 17:35:37 UTC (rev 337) +++ trunk/scst/src/dev_handlers/scst_raid.c 2008-04-18 16:38:39 UTC (rev 338) @@ -87,7 +87,12 @@ do { TRACE_DBG("%s", "Doing TEST_UNIT_READY"); res = scsi_test_unit_ready(dev->scsi_dev, RAID_TIMEOUT, - RAID_RETRIES); + RAID_RETRIES +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) + ); +#else + , NULL); +#endif TRACE_DBG("TEST_UNIT_READY done: %x", res); } while ((--retries > 0) && res); if (res) { Modified: trunk/scst/src/dev_handlers/scst_tape.c =================================================================== --- trunk/scst/src/dev_handlers/scst_tape.c 2008-04-17 17:35:37 UTC (rev 337) +++ trunk/scst/src/dev_handlers/scst_tape.c 2008-04-18 16:38:39 UTC (rev 338) @@ -183,7 +183,12 @@ do { TRACE_DBG("%s", "Doing TEST_UNIT_READY"); res = scsi_test_unit_ready(dev->scsi_dev, TAPE_SMALL_TIMEOUT, - TAPE_RETRIES); + TAPE_RETRIES +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) + ); +#else + , NULL); +#endif TRACE_DBG("TEST_UNIT_READY done: %x", res); } while ((--retries > 0) && res); if (res) { Property changes on: trunk/scstadmin ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/scstadmin/SCST ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/scstadmin/examples ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/scstadmin/init.d ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/scstadmin/scst_db ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/srpt ___________________________________________________________________ Name: svn:ignore - *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/srpt/patches ___________________________________________________________________ Name: svn:ignore - *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/srpt/src ___________________________________________________________________ Name: svn:ignore - *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/usr ___________________________________________________________________ Name: svn:ignore + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/usr/fileio ___________________________________________________________________ Name: svn:ignore - *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers .depend* fileio_tgt + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order Property changes on: trunk/www ___________________________________________________________________ Name: svn:ignore - *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers + *.o *.mod.c *.ko *.ko.cmd *.o.cmd .tmp_versions Modules.symvers Module.symvers modules.order This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-04-21 07:02:41
|
Revision: 340 http://scst.svn.sourceforge.net/scst/?rev=340&view=rev Author: vlnb Date: 2008-04-21 00:01:13 -0700 (Mon, 21 Apr 2008) Log Message: ----------- Forgotten in r338 patches Added Paths: ----------- trunk/iscsi-scst/kernel/patches/put_page_callback-2.6.25.patch trunk/scst/kernel/scst_exec_req_fifo-2.6.25.patch Added: trunk/iscsi-scst/kernel/patches/put_page_callback-2.6.25.patch =================================================================== --- trunk/iscsi-scst/kernel/patches/put_page_callback-2.6.25.patch (rev 0) +++ trunk/iscsi-scst/kernel/patches/put_page_callback-2.6.25.patch 2008-04-21 07:01:13 UTC (rev 340) @@ -0,0 +1,264 @@ +diff -upkr linux-2.6.25/include/linux/mm_types.h linux-2.6.25/include/linux/mm_types.h +--- linux-2.6.25/include/linux/mm_types.h 2008-04-17 06:49:44.000000000 +0400 ++++ linux-2.6.25/include/linux/mm_types.h 2008-04-18 13:38:38.000000000 +0400 +@@ -88,6 +88,17 @@ struct page { + void *virtual; /* Kernel virtual address (NULL if + not kmapped, ie. highmem) */ + #endif /* WANT_PAGE_VIRTUAL */ ++ ++ /* ++ * Used to implement support for notification on zero-copy TCP transfer ++ * completion. Not good to have this field here, it's better to have ++ * it in struct sk_buff, but it would make the code much more ++ * complicated and fragile, if maintained as a separate patch, since all ++ * skb then would have to contain only pages with the same value in this ++ * field. ++ */ ++ void *net_priv; ++ + #ifdef CONFIG_CGROUP_MEM_RES_CTLR + unsigned long page_cgroup; + #endif +diff -upkr linux-2.6.25/include/linux/net.h linux-2.6.25/include/linux/net.h +--- linux-2.6.25/include/linux/net.h 2008-04-17 06:49:44.000000000 +0400 ++++ linux-2.6.25/include/linux/net.h 2008-04-18 13:37:06.000000000 +0400 +@@ -59,6 +59,7 @@ typedef enum { + #ifdef __KERNEL__ + #include <linux/stringify.h> + #include <linux/random.h> ++#include <linux/mm.h> + + #define SOCK_ASYNC_NOSPACE 0 + #define SOCK_ASYNC_WAITDATA 1 +@@ -341,5 +342,30 @@ extern int net_msg_cost; + extern int net_msg_burst; + #endif + ++/* Support for notification on zero-copy TCP transfer completion */ ++#define NET_PAGE_CALLBACKS_DEFINED ++typedef void (*net_get_page_callback_t)(struct page *page); ++typedef void (*net_put_page_callback_t)(struct page *page); ++ ++extern net_get_page_callback_t net_get_page_callback; ++extern net_put_page_callback_t net_put_page_callback; ++ ++extern int net_set_get_put_page_callbacks( ++ net_get_page_callback_t get_callback, ++ net_put_page_callback_t put_callback); ++ ++static inline void net_get_page(struct page *page) ++{ ++ if (page->net_priv != 0) ++ net_get_page_callback(page); ++ get_page(page); ++} ++static inline void net_put_page(struct page *page) ++{ ++ if (page->net_priv != 0) ++ net_put_page_callback(page); ++ put_page(page); ++} ++ + #endif /* __KERNEL__ */ + #endif /* _LINUX_NET_H */ +diff -upkr linux-2.6.25/net/core/skbuff.c linux-2.6.25/net/core/skbuff.c +--- linux-2.6.25/net/core/skbuff.c 2008-04-17 06:49:44.000000000 +0400 ++++ linux-2.6.25/net/core/skbuff.c 2008-04-18 13:37:06.000000000 +0400 +@@ -297,7 +297,7 @@ static void skb_release_data(struct sk_b + if (skb_shinfo(skb)->nr_frags) { + int i; + for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) +- put_page(skb_shinfo(skb)->frags[i].page); ++ net_put_page(skb_shinfo(skb)->frags[i].page); + } + + if (skb_shinfo(skb)->frag_list) +@@ -631,7 +631,7 @@ struct sk_buff *pskb_copy(struct sk_buff + + for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { + skb_shinfo(n)->frags[i] = skb_shinfo(skb)->frags[i]; +- get_page(skb_shinfo(n)->frags[i].page); ++ net_get_page(skb_shinfo(n)->frags[i].page); + } + skb_shinfo(n)->nr_frags = i; + } +@@ -694,7 +694,7 @@ int pskb_expand_head(struct sk_buff *skb + sizeof(struct skb_shared_info)); + + for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) +- get_page(skb_shinfo(skb)->frags[i].page); ++ net_get_page(skb_shinfo(skb)->frags[i].page); + + if (skb_shinfo(skb)->frag_list) + skb_clone_fraglist(skb); +@@ -891,7 +891,7 @@ drop_pages: + skb_shinfo(skb)->nr_frags = i; + + for (; i < nfrags; i++) +- put_page(skb_shinfo(skb)->frags[i].page); ++ net_put_page(skb_shinfo(skb)->frags[i].page); + + if (skb_shinfo(skb)->frag_list) + skb_drop_fraglist(skb); +@@ -1060,7 +1060,7 @@ pull_pages: + k = 0; + for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { + if (skb_shinfo(skb)->frags[i].size <= eat) { +- put_page(skb_shinfo(skb)->frags[i].page); ++ net_put_page(skb_shinfo(skb)->frags[i].page); + eat -= skb_shinfo(skb)->frags[i].size; + } else { + skb_shinfo(skb)->frags[k] = skb_shinfo(skb)->frags[i]; +@@ -1840,7 +1840,7 @@ static inline void skb_split_no_header(s + * where splitting is expensive. + * 2. Split is accurately. We make this. + */ +- get_page(skb_shinfo(skb)->frags[i].page); ++ net_get_page(skb_shinfo(skb)->frags[i].page); + skb_shinfo(skb1)->frags[0].page_offset += len - pos; + skb_shinfo(skb1)->frags[0].size -= len - pos; + skb_shinfo(skb)->frags[i].size = len - pos; +@@ -2215,7 +2215,7 @@ struct sk_buff *skb_segment(struct sk_bu + BUG_ON(i >= nfrags); + + *frag = skb_shinfo(skb)->frags[i]; +- get_page(frag->page); ++ net_get_page(frag->page); + size = frag->size; + + if (pos < offset) { +diff -upkr linux-2.6.25/net/core/utils.c linux-2.6.25/net/core/utils.c +--- linux-2.6.25/net/core/utils.c 2008-04-17 06:49:44.000000000 +0400 ++++ linux-2.6.25/net/core/utils.c 2008-04-18 13:39:40.000000000 +0400 +@@ -25,6 +25,7 @@ + #include <linux/random.h> + #include <linux/percpu.h> + #include <linux/init.h> ++#include <linux/skbuff.h> + #include <net/sock.h> + + #include <asm/byteorder.h> +@@ -36,6 +37,9 @@ int net_msg_burst __read_mostly = 10; + int net_msg_warn __read_mostly = 1; + EXPORT_SYMBOL(net_msg_warn); + ++net_get_page_callback_t net_get_page_callback __read_mostly; ++net_put_page_callback_t net_put_page_callback __read_mostly; ++ + /* + * All net warning printk()s should be guarded by this function. + */ +@@ -283,6 +287,35 @@ out: + + EXPORT_SYMBOL(in6_pton); + ++int net_set_get_put_page_callbacks( ++ net_get_page_callback_t get_callback, ++ net_put_page_callback_t put_callback) ++{ ++ int res = 0; ++ ++ if ((net_get_page_callback != NULL) && (get_callback != NULL) && ++ (net_get_page_callback != get_callback)) { ++ res = -EBUSY; ++ goto out; ++ } ++ ++ if ((net_put_page_callback != NULL) && (put_callback != NULL) && ++ (net_put_page_callback != put_callback)) { ++ res = -EBUSY; ++ goto out; ++ } ++ ++ net_get_page_callback = get_callback; ++ net_put_page_callback = put_callback; ++ ++out: ++ return res; ++} ++EXPORT_SYMBOL(net_set_get_put_page_callbacks); ++ ++EXPORT_SYMBOL(net_get_page_callback); ++EXPORT_SYMBOL(net_put_page_callback); ++ + void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, + __be32 from, __be32 to, int pseudohdr) + { +diff -upkr linux-2.6.25/net/ipv4/ip_output.c linux-2.6.25/net/ipv4/ip_output.c +--- linux-2.6.25/net/ipv4/ip_output.c 2008-04-17 06:49:44.000000000 +0400 ++++ linux-2.6.25/net/ipv4/ip_output.c 2008-04-18 13:37:06.000000000 +0400 +@@ -1017,7 +1017,7 @@ alloc_new_skb: + err = -EMSGSIZE; + goto error; + } +- get_page(page); ++ net_get_page(page); + skb_fill_page_desc(skb, i, page, sk->sk_sndmsg_off, 0); + frag = &skb_shinfo(skb)->frags[i]; + } +@@ -1175,7 +1175,7 @@ ssize_t ip_append_page(struct sock *sk, + if (skb_can_coalesce(skb, i, page, offset)) { + skb_shinfo(skb)->frags[i-1].size += len; + } else if (i < MAX_SKB_FRAGS) { +- get_page(page); ++ net_get_page(page); + skb_fill_page_desc(skb, i, page, offset, len); + } else { + err = -EMSGSIZE; +diff -upkr linux-2.6.25/net/ipv4/tcp.c linux-2.6.25/net/ipv4/tcp.c +--- linux-2.6.25/net/ipv4/tcp.c 2008-04-17 06:49:44.000000000 +0400 ++++ linux-2.6.25/net/ipv4/tcp.c 2008-04-18 13:37:06.000000000 +0400 +@@ -713,7 +713,7 @@ new_segment: + if (can_coalesce) { + skb_shinfo(skb)->frags[i - 1].size += copy; + } else { +- get_page(page); ++ net_get_page(page); + skb_fill_page_desc(skb, i, page, offset, copy); + } + +@@ -918,7 +918,7 @@ new_segment: + goto new_segment; + } else if (page) { + if (off == PAGE_SIZE) { +- put_page(page); ++ net_put_page(page); + TCP_PAGE(sk) = page = NULL; + off = 0; + } +@@ -959,9 +959,9 @@ new_segment: + } else { + skb_fill_page_desc(skb, i, page, off, copy); + if (TCP_PAGE(sk)) { +- get_page(page); ++ net_get_page(page); + } else if (off + copy < PAGE_SIZE) { +- get_page(page); ++ net_get_page(page); + TCP_PAGE(sk) = page; + } + } +diff -upkr linux-2.6.25/net/ipv4/tcp_output.c linux-2.6.25/net/ipv4/tcp_output.c +--- linux-2.6.25/net/ipv4/tcp_output.c 2008-04-17 06:49:44.000000000 +0400 ++++ linux-2.6.25/net/ipv4/tcp_output.c 2008-04-18 13:37:06.000000000 +0400 +@@ -805,7 +805,7 @@ static void __pskb_trim_head(struct sk_b + k = 0; + for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { + if (skb_shinfo(skb)->frags[i].size <= eat) { +- put_page(skb_shinfo(skb)->frags[i].page); ++ net_put_page(skb_shinfo(skb)->frags[i].page); + eat -= skb_shinfo(skb)->frags[i].size; + } else { + skb_shinfo(skb)->frags[k] = skb_shinfo(skb)->frags[i]; +diff -upkr linux-2.6.25/net/ipv6/ip6_output.c linux-2.6.25/net/ipv6/ip6_output.c +--- linux-2.6.25/net/ipv6/ip6_output.c 2008-04-17 06:49:44.000000000 +0400 ++++ linux-2.6.25/net/ipv6/ip6_output.c 2008-04-18 13:37:06.000000000 +0400 +@@ -1332,7 +1332,7 @@ alloc_new_skb: + err = -EMSGSIZE; + goto error; + } +- get_page(page); ++ net_get_page(page); + skb_fill_page_desc(skb, i, page, sk->sk_sndmsg_off, 0); + frag = &skb_shinfo(skb)->frags[i]; + } Added: trunk/scst/kernel/scst_exec_req_fifo-2.6.25.patch =================================================================== --- trunk/scst/kernel/scst_exec_req_fifo-2.6.25.patch (rev 0) +++ trunk/scst/kernel/scst_exec_req_fifo-2.6.25.patch 2008-04-21 07:01:13 UTC (rev 340) @@ -0,0 +1,109 @@ +diff -upkr linux-2.6.25/drivers/scsi/scsi_lib.c linux-2.6.25/drivers/scsi/scsi_lib.c +--- linux-2.6.25/drivers/scsi/scsi_lib.c 2008-04-17 06:49:44.000000000 +0400 ++++ linux-2.6.25/drivers/scsi/scsi_lib.c 2008-04-18 14:19:27.000000000 +0400 +@@ -363,7 +363,7 @@ free_bios: + } + + /** +- * scsi_execute_async - insert request ++ * __scsi_execute_async - insert request + * @sdev: scsi device + * @cmd: scsi command + * @cmd_len: length of scsi cdb +@@ -376,11 +376,14 @@ free_bios: + * @privdata: data passed to done() + * @done: callback function when done + * @gfp: memory allocation 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; +@@ -417,7 +420,7 @@ int scsi_execute_async(struct scsi_devic + 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: +@@ -426,8 +429,53 @@ free_sense: + kmem_cache_free(scsi_io_context_cache, 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_fifo - 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() + * +diff -upkr linux-2.6.25/include/scsi/scsi_device.h linux-2.6.25/include/scsi/scsi_device.h +--- linux-2.6.25/include/scsi/scsi_device.h 2008-04-17 06:49:44.000000000 +0400 ++++ linux-2.6.25/include/scsi/scsi_device.h 2008-04-18 13:31:09.000000000 +0400 +@@ -332,6 +332,13 @@ extern int scsi_execute_async(struct scs + int timeout, int retries, void *privdata, + void (*done)(void *, char *, int, int), + gfp_t gfp); ++#define SCSI_EXEC_REQ_FIFO_DEFINED ++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 int __must_check scsi_device_reprobe(struct scsi_device *sdev) + { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-05-07 18:44:31
|
Revision: 364 http://scst.svn.sourceforge.net/scst/?rev=364&view=rev Author: vlnb Date: 2008-05-07 11:44:15 -0700 (Wed, 07 May 2008) Log Message: ----------- - Rejecting command reimplemented in a more simple, straightforward and readable way. - Minor external interface change: now target drivers should set for aborted commands SCST_CMD_DELIVERY_ABORTED status via scst_set_delivery_status(). In-tree drivers updated. - Fixed broken compilation if put_page_callback patch not applied to the kernel. Reported by Erez Zilber <er...@Vo...> - Fixed several minor problems reported by David Berton <dav...@ya...> - Fixed __exit misuse, when such functions called from __init functions. - Docs updated. - Other minor changes and cleanups. Modified Paths: -------------- trunk/iscsi-scst/kernel/digest.c trunk/iscsi-scst/kernel/iscsi.c trunk/iscsi-scst/kernel/iscsi.h trunk/iscsi-scst/kernel/iscsi_hdr.h trunk/iscsi-scst/kernel/nthread.c trunk/qla2x00t/qla2x00-target/qla2x00t.c trunk/qla_isp/README.scst trunk/qla_isp/linux/isp_scst.c trunk/scst/README trunk/scst/include/scst.h trunk/scst/include/scst_const.h trunk/scst/src/dev_handlers/scst_vdisk.c trunk/scst/src/scst_lib.c trunk/scst/src/scst_proc.c trunk/scst/src/scst_targ.c trunk/srpt/src/ib_srpt.c Modified: trunk/iscsi-scst/kernel/digest.c =================================================================== --- trunk/iscsi-scst/kernel/digest.c 2008-05-04 10:31:05 UTC (rev 363) +++ trunk/iscsi-scst/kernel/digest.c 2008-05-07 18:44:15 UTC (rev 364) @@ -162,6 +162,9 @@ u32 offset, crc; int res = 0; + if (unlikely(cmnd->rejected)) + goto out; + switch (cmnd_opcode(cmnd)) { case ISCSI_OP_SCSI_DATA_OUT: req = cmnd->cmd_req; @@ -169,11 +172,6 @@ offset = be32_to_cpu(req_hdr->buffer_offset); break; - case ISCSI_OP_SCSI_REJECT: - case ISCSI_OP_PDU_REJECT: - case ISCSI_OP_DATA_REJECT: - goto out; - default: req = cmnd; offset = 0; Modified: trunk/iscsi-scst/kernel/iscsi.c =================================================================== --- trunk/iscsi-scst/kernel/iscsi.c 2008-05-04 10:31:05 UTC (rev 363) +++ trunk/iscsi-scst/kernel/iscsi.c 2008-05-07 18:44:15 UTC (rev 364) @@ -61,7 +61,7 @@ static void cmnd_remove_hash(struct iscsi_cmnd *cmnd); static void iscsi_send_task_mgmt_resp(struct iscsi_cmnd *req, int status); -static void cmnd_prepare_skip_pdu(struct iscsi_cmnd *cmnd); +static void cmnd_prepare_get_rejected_cmd_data(struct iscsi_cmnd *cmnd); static void iscsi_check_send_delayed_tm_resp(struct iscsi_session *sess); static void iscsi_session_push_cmnd(struct iscsi_cmnd *cmnd); @@ -149,7 +149,6 @@ #ifdef NET_PAGE_CALLBACKS_DEFINED atomic_set(&cmnd->net_ref_cnt, 0); #endif - cmnd->target = conn->target; spin_lock_init(&cmnd->rsp_cmd_lock); INIT_LIST_HEAD(&cmnd->rsp_cmd_list); INIT_LIST_HEAD(&cmnd->rx_ddigest_cmd_list); @@ -168,7 +167,7 @@ { TRACE_DBG("%p", cmnd); - if (unlikely(cmnd->tmfabort)) { + if (unlikely(cmnd->tm_aborted)) { TRACE_MGMT_DBG("Free aborted cmd %p (scst cmd %p, state %d, " "parent_req %p)", cmnd, cmnd->scst_cmd, cmnd->scst_state, cmnd->parent_req); @@ -203,7 +202,7 @@ { TRACE_DBG("%p", cmnd); - if (unlikely(cmnd->tmfabort)) { + if (unlikely(cmnd->tm_aborted)) { TRACE_MGMT_DBG("Done aborted cmd %p (scst cmd %p, state %d, " "parent_req %p)", cmnd, cmnd->scst_cmd, cmnd->scst_state, cmnd->parent_req); @@ -238,6 +237,10 @@ if (cmnd->scst_cmd) { switch(cmnd->scst_state) { + case ISCSI_CMD_STATE_PROCESSED: + TRACE_DBG("cmd %p PROCESSED", cmnd); + scst_tgt_cmd_done(cmnd->scst_cmd); + break; case ISCSI_CMD_STATE_AFTER_PREPROC: { struct scst_cmd *scst_cmd = cmnd->scst_cmd; @@ -249,10 +252,6 @@ SCST_CONTEXT_THREAD); break; } - case ISCSI_CMD_STATE_PROCESSED: - TRACE_DBG("cmd %p PROCESSED", cmnd); - scst_tgt_cmd_done(cmnd->scst_cmd); - break; default: PRINT_CRIT_ERROR("Unexpected cmnd scst state %d", cmnd->scst_state); @@ -398,7 +397,7 @@ req->release_called = 1; #endif - if (unlikely(req->tmfabort)) { + if (unlikely(req->tm_aborted)) { TRACE_MGMT_DBG("Release aborted req cmd %p (scst cmd %p, " "state %d)", req, req->scst_cmd, req->scst_state); } @@ -717,6 +716,10 @@ TRACE_MGMT_DBG("Reject: req %p, reason %x", req, reason); + sBUG_ON(req->rejected); + req->rejected = 1; + req->reject_reason = ISCSI_REJECT_CMD; + rsp = iscsi_cmnd_create_rsp_cmnd(req); rsp_hdr = (struct iscsi_reject_hdr *)&rsp->pdu.bhs; @@ -735,9 +738,11 @@ clear_page(addr); memcpy(addr, &req->pdu.bhs, sizeof(struct iscsi_hdr)); rsp->bufflen = rsp->pdu.datasize = sizeof(struct iscsi_hdr); - cmnd_prepare_skip_pdu(req); - req->pdu.bhs.opcode = ISCSI_OP_PDU_REJECT; + iscsi_cmnd_init_write(rsp, ISCSI_INIT_WRITE_REMOVE_HASH | + ISCSI_INIT_WRITE_WAKE); + + cmnd_prepare_get_rejected_cmd_data(req); } static inline int iscsi_get_allowed_cmds(struct iscsi_session *sess) @@ -913,7 +918,7 @@ spin_unlock(&session->cmnd_hash_lock); } -static void cmnd_prepare_skip_pdu(struct iscsi_cmnd *cmnd) +static void cmnd_prepare_get_rejected_cmd_data(struct iscsi_cmnd *cmnd) { struct iscsi_conn *conn = cmnd->conn; struct scatterlist *sg = cmnd->sg; @@ -954,9 +959,11 @@ conn->read_iov[i].iov_len = size; conn->read_msg.msg_iov = conn->read_iov; conn->read_msg.msg_iovlen = ++i; + + return; } -static void cmnd_prepare_skip_pdu_set_resid(struct iscsi_cmnd *req) +static void cmnd_reject_scsi_cmd(struct iscsi_cmnd *req) { struct iscsi_cmnd *rsp; struct iscsi_scsi_rsp_hdr *rsp_hdr; @@ -964,9 +971,15 @@ TRACE_DBG("%p", req); + sBUG_ON(req->rejected); + req->rejected = 1; + req->reject_reason = ISCSI_REJECT_SCSI_CMD; + rsp = get_rsp_cmnd(req); - if (rsp == NULL) - goto skip; + if (rsp == NULL) { + /* That can be true for aborted commands */ + goto out_reject; + } rsp_hdr = (struct iscsi_scsi_rsp_hdr *)&rsp->pdu.bhs; @@ -988,11 +1001,12 @@ } } -skip: - req->pdu.bhs.opcode = - (req->pdu.bhs.opcode & ~ISCSI_OPCODE_MASK) | ISCSI_OP_SCSI_REJECT; + iscsi_cmnd_init_write(rsp, ISCSI_INIT_WRITE_REMOVE_HASH | + ISCSI_INIT_WRITE_WAKE); - cmnd_prepare_skip_pdu(req); +out_reject: + cmnd_prepare_get_rejected_cmd_data(req); + return; } static int cmnd_prepare_recv_pdu(struct iscsi_conn *conn, @@ -1065,7 +1079,7 @@ u32 offset, burst; LIST_HEAD(send); - if (unlikely(req->tmfabort)) { + if (unlikely(req->tm_aborted)) { TRACE_MGMT_DBG("req %p (scst_cmd %p) aborted on R2T " "(r2t_length %d, outstanding_r2t %d)", req, req->scst_cmd, req->r2t_length, req->outstanding_r2t); @@ -1289,7 +1303,7 @@ req_hdr->scb, sizeof(req_hdr->scb), SCST_NON_ATOMIC); if (scst_cmd == NULL) { create_status_rsp(req, SAM_STAT_BUSY, NULL, 0); - cmnd_prepare_skip_pdu_set_resid(req); + cmnd_reject_scsi_cmd(req); goto out; } @@ -1344,13 +1358,13 @@ if (unlikely(req->scst_state != ISCSI_CMD_STATE_AFTER_PREPROC)) { TRACE_DBG("req %p is in %x state", req, req->scst_state); if (req->scst_state == ISCSI_CMD_STATE_PROCESSED) { - cmnd_prepare_skip_pdu_set_resid(req); + cmnd_reject_scsi_cmd(req); goto out; } - if (unlikely(req->tmfabort)) { + if (unlikely(req->tm_aborted)) { TRACE_MGMT_DBG("req %p (scst_cmd %p) aborted", req, req->scst_cmd); - cmnd_prepare_skip_pdu(req); + cmnd_prepare_get_rejected_cmd_data(req); goto out; } sBUG(); @@ -1363,7 +1377,7 @@ PRINT_ERROR("Unexpected unsolicited data (ITT %x " "CDB %x", cmnd_itt(req), req_hdr->scb[0]); create_sense_rsp(req, ABORTED_COMMAND, 0xc, 0xc); - cmnd_prepare_skip_pdu_set_resid(req); + cmnd_reject_scsi_cmd(req); goto out; } } @@ -1411,7 +1425,7 @@ PRINT_ERROR("pdu.datasize(%d) >0, but dir(%x) isn't WRITE", req->pdu.datasize, dir); create_sense_rsp(req, ABORTED_COMMAND, 0xc, 0xc); - cmnd_prepare_skip_pdu_set_resid(req); + cmnd_reject_scsi_cmd(req); } else res = cmnd_prepare_recv_pdu(conn, req, 0, req->pdu.datasize); } @@ -1424,7 +1438,7 @@ static int data_out_start(struct iscsi_conn *conn, struct iscsi_cmnd *cmnd) { struct iscsi_data_out_hdr *req_hdr = (struct iscsi_data_out_hdr *)&cmnd->pdu.bhs; - struct iscsi_cmnd *req = NULL; + struct iscsi_cmnd *orig_req = NULL; u32 offset = be32_to_cpu(req_hdr->buffer_offset); int res = 0; @@ -1438,29 +1452,29 @@ update_stat_sn(cmnd); - cmnd->cmd_req = req = cmnd_find_hash(conn->session, req_hdr->itt, + cmnd->cmd_req = orig_req = cmnd_find_hash(conn->session, req_hdr->itt, req_hdr->ttt); - if (unlikely(req == NULL)) { + if (unlikely(orig_req == NULL)) { /* It might happen if req was aborted and then freed */ TRACE(TRACE_MGMT_MINOR, "Unable to find scsi task %x %x", cmnd_itt(cmnd), cmnd_ttt(cmnd)); - goto skip_pdu; + goto out_reject; } - if (req->is_unsolicited_data) { - if (unlikely(req->r2t_length < cmnd->pdu.datasize)) { + if (orig_req->is_unsolicited_data) { + if (unlikely(orig_req->r2t_length < cmnd->pdu.datasize)) { PRINT_ERROR("Data size (%d) > R2T length (%d)", - cmnd->pdu.datasize, req->r2t_length); + cmnd->pdu.datasize, orig_req->r2t_length); mark_conn_closed(conn); res = -EINVAL; goto out; } - req->r2t_length -= cmnd->pdu.datasize; + orig_req->r2t_length -= cmnd->pdu.datasize; } /* Check unsolicited burst data */ if (unlikely((req_hdr->ttt == cpu_to_be32(ISCSI_RESERVED_TAG)) && - (req->pdu.bhs.flags & ISCSI_FLG_FINAL))) { + (orig_req->pdu.bhs.flags & ISCSI_FLG_FINAL))) { PRINT_ERROR("Unexpected data from %x %x", cmnd_itt(cmnd), cmnd_ttt(cmnd)); mark_conn_closed(conn); @@ -1468,18 +1482,20 @@ goto out; } - TRACE_WRITE("%u %p %p %u %u", req_hdr->ttt, cmnd, req, + TRACE_WRITE("%u %p %p %u %u", req_hdr->ttt, cmnd, orig_req, offset, cmnd->pdu.datasize); - res = cmnd_prepare_recv_pdu(conn, req, offset, cmnd->pdu.datasize); + res = cmnd_prepare_recv_pdu(conn, orig_req, offset, cmnd->pdu.datasize); out: TRACE_EXIT_RES(res); return res; -skip_pdu: - cmnd->pdu.bhs.opcode = ISCSI_OP_DATA_REJECT; - cmnd_prepare_skip_pdu(cmnd); +out_reject: + sBUG_ON(cmnd->rejected); + cmnd->rejected = 1; + cmnd->reject_reason = ISCSI_REJECT_DATA; + cmnd_prepare_get_rejected_cmd_data(cmnd); goto out; } @@ -1543,6 +1559,23 @@ static void __cmnd_abort(struct iscsi_cmnd *cmnd) { + /* + * Here, if cmnd is data_waiting, we should iscsi_fail_waiting_cmnd() + * it. But, since this function can be called from any thread, not only + * from the read one, we at the moment can't do that, because of + * absence of appropriate locking protection. But this isn't a stuff + * for 0.9.6. So, currently a misbehaving initiator, not sending + * data in R2T state for a sharing between targets device, for which + * for some reason an aborting TM command, e.g. TARGET RESET, from + * another initiator is issued, can block response for this TM command + * virtually forever and by this make the issuing initiator eventually + * put the device offline. + * + * ToDo in the next version, possibly a simple connection mutex, taken + * by the read thread before starting any processing and by this + * function, should be sufficient. + */ + TRACE_MGMT_DBG("Aborting cmd %p, scst_cmd %p (scst state %x, " "ref_cnt %d, itt %x, sn %u, op %x, r2t_len %x, CDB op %x, " "size to write %u, is_unsolicited_data %d, " @@ -1559,7 +1592,7 @@ TRACE_MGMT_DBG("net_ref_cnt %d", atomic_read(&cmnd->net_ref_cnt)); #endif - cmnd->tmfabort = 1; + cmnd->tm_aborted = 1; return; } @@ -1949,16 +1982,21 @@ static void iscsi_cmnd_exec(struct iscsi_cmnd *cmnd) { + TRACE_ENTRY(); + TRACE_DBG("%p,%x,%u", cmnd, cmnd_opcode(cmnd), cmnd->pdu.bhs.sn); - if (unlikely(cmnd->tmfabort)) { + iscsi_extracheck_is_rd_thread(cmnd->conn); + + if (unlikely(cmnd->tm_aborted)) { TRACE_MGMT_DBG("cmnd %p (scst_cmd %p) aborted", cmnd, cmnd->scst_cmd); req_cmnd_release_force(cmnd, ISCSI_FORCE_RELEASE_WRITE); goto out; } - iscsi_extracheck_is_rd_thread(cmnd->conn); + if (unlikely(cmnd->rejected)) + goto out_rejected; switch (cmnd_opcode(cmnd)) { case ISCSI_OP_SCSI_CMD: @@ -1979,24 +2017,27 @@ case ISCSI_OP_LOGOUT_CMD: logout_exec(cmnd); break; - case ISCSI_OP_SCSI_REJECT: - { - struct iscsi_cmnd *rsp = get_rsp_cmnd(cmnd); - TRACE_MGMT_DBG("REJECT cmnd %p (scst_cmd %p), rsp %p", cmnd, - cmnd->scst_cmd, rsp); - if (rsp != NULL) - iscsi_cmnd_init_write(rsp, ISCSI_INIT_WRITE_REMOVE_HASH | - ISCSI_INIT_WRITE_WAKE); + default: + PRINT_ERROR("unexpected cmnd op %x", cmnd_opcode(cmnd)); req_cmnd_release(cmnd); break; } +out: + TRACE_EXIT(); + return; + +out_rejected: + TRACE_MGMT_DBG("Rejected cmd %p (reason %d)", cmnd, + cmnd->reject_reason); + switch (cmnd->reject_reason) { default: - PRINT_ERROR("unexpected cmnd op %x", cmnd_opcode(cmnd)); + PRINT_ERROR("Unexpected reject reason %d", cmnd->reject_reason); + /* go through */ + case ISCSI_REJECT_SCSI_CMD: req_cmnd_release(cmnd); break; } -out: - return; + goto out; } static void __cmnd_send_pdu(struct iscsi_conn *conn, struct iscsi_cmnd *cmnd, @@ -2238,7 +2279,7 @@ goto out; } - if (unlikely(cmnd->tmfabort)) { + if (unlikely(cmnd->tm_aborted)) { struct iscsi_cmnd *tm_clone; TRACE_MGMT_DBG("Pending aborted cmnd %p, creating TM " @@ -2247,7 +2288,7 @@ tm_clone = cmnd_alloc(cmnd->conn, NULL); if (tm_clone != NULL) { - tm_clone->tmfabort = 1; + tm_clone->tm_aborted = 1; tm_clone->pdu = cmnd->pdu; TRACE_MGMT_DBG("TM clone %p created", tm_clone); @@ -2353,9 +2394,12 @@ TRACE_DBG("%p:%x", cmnd, cmnd_opcode(cmnd)); + if (unlikely(cmnd->rejected)) + goto out_rejected; + +cont: switch (cmnd_opcode(cmnd)) { case ISCSI_OP_SCSI_CMD: - case ISCSI_OP_SCSI_REJECT: case ISCSI_OP_NOOP_OUT: case ISCSI_OP_SCSI_TASK_MGT_MSG: case ISCSI_OP_LOGOUT_CMD: @@ -2364,26 +2408,29 @@ case ISCSI_OP_SCSI_DATA_OUT: data_out_end(cmnd); break; - case ISCSI_OP_PDU_REJECT: - { - struct iscsi_cmnd *rsp = get_rsp_cmnd(cmnd); - if (rsp != NULL) - iscsi_cmnd_init_write(rsp, ISCSI_INIT_WRITE_REMOVE_HASH | - ISCSI_INIT_WRITE_WAKE); - req_cmnd_release(cmnd); - break; - } - case ISCSI_OP_DATA_REJECT: - req_cmnd_release(cmnd); - break; default: PRINT_ERROR("unexpected cmnd op %x", cmnd_opcode(cmnd)); req_cmnd_release(cmnd); break; } +out: TRACE_EXIT(); return; + +out_rejected: + switch (cmnd->reject_reason) { + default: + PRINT_ERROR("Unexpected reject reason %d", cmnd->reject_reason); + /* go through */ + case ISCSI_REJECT_CMD: + case ISCSI_REJECT_DATA: + req_cmnd_release(cmnd); + break; + case ISCSI_REJECT_SCSI_CMD: + goto cont; + } + goto out; } #ifndef NET_PAGE_CALLBACKS_DEFINED @@ -2512,21 +2559,28 @@ scst_cmd_set_tgt_priv(scst_cmd, NULL); - req->tmfabort |= scst_cmd_aborted(scst_cmd) ? 1 : 0; - if (unlikely(req->tmfabort)) { + req->tm_aborted |= scst_cmd_aborted(scst_cmd) ? 1 : 0; + if (unlikely(req->tm_aborted)) { TRACE_MGMT_DBG("req %p (scst_cmd %p) aborted", req, req->scst_cmd); + + scst_set_delivery_status(req->scst_cmd, + SCST_CMD_DELIVERY_ABORTED); + if (old_state == ISCSI_CMD_STATE_RESTARTED) { req->scst_state = ISCSI_CMD_STATE_PROCESSED; req_cmnd_release_force(req, ISCSI_FORCE_RELEASE_WRITE); } else iscsi_set_state_wake_up(req, ISCSI_CMD_STATE_PROCESSED); + goto out; } if (unlikely(old_state != ISCSI_CMD_STATE_RESTARTED)) { TRACE_DBG("req %p on %d state", req, old_state); + create_status_rsp(req, status, sense, sense_len); + switch(old_state) { case ISCSI_CMD_STATE_RX_CMD: case ISCSI_CMD_STATE_AFTER_PREPROC: @@ -2534,6 +2588,7 @@ default: sBUG(); } + iscsi_set_state_wake_up(req, ISCSI_CMD_STATE_PROCESSED); goto out; } Modified: trunk/iscsi-scst/kernel/iscsi.h =================================================================== --- trunk/iscsi-scst/kernel/iscsi.h 2008-05-04 10:31:05 UTC (rev 363) +++ trunk/iscsi-scst/kernel/iscsi.h 2008-05-07 18:44:15 UTC (rev 364) @@ -230,6 +230,11 @@ #define ISCSI_CMD_STATE_RESTARTED 3 /* scst_restart_cmd() called and SCST processing it */ #define ISCSI_CMD_STATE_PROCESSED 4 /* SCST done processing */ +/* Command's reject reasons */ +#define ISCSI_REJECT_SCSI_CMD 1 +#define ISCSI_REJECT_CMD 2 +#define ISCSI_REJECT_DATA 3 + /* * Most of the fields don't need any protection, since accessed from only a * single thread, except where noted. @@ -251,12 +256,14 @@ unsigned int force_cleanup_done:1; unsigned int dec_active_cmnds:1; unsigned int ddigest_checked:1; + unsigned int rejected:1; + unsigned int reject_reason:2; #ifdef EXTRACHECKS unsigned int on_rx_digest_list:1; unsigned int release_called:1; #endif - unsigned long tmfabort; /* it's async. with the above flags */ + volatile unsigned int tm_aborted; /* it's async. with the above flags */ struct list_head hash_list_entry; @@ -289,8 +296,6 @@ struct iscsi_cmnd *parent_req; struct iscsi_cmnd *cmd_req; - struct iscsi_target *target; - wait_queue_head_t scst_waitQ; int scst_state; struct scst_cmd *scst_cmd; @@ -316,10 +321,6 @@ struct list_head cmd_list_entry; }; -#define ISCSI_OP_SCSI_REJECT ISCSI_OP_VENDOR1_CMD -#define ISCSI_OP_PDU_REJECT ISCSI_OP_VENDOR2_CMD -#define ISCSI_OP_DATA_REJECT ISCSI_OP_VENDOR3_CMD - /* Flags for req_cmnd_release_force() */ #define ISCSI_FORCE_RELEASE_WRITE 1 Modified: trunk/iscsi-scst/kernel/iscsi_hdr.h =================================================================== --- trunk/iscsi-scst/kernel/iscsi_hdr.h 2008-05-04 10:31:05 UTC (rev 363) +++ trunk/iscsi-scst/kernel/iscsi_hdr.h 2008-05-07 18:44:15 UTC (rev 364) @@ -62,11 +62,6 @@ #define ISCSI_OP_LOGOUT_CMD 0x06 #define ISCSI_OP_SNACK_CMD 0x10 -#define ISCSI_OP_VENDOR1_CMD 0x1c -#define ISCSI_OP_VENDOR2_CMD 0x1d -#define ISCSI_OP_VENDOR3_CMD 0x1e -#define ISCSI_OP_VENDOR4_CMD 0x1f - /* Server to Client Message Opcode values */ #define ISCSI_OP_NOOP_IN 0x20 #define ISCSI_OP_SCSI_RSP 0x21 Modified: trunk/iscsi-scst/kernel/nthread.c =================================================================== --- trunk/iscsi-scst/kernel/nthread.c 2008-05-04 10:31:05 UTC (rev 363) +++ trunk/iscsi-scst/kernel/nthread.c 2008-05-07 18:44:15 UTC (rev 364) @@ -919,6 +919,8 @@ } #else static inline void check_net_priv(struct iscsi_cmnd *cmd, struct page *page) {} +static inline void __iscsi_get_page_callback(struct iscsi_cmnd *cmd) {} +static inline void __iscsi_put_page_callback(struct iscsi_cmnd *cmd) {} #endif /* This is partially taken from the Ardis code. */ Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c =================================================================== --- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2008-05-04 10:31:05 UTC (rev 363) +++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2008-05-07 18:44:15 UTC (rev 364) @@ -697,6 +697,8 @@ "for aborted scst_cmd=%p (tag=%Ld)", ha->instance, scst_cmd, scst_cmd_get_tag(scst_cmd)); + scst_set_delivery_status(scst_cmd, SCST_CMD_DELIVERY_ABORTED); + prm.cmd->state = Q2T_STATE_ABORTED; q2t_send_term_exchange(ha, prm.cmd, &prm.cmd->atio, 0); Modified: trunk/qla_isp/README.scst =================================================================== --- trunk/qla_isp/README.scst 2008-05-04 10:31:05 UTC (rev 363) +++ trunk/qla_isp/README.scst 2008-05-07 18:44:15 UTC (rev 364) @@ -37,7 +37,6 @@ Each time you want to run qla_isp, unload all other qla modules $ rmmod qla2x00tgt -$ rmmod qla2x00tgt $ rmmod qla2400 $ rmmod qla2300 $ rmmod qla2200 Modified: trunk/qla_isp/linux/isp_scst.c =================================================================== --- trunk/qla_isp/linux/isp_scst.c 2008-05-04 10:31:05 UTC (rev 363) +++ trunk/qla_isp/linux/isp_scst.c 2008-05-07 18:44:15 UTC (rev 364) @@ -1126,6 +1126,7 @@ tmd_xact_t *xact = &tmd->cd_xact; if (unlikely(scst_cmd_aborted(scst_cmd))) { + scst_set_delivery_status(scst_cmd, SCST_CMD_DELIVERY_ABORTED); scst_tgt_cmd_done(scst_cmd); return (0); } Modified: trunk/scst/README =================================================================== --- trunk/scst/README 2008-05-04 10:31:05 UTC (rev 363) +++ trunk/scst/README 2008-05-07 18:44:15 UTC (rev 364) @@ -349,8 +349,8 @@ or not. In "Default_target_name" target name means name of the target. In /proc/scsi_tgt each group represented as "groups/GROUP_NAME/" -subdirectory. In it there are files "devices" and "users". File -"devices" lists all devices and their LUNs in the group, file "users" +subdirectory. In it there are files "devices" and "names". File +"devices" lists all devices and their LUNs in the group, file "names" lists all names that should be bound to this group. To configure access and devices visibility management SCST provides the @@ -790,6 +790,13 @@ (usually, 32), so start from dividing the current value on 2, i.e. set 16, if /sys/block/sdX/device/queue_depth contains 32. +Note, that logged messages about QUEUE_FULL status are quite different +by nature. This is a normal work, just SCSI flow control in action. +Simply don't enable "mgmt_minor" logging level, or, alternatively, if +you are confident in the worst case performance of your back-end +storage, you can increase SCST_MAX_TGT_DEV_COMMANDS in scst_priv.h to +64. Usually initiators don't try to push more commands on the target. + Credits ------- Modified: trunk/scst/include/scst.h =================================================================== --- trunk/scst/include/scst.h 2008-05-04 10:31:05 UTC (rev 363) +++ trunk/scst/include/scst.h 2008-05-07 18:44:15 UTC (rev 364) @@ -42,6 +42,8 @@ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) typedef _Bool bool; +#define true 1 +#define false 0 #endif /* Version numbers, the same as for the kernel */ @@ -373,7 +375,7 @@ #define SCST_TGT_DEV_AFTER_EXEC_ATOMIC 10 #ifdef DEBUG_TM -#define SCST_TGT_DEV_UNDER_TM_DBG 20 +#define SCST_TGT_DEV_UNDER_TM_DBG 20 #endif /************************************************************* @@ -2080,12 +2082,6 @@ return cmd->data_direction; } -/* Returns cmd's relative data offset */ -static inline unsigned int scst_cmd_get_offset(struct scst_cmd *cmd) -{ - return 0; -} - /* Returns cmd's status byte from host device */ static inline uint8_t scst_cmd_get_status(struct scst_cmd *cmd) { @@ -2208,7 +2204,6 @@ cmd->tgt_sn = tgt_sn; } - /* * Returns 1 if the cmd was aborted, so its status is invalid and no * reply shall be sent to the remote initiator. A target driver should Modified: trunk/scst/include/scst_const.h =================================================================== --- trunk/scst/include/scst_const.h 2008-05-04 10:31:05 UTC (rev 363) +++ trunk/scst/include/scst_const.h 2008-05-07 18:44:15 UTC (rev 364) @@ -35,8 +35,9 @@ ** Allowed delivery statuses for cmd's delivery_status *************************************************************/ -#define SCST_CMD_DELIVERY_SUCCESS 0 -#define SCST_CMD_DELIVERY_FAILED -1 +#define SCST_CMD_DELIVERY_SUCCESS 0 +#define SCST_CMD_DELIVERY_FAILED -1 +#define SCST_CMD_DELIVERY_ABORTED -2 /************************************************************* ** Values for task management functions Modified: trunk/scst/src/dev_handlers/scst_vdisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_vdisk.c 2008-05-04 10:31:05 UTC (rev 363) +++ trunk/scst/src/dev_handlers/scst_vdisk.c 2008-05-07 18:44:15 UTC (rev 364) @@ -1103,7 +1103,6 @@ goto out_put; } - memset(buf, 0, sizeof(buf)); buf[0] = cmd->dev->handler->type; /* type dev */ if ((buf[0] == TYPE_ROM) || virt_dev->removable) buf[1] = 0x80; /* removable */ @@ -3352,7 +3351,7 @@ goto out; } -static void __exit exit_scst_vdisk(struct scst_dev_type *devtype, +static void exit_scst_vdisk(struct scst_dev_type *devtype, struct list_head *vdisk_dev_list) { TRACE_ENTRY(); Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2008-05-04 10:31:05 UTC (rev 363) +++ trunk/scst/src/scst_lib.c 2008-05-07 18:44:15 UTC (rev 364) @@ -3096,30 +3096,23 @@ /* It's completed and it's OK to return its result */ goto out; } - TRACE_MGMT_DBG("Flag ABORTED OTHER set for cmd %p (tag %llu)", - cmd, cmd->tag); + if (cmd->dev->tas) { + TRACE_MGMT_DBG("Flag ABORTED OTHER set for cmd %p " + "(tag %llu), returning TASK ABORTED ", cmd, + cmd->tag); scst_set_cmd_error_status(cmd, SAM_STAT_TASK_ABORTED); } else { + TRACE_MGMT_DBG("Flag ABORTED OTHER set for cmd %p " + "(tag %llu), aborting without delivery or " + "notification", cmd, cmd->tag); /* - * Abort without delivery or notification. * There is no need to check/requeue possible UA, * because, if it exists, it will be delivered - * by the "completed" branch. + * by the "completed" branch above. */ - clear_bit(SCST_CMD_ABORTED_OTHER, - &cmd->cmd_flags); + clear_bit(SCST_CMD_ABORTED_OTHER, &cmd->cmd_flags); } - } else { - if ((cmd->tgt_dev != NULL) && - scst_is_ua_sense(cmd->sense)) { - /* This UA delivery is going to fail, so requeue it */ - TRACE_MGMT_DBG("Requeuing UA for aborted cmd %p", cmd); - scst_check_set_UA(cmd->tgt_dev, cmd->sense, - SCST_SENSE_BUFFERSIZE, 1); - mempool_free(cmd->sense, scst_sense_mempool); - cmd->sense = NULL; - } } out: @@ -3402,6 +3395,7 @@ c, c->tag, tm_dbg_delayed_cmds_count); if (!test_bit(SCST_CMD_ABORTED_OTHER, &cmd->cmd_flags)) { + /* Test how completed commands handled */ if (((scst_random() % 10) == 5)) { scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); Modified: trunk/scst/src/scst_proc.c =================================================================== --- trunk/scst/src/scst_proc.c 2008-05-04 10:31:05 UTC (rev 363) +++ trunk/scst/src/scst_proc.c 2008-05-07 18:44:15 UTC (rev 364) @@ -521,7 +521,7 @@ return res; } -static void __exit scst_proc_cleanup_module_log(void) +static void scst_proc_cleanup_module_log(void) { TRACE_ENTRY(); @@ -702,7 +702,7 @@ goto out; } -static void __exit scst_proc_cleanup_groups(void) +static void scst_proc_cleanup_groups(void) { struct scst_acg *acg_tmp, *acg; Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-05-04 10:31:05 UTC (rev 363) +++ trunk/scst/src/scst_targ.c 2008-05-07 18:44:15 UTC (rev 364) @@ -3502,20 +3502,32 @@ int other_ini, int call_dev_task_mgmt_fn) { unsigned long flags; + static spinlock_t other_ini_lock = SPIN_LOCK_UNLOCKED; TRACE_ENTRY(); TRACE(((mcmd != NULL) && (mcmd->fn == SCST_ABORT_TASK)) ? TRACE_MGMT_MINOR : TRACE_MGMT, "Aborting cmd %p (tag %llu, op %x)", cmd, cmd->tag, cmd->cdb[0]); + /* To protect from concurrent aborts */ + spin_lock_irqsave(&other_ini_lock, flags); + if (other_ini) { - set_bit(SCST_CMD_ABORTED_OTHER, &cmd->cmd_flags); - smp_mb__after_set_bit(); + /* Might be necessary if command aborted several times */ + if (!test_bit(SCST_CMD_ABORTED, &cmd->cmd_flags)) { + set_bit(SCST_CMD_ABORTED_OTHER, &cmd->cmd_flags); + smp_mb__after_set_bit(); + } } else { /* Might be necessary if command aborted several times */ clear_bit(SCST_CMD_ABORTED_OTHER, &cmd->cmd_flags); } + set_bit(SCST_CMD_ABORTED, &cmd->cmd_flags); + + spin_unlock_irqrestore(&other_ini_lock, flags); + + /* * To sync with cmd->finished/done set in * scst_finish_cmd()/scst_pre_xmit_response() Modified: trunk/srpt/src/ib_srpt.c =================================================================== --- trunk/srpt/src/ib_srpt.c 2008-05-04 10:31:05 UTC (rev 363) +++ trunk/srpt/src/ib_srpt.c 2008-05-07 18:44:15 UTC (rev 364) @@ -1821,8 +1821,10 @@ else if (ch->state == RDMA_CHANNEL_CONNECTING) ret = SCST_TGT_RES_QUEUE_FULL; - if (unlikely(scst_cmd_aborted(scmnd))) + if (unlikely(scst_cmd_aborted(scmnd))) { + scst_set_delivery_status(scmnd, SCST_CMD_DELIVERY_ABORTED); ret = SCST_TGT_RES_SUCCESS; + } goto out; } @@ -1836,6 +1838,7 @@ printk(KERN_ERR PFX "%s[%d] tag= %lld already get aborted\n", __FUNCTION__, __LINE__, (unsigned long long)tag); + scst_set_delivery_status(ioctx->scmnd, SCST_CMD_DELIVERY_ABORTED); scst_tgt_cmd_done(ioctx->scmnd); goto out; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-05-13 09:27:20
|
Revision: 366 http://scst.svn.sourceforge.net/scst/?rev=366&view=rev Author: vlnb Date: 2008-05-13 02:27:16 -0700 (Tue, 13 May 2008) Log Message: ----------- Series of patches from Bart Van Assche <bar...@gm...>: - Added Makefile.scsi.Linux-2.6.24.patch and Kconfig.scsi.Linux-2.6.24.patch - Updated Makefile.scsi_tgt to reflect move of the SCST device handlers from scst/src/ to scst/src/dev_handlers/ - Added Makefile.dev_handlers - SCST include path fixed in srpt/ Makefile.in_kernel - Added script for converting the SCST source tree to a kernel patch. More comment on it: The SCST source tree as it exists in the current Subversion repository will have to be maintained for some time. And if SCST is submitted for inclusion in the mainline kernel, this tree will have to be converted to a kernel patch, reviewer comments will have to be processed, and the patch will have to be resubmitted. So it's convenient to have a script available that converts the Subversion source tree into a kernel patch. The patch below does just that: convert the scst and srpt directories into a kernel patch (iscsi-scst support will be added later on). I have tested the script contained in the patch below as follows: rm -rf linux-2.6.24 rm -rf /lib/modules/2.6.24-scst tar xjf ~vanasscb/software/downloads/linux-2.6.24.tar.bz2 cd linux-2.6.24 cp ../.config . (cd ~vanasscb/software/scst && ~vanasscb/software/scst/scripts/generate-kernel-patch \ 2.6.24) | patch -p1 make -j5 bzImage modules && make modules_install install cp -r /lib/firmware/$(uname -r) /lib/firmware/2.6.24-scst update-initramfs -k 2.6.24-scst -c reboot Modified Paths: -------------- trunk/scst/kernel/in-tree/Makefile.scsi_tgt trunk/srpt/src/Makefile.in_kernel Added Paths: ----------- trunk/scripts/ trunk/scripts/generate-kernel-patch trunk/scst/kernel/in-tree/Kconfig.scsi.Linux-2.6.24.patch trunk/scst/kernel/in-tree/Makefile.dev_handlers trunk/scst/kernel/in-tree/Makefile.scsi.Linux-2.6.24.patch Added: trunk/scripts/generate-kernel-patch =================================================================== --- trunk/scripts/generate-kernel-patch (rev 0) +++ trunk/scripts/generate-kernel-patch 2008-05-13 09:27:16 UTC (rev 366) @@ -0,0 +1,181 @@ +#!/bin/bash + +############################################################################ +# +# Script for converting the SCST source tree as it exists in the Subversion +# repository to a Linux kernel patch. +# +# Copyright (C) 2008 Bart Van Assche <bar...@gm...> +# +# 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, version 2 +# of the License. +# +# 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. +# +############################################################################ + +######################## +# Function definitions # +######################## + +# Convert an existing patch. +# $1: path of patch to be added. +# $2: path in kernel tree of file to be patched. +function add_patch { + if [ ! -e "$1" ]; then + echo "Error: could not find $1." + exit 1 + fi + + sed -e "s:^--- [^ ]*:--- orig/$2:" -e "s:^+++ [^ ]*:+++ $2:" < "$1" +} + +# Generate a patch for a file to be added to the kernel source tree. +# $1: path of file to be added. +# $2: path in kernel tree where file should be added. +function add_file { + local a b + + if [ ! -e "$1" ]; then + echo "Error: could not find $1." + exit 1 + fi + + cat <<EOF +diff -uprN orig/$2 $2 +--- orig/$2 ++++ $2 +@@ -0,0 +1,$(wc -l "$1" | { read a b; echo $a; }) @@ +EOF + sed "s/^/+/" <"$1" +} + + +######################### +# Argument verification # +######################### + +if [ ! -e scst -o ! -e iscsi-scst -o ! -e srpt ]; then + echo "Please run this script from inside the SCST subversion source tree." + exit 1 +fi + +if [ $# != 1 ]; then + echo "Usage: $0 <kernel version>." + exit 1 +fi + +#################### +# Patch Generation # +#################### + +kernel_version="$1" +kpatch=( \ + "scst/kernel/scst_exec_req_fifo-${kernel_version}.patch" \ + "iscsi-scst/kernel/patches/put_page_callback-${kernel_version}.patch" \ +) + +for p in "${kpatch[@]}" +do + if [ ! -e "$p" ]; then + echo "Error: kernel version ${kernel_version} is not supported by SCST." + echo "(could not find file $p)." + exit 1 + fi +done + + +# Kernel patches for other directories than drivers/scsi/scsi_tgt/. + +for p in "${kpatch[@]}" +do + cat "$p" + echo '' + echo '' +done + +add_patch "scst/kernel/in-tree/Kconfig.scsi.Linux-${kernel_version}.patch" \ + "linux-${kernel_version}/drivers/scsi/Kconfig" + +add_patch "scst/kernel/in-tree/Makefile.scsi.Linux-${kernel_version}.patch" \ + "linux-${kernel_version}/drivers/scsi/Makefile" + + +# Directory include/scsi_tgt/ + +for f in scst/include/*h +do + add_file "${f}" "linux-${kernel_version}/include/scsi_tgt/${f#scst/include/}" +done + + +# Directory drivers/scsi/scsi_tgt/ + +add_file "scst/kernel/in-tree/Kconfig.scsi_tgt" \ + "drivers/scsi/scsi_tgt/Kconfig" +add_file "scst/kernel/in-tree/Makefile.scsi_tgt" \ + "drivers/scsi/scsi_tgt/Makefile" + + +for f in scst/src/*[ch] +do + add_file ${f} linux-${kernel_version}/drivers/scsi/scsi_tgt/${f#scst/src/} + echo '' + echo '' +done + + +# Directory drivers/scsi/scsi_tgt/dev_handlers/ + +add_file "scst/kernel/in-tree/Makefile.dev_handlers" \ + "linux-${kernel_version}/drivers/scsi/scsi_tgt/dev_handlers/Makefile" + +for f in scst/src/dev_handlers/*.[ch] +do + add_file ${f} linux-${kernel_version}/drivers/scsi/scsi_tgt/dev_handlers/${f#scst/src/dev_handlers/} + echo '' + echo '' +done + + +# Directory drivers/infiniband/ulp/srpt/ + +cat <<'EOF' +diff -uprN orig/linux-2.6.24/drivers/infiniband/Kconfig linux-2.6.24/drivers/infiniband/Kconfig +--- orig/linux-2.6.24/drivers/infiniband/Kconfig 2008-01-24 23:58:37.000000000 +0100 ++++ linux-2.6.24/drivers/infiniband/Kconfig 2008-05-09 13:55:27.000000000 +0200 +@@ -51,6 +51,8 @@ + + source "drivers/infiniband/ulp/srp/Kconfig" + ++source "drivers/infiniband/ulp/srpt/Kconfig" ++ + source "drivers/infiniband/ulp/iser/Kconfig" + + endif # INFINIBAND +diff -uprN orig/linux-2.6.24/drivers/infiniband/Makefile linux-2.6.24/drivers/infiniband/Makefile +--- orig/linux-2.6.24/drivers/infiniband/Makefile 2008-01-24 23:58:37.000000000 +0100 ++++ linux-2.6.24/drivers/infiniband/Makefile 2008-05-09 13:57:00.000000000 +0200 +@@ -7,4 +7,5 @@ + obj-$(CONFIG_MLX4_INFINIBAND) += hw/mlx4/ + obj-$(CONFIG_INFINIBAND_IPOIB) += ulp/ipoib/ + obj-$(CONFIG_INFINIBAND_SRP) += ulp/srp/ ++obj-$(CONFIG_INFINIBAND_SRPT) += ulp/srpt/ + obj-$(CONFIG_INFINIBAND_ISER) += ulp/iser/ +EOF + +add_file "srpt/src/Kconfig" "drivers/infiniband/ulp/srpt/Kconfig" + +add_file "srpt/src/Makefile.in_kernel" "drivers/infiniband/ulp/srpt/Makefile" + +for f in srpt/src/*[ch] +do + add_file ${f} linux-${kernel_version}/drivers/infiniband/ulp/srpt/${f#srpt/src/} + echo '' + echo '' +done Property changes on: trunk/scripts/generate-kernel-patch ___________________________________________________________________ Name: svn:executable + * Added: trunk/scst/kernel/in-tree/Kconfig.scsi.Linux-2.6.24.patch =================================================================== --- trunk/scst/kernel/in-tree/Kconfig.scsi.Linux-2.6.24.patch (rev 0) +++ trunk/scst/kernel/in-tree/Kconfig.scsi.Linux-2.6.24.patch 2008-05-13 09:27:16 UTC (rev 366) @@ -0,0 +1,11 @@ +--- orig/linux-2.6.24/drivers/scsi/Kconfig 2008-01-24 23:58:37.000000000 +0100 ++++ linux-2.6.24/drivers/scsi/Kconfig 2008-05-09 13:25:39.000000000 +0200 +@@ -1351,6 +1351,8 @@ config SCSI_QLOGICPTI + source "drivers/scsi/qla2xxx/Kconfig" + source "drivers/scsi/qla4xxx/Kconfig" + ++source "drivers/scsi/scsi_tgt/Kconfig" ++ + config SCSI_LPFC + tristate "Emulex LightPulse Fibre Channel Support" + depends on PCI && SCSI Added: trunk/scst/kernel/in-tree/Makefile.dev_handlers =================================================================== --- trunk/scst/kernel/in-tree/Makefile.dev_handlers (rev 0) +++ trunk/scst/kernel/in-tree/Makefile.dev_handlers 2008-05-13 09:27:16 UTC (rev 366) @@ -0,0 +1,14 @@ +EXTRA_CFLAGS += -Iinclude/scsi_tgt -Wextra -Wno-unused-parameter + +obj-m := scst_cdrom.o scst_changer.o scst_disk.o scst_modisk.o scst_tape.o \ + scst_vdisk.o scst_raid.o scst_processor.o scst_user.o + +obj-$(CONFIG_SCSI_TARGET_DISK) += scst_disk.o +obj-$(CONFIG_SCSI_TARGET_TAPE) += scst_tape.o +obj-$(CONFIG_SCSI_TARGET_CDROM) += scst_cdrom.o +obj-$(CONFIG_SCSI_TARGET_MODISK) += scst_modisk.o +obj-$(CONFIG_SCSI_TARGET_CHANGER) += scst_changer.o +obj-$(CONFIG_SCSI_TARGET_RAID) += scst_raid.o +obj-$(CONFIG_SCSI_TARGET_PROCESSOR) += scst_processor.o +obj-$(CONFIG_SCSI_TARGET_VDISK) += scst_vdisk.o +obj-$(CONFIG_SCSI_TARGET_USER) += scst_user.o Added: trunk/scst/kernel/in-tree/Makefile.scsi.Linux-2.6.24.patch =================================================================== --- trunk/scst/kernel/in-tree/Makefile.scsi.Linux-2.6.24.patch (rev 0) +++ trunk/scst/kernel/in-tree/Makefile.scsi.Linux-2.6.24.patch 2008-05-13 09:27:16 UTC (rev 366) @@ -0,0 +1,11 @@ +diff -uprN orig/linux-2.6.24/drivers/scsi/Makefile linux-2.6.24/drivers/scsi/Makefile +--- orig/linux-2.6.24/drivers/scsi/Makefile 2008-01-24 23:58:37.000000000 +0100 ++++ linux-2.6.24/drivers/scsi/Makefile 2008-05-09 13:05:36.000000000 +0200 +@@ -88,6 +88,7 @@ obj-$(CONFIG_PCMCIA_QLOGIC) += qlogicfas + obj-$(CONFIG_SCSI_QLOGIC_1280) += qla1280.o + obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx/ + obj-$(CONFIG_SCSI_QLA_ISCSI) += qla4xxx/ ++obj-$(CONFIG_SCSI_TARGET) += scsi_tgt/ + obj-$(CONFIG_SCSI_LPFC) += lpfc/ + obj-$(CONFIG_SCSI_PAS16) += pas16.o + obj-$(CONFIG_SCSI_SEAGATE) += seagate.o Modified: trunk/scst/kernel/in-tree/Makefile.scsi_tgt =================================================================== --- trunk/scst/kernel/in-tree/Makefile.scsi_tgt 2008-05-12 15:58:34 UTC (rev 365) +++ trunk/scst/kernel/in-tree/Makefile.scsi_tgt 2008-05-13 09:27:16 UTC (rev 366) @@ -1,19 +1,11 @@ +EXTRA_CFLAGS += -Iinclude/scsi_tgt -Wextra -Wno-unused-parameter -EXTRA_CFLAGS += -Iinclude/scsi +scst-y += scst_main.o +scst-y += scst_targ.o +scst-y += scst_lib.o +scst-y += scst_proc.o +scst-y += scst_mem.o +scst-y += scst_debug.o -scsi_tgt-y += scst.o -scsi_tgt-y += scst_targ.o -scsi_tgt-y += scst_lib.o -scsi_tgt-y += scst_proc.o -scsi_tgt-y += scst_mem.o +obj-$(CONFIG_SCSI_TARGET) += scst.o dev_handlers/ -obj-$(CONFIG_SCSI_TARGET) += scsi_tgt.o -obj-$(CONFIG_SCSI_TARGET_DISK) += scst_disk.o -obj-$(CONFIG_SCSI_TARGET_TAPE) += scst_tape.o -obj-$(CONFIG_SCSI_TARGET_CDROM) += scst_cdrom.o -obj-$(CONFIG_SCSI_TARGET_MODISK) += scst_modisk.o -obj-$(CONFIG_SCSI_TARGET_CHANGER) += scst_changer.o -obj-$(CONFIG_SCSI_TARGET_RAID) += scst_raid.o -obj-$(CONFIG_SCSI_TARGET_PROCESSOR) += scst_processor.o -obj-$(CONFIG_SCSI_TARGET_VDISK) += scst_vdisk.o -obj-$(CONFIG_SCSI_TARGET_USER) += scst_user.o Modified: trunk/srpt/src/Makefile.in_kernel =================================================================== --- trunk/srpt/src/Makefile.in_kernel 2008-05-12 15:58:34 UTC (rev 365) +++ trunk/srpt/src/Makefile.in_kernel 2008-05-13 09:27:16 UTC (rev 366) @@ -1,4 +1,4 @@ EXTRA_CFLAGS += -Idrivers/infiniband/include -EXTRA_CFLAGS += -I/usr/local/include/scst +EXTRA_CFLAGS += -Iinclude/scsi_tgt obj-$(CONFIG_INFINIBAND_SRPT) += ib_srpt.o This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-05-15 17:28:07
|
Revision: 374 http://scst.svn.sourceforge.net/scst/?rev=374&view=rev Author: vlnb Date: 2008-05-15 10:27:50 -0700 (Thu, 15 May 2008) Log Message: ----------- - Fixed sg_tablesize in qla2x00t to be per target card, not global - Minor cleanups Modified Paths: -------------- trunk/iscsi-scst/README trunk/qla2x00t/qla2x00-target/qla2x00t.c trunk/scst/include/scst.h Modified: trunk/iscsi-scst/README =================================================================== --- trunk/iscsi-scst/README 2008-05-15 15:00:21 UTC (rev 373) +++ trunk/iscsi-scst/README 2008-05-15 17:27:50 UTC (rev 374) @@ -145,7 +145,7 @@ ------------ Currently some iscsi-scst-adm functionality is broken. But, from one -side, at the moment I don't have time to look at it and and, from other +side, at the moment I don't have time to look at it and, from other side, in contrast to IET, in iSCSI-SCST this utility doesn't worth much, since all devices management is done using SCST's /proc interface. What's remained for iscsi-scst-adm is managing iSCSI targets and their Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c =================================================================== --- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2008-05-15 15:00:21 UTC (rev 373) +++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2008-05-15 17:27:50 UTC (rev 374) @@ -85,22 +85,22 @@ #endif struct scst_tgt_template tgt_template = { - name:"qla2x00tgt", - sg_tablesize:0, - use_clustering:1, + name: "qla2x00tgt", + sg_tablesize: 0, + use_clustering: 1, #ifdef DEBUG_WORK_IN_THREAD - xmit_response_atomic:0, - rdy_to_xfer_atomic:0, + xmit_response_atomic: 0, + rdy_to_xfer_atomic: 0, #else - xmit_response_atomic:1, - rdy_to_xfer_atomic:1, + xmit_response_atomic: 1, + rdy_to_xfer_atomic: 1, #endif - detect:q2t_target_detect, - release:q2t_target_release, - xmit_response:q2t_xmit_response, - rdy_to_xfer:q2t_rdy_to_xfer, - on_free_cmd:q2t_on_free_cmd, - task_mgmt_fn_done:q2t_task_mgmt_fn_done, + detect: q2t_target_detect, + release: q2t_target_release, + xmit_response: q2t_xmit_response, + rdy_to_xfer: q2t_rdy_to_xfer, + on_free_cmd: q2t_on_free_cmd, + task_mgmt_fn_done: q2t_task_mgmt_fn_done, }; struct kmem_cache *q2t_cmd_cachep = NULL; @@ -2028,14 +2028,18 @@ { struct q2t_tgt *tgt = NULL; unsigned long flags = 0; - char *wwn; + TRACE_ENTRY(); sBUG_ON(ha == NULL); switch (action) { - case ENABLE_TARGET_MODE : + case ENABLE_TARGET_MODE: + { + char *wwn; + int sg_tablesize; + tgt = kzalloc(sizeof(*tgt), GFP_KERNEL); if (tgt == NULL) { TRACE(TRACE_OUT_OF_MEM, "%s", @@ -2053,17 +2057,15 @@ "Addressing Enabled", ha->instance); tgt->tgt_enable_64bit_addr = 1; /* 3 is reserved */ - tgt_template.sg_tablesize = + sg_tablesize = QLA_MAX_SG64(ha->request_q_length - 3); tgt->datasegs_per_cmd = DATASEGS_PER_COMMAND64; tgt->datasegs_per_cont = DATASEGS_PER_CONT64; } else { PRINT_INFO("qla2x00tgt(%ld): Using 32 Bit " "PCI Addressing", ha->instance); - if (tgt_template.sg_tablesize == 0) { - tgt_template.sg_tablesize = - QLA_MAX_SG32(ha->request_q_length - 3); - } + sg_tablesize = + QLA_MAX_SG32(ha->request_q_length - 3); tgt->datasegs_per_cmd = DATASEGS_PER_COMMAND32; tgt->datasegs_per_cont = DATASEGS_PER_CONT32; } @@ -2082,7 +2084,8 @@ kfree(tgt); goto out; } - + + scst_tgt_set_sg_tablesize(tgt->scst_tgt, sg_tablesize); scst_tgt_set_tgt_priv(tgt->scst_tgt, tgt); spin_lock_irqsave(&ha->hardware_lock, flags); @@ -2094,7 +2097,8 @@ tgt_data.enable_lun(ha); break; - case DISABLE_TARGET_MODE : + } + case DISABLE_TARGET_MODE: spin_lock_irqsave(&ha->hardware_lock, flags); if (ha->tgt == NULL) { /* ensure target mode is marked as off */ @@ -2114,15 +2118,16 @@ TRACE_DBG("Shutting down host %ld(%ld,%p)", ha->host_no, ha->instance, ha); scst_unregister(tgt->scst_tgt); - /* free of tgt happens via callback q2t_target_release + /* + * Free of tgt happens via callback q2t_target_release * called from scst_unregister, so we shouldn't touch it again */ tgt = NULL; break; - default : - printk("%s: Reached default case of enumish switch statment %d", - __func__, action); + default: + PRINT_ERROR("Unknown action %d", action); + break; } out: @@ -2175,8 +2180,8 @@ struct proc_dir_entry *p, *root; TRACE_ENTRY(); + root = scst_proc_get_tgt_root(templ); - if (root) { /* create the proc file entry for the device */ q2t_log_proc_data.data = (void *)templ->name; @@ -2206,12 +2211,13 @@ TRACE_ENTRY(); root = scst_proc_get_tgt_root(templ); - if (root) { remove_proc_entry(Q2T_PROC_LOG_ENTRY_NAME, root); } + TRACE_EXIT(); #endif + return; } static int __init q2t_init(void) @@ -2228,16 +2234,16 @@ res = scst_register_target_template(&tgt_template); if (res < 0) - goto out; + goto out_free_kmem; - /* qla2xxx_tgt_register_driver() happens in q2t_target_detect + /* + * qla2xxx_tgt_register_driver() happens in q2t_target_detect * called via scst_register_target_template() */ res = q2t_proc_log_entry_build(&tgt_template); - if (res < 0) { + if (res < 0) goto out_unreg_target; - } out: TRACE_EXIT(); @@ -2245,6 +2251,10 @@ out_unreg_target: scst_unregister_target_template(&tgt_template); + +out_free_kmem: + kmem_cache_destroy(q2t_cmd_cachep); + qla2xxx_tgt_unregister_driver(); goto out; } Modified: trunk/scst/include/scst.h =================================================================== --- trunk/scst/include/scst.h 2008-05-15 15:00:21 UTC (rev 373) +++ trunk/scst/include/scst.h 2008-05-15 17:27:50 UTC (rev 374) @@ -1973,6 +1973,19 @@ void scst_unregister_virtual_device(int id); /* + * Get/Set functions for tgt's sg_tablesize + */ +static inline int scst_tgt_get_sg_tablesize(struct scst_tgt *tgt) +{ + return tgt->sg_tablesize; +} + +static inline void scst_tgt_set_sg_tablesize(struct scst_tgt *tgt, int val) +{ + tgt->sg_tablesize = val; +} + +/* * Get/Set functions for tgt's target private data */ static inline void *scst_tgt_get_tgt_priv(struct scst_tgt *tgt) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-05-21 15:43:59
|
Revision: 383 http://scst.svn.sourceforge.net/scst/?rev=383&view=rev Author: vlnb Date: 2008-05-21 08:43:54 -0700 (Wed, 21 May 2008) Log Message: ----------- Patch from Bart Van Assche <bar...@gm...>: The patch below fixes the following class of checkpatch.pl errors: ERROR("(foo*)" should be "(foo *)". Or: another whitespace-only change. I have verified that the output of svn diff -w -x is empty for this patch. Signed-off-by: Bart Van Assche <bar...@gm...> Modified Paths: -------------- trunk/iscsi-scst/kernel/config.c trunk/iscsi-scst/kernel/iscsi.c trunk/iscsi-scst/kernel/nthread.c trunk/iscsi-scst/usr/event.c trunk/qla2x00t/qla2x00-target/qla2x00t.c trunk/qla2x00t/qla_attr.c trunk/qla2x00t/qla_isr.c trunk/scst/src/dev_handlers/scst_user.c trunk/scst/src/dev_handlers/scst_vdisk.c trunk/scst/src/scst_lib.c trunk/scst/src/scst_main.c trunk/scst/src/scst_mem.c trunk/scst/src/scst_proc.c trunk/scst/src/scst_targ.c trunk/srpt/src/ib_srpt.c trunk/usr/fileio/common.c Modified: trunk/iscsi-scst/kernel/config.c =================================================================== --- trunk/iscsi-scst/kernel/config.c 2008-05-21 15:40:33 UTC (rev 382) +++ trunk/iscsi-scst/kernel/config.c 2008-05-21 15:43:54 UTC (rev 383) @@ -374,7 +374,7 @@ char ver[sizeof(ISCSI_SCST_INTERFACE_VERSION)+1]; int res; - res = copy_from_user(ver, (void*)arg, sizeof(ver)); + res = copy_from_user(ver, (void *)arg, sizeof(ver)); if (res < 0) { PRINT_ERROR("%s", "Unable to get version string"); goto out; Modified: trunk/iscsi-scst/kernel/iscsi.c =================================================================== --- trunk/iscsi-scst/kernel/iscsi.c 2008-05-21 15:40:33 UTC (rev 382) +++ trunk/iscsi-scst/kernel/iscsi.c 2008-05-21 15:43:54 UTC (rev 383) @@ -569,7 +569,7 @@ if (size & 3) { u32 last_off = offset + size; int idx = last_off >> PAGE_SHIFT; - u8 *p = (u8*)page_address(sg_page(&cmnd->sg[idx])) + + u8 *p = (u8 *)page_address(sg_page(&cmnd->sg[idx])) + (last_off & ~PAGE_MASK); int i = 4 - (size & 3); while (i--) @@ -1137,7 +1137,7 @@ static int iscsi_pre_exec(struct scst_cmd *scst_cmd) { int res = SCST_PREPROCESS_STATUS_SUCCESS; - struct iscsi_cmnd *req = (struct iscsi_cmnd*) + struct iscsi_cmnd *req = (struct iscsi_cmnd *) scst_cmd_get_tgt_priv(scst_cmd); struct iscsi_cmnd *c, *t; @@ -1299,7 +1299,7 @@ req->dec_active_cmnds = 1; scst_cmd = scst_rx_cmd(session->scst_sess, - (uint8_t*)&req_hdr->lun, sizeof(req_hdr->lun), + (uint8_t *)&req_hdr->lun, sizeof(req_hdr->lun), req_hdr->scb, sizeof(req_hdr->scb), SCST_NON_ATOMIC); if (scst_cmd == NULL) { create_status_rsp(req, SAM_STAT_BUSY, NULL, 0); @@ -2468,7 +2468,7 @@ static void iscsi_preprocessing_done(struct scst_cmd *scst_cmd) { - struct iscsi_cmnd *req = (struct iscsi_cmnd*) + struct iscsi_cmnd *req = (struct iscsi_cmnd *) scst_cmd_get_tgt_priv(scst_cmd); TRACE_DBG("req %p", req); @@ -2541,7 +2541,7 @@ static int iscsi_xmit_response(struct scst_cmd *scst_cmd) { int is_send_status = scst_cmd_get_is_send_status(scst_cmd); - struct iscsi_cmnd *req = (struct iscsi_cmnd*) + struct iscsi_cmnd *req = (struct iscsi_cmnd *) scst_cmd_get_tgt_priv(scst_cmd); struct iscsi_conn *conn = req->conn; int status = scst_cmd_get_status(scst_cmd); @@ -2803,7 +2803,7 @@ static void iscsi_task_mgmt_fn_done(struct scst_mgmt_cmd *scst_mcmd) { - struct iscsi_cmnd *req = (struct iscsi_cmnd*) + struct iscsi_cmnd *req = (struct iscsi_cmnd *) scst_mgmt_cmd_get_tgt_priv(scst_mcmd); int status = iscsi_get_mgmt_response(scst_mgmt_cmd_get_status(scst_mcmd)); Modified: trunk/iscsi-scst/kernel/nthread.c =================================================================== --- trunk/iscsi-scst/kernel/nthread.c 2008-05-21 15:40:33 UTC (rev 382) +++ trunk/iscsi-scst/kernel/nthread.c 2008-05-21 15:43:54 UTC (rev 383) @@ -874,7 +874,7 @@ void iscsi_get_page_callback(struct page *page) { - struct iscsi_cmnd *cmd = (struct iscsi_cmnd*)page->net_priv; + struct iscsi_cmnd *cmd = (struct iscsi_cmnd *)page->net_priv; TRACE_NET_PAGE("page %p, _count %d", page, atomic_read(&page->_count)); @@ -901,7 +901,7 @@ void iscsi_put_page_callback(struct page *page) { - struct iscsi_cmnd *cmd = (struct iscsi_cmnd*)page->net_priv; + struct iscsi_cmnd *cmd = (struct iscsi_cmnd *)page->net_priv; TRACE_NET_PAGE("page %p, _count %d", page, atomic_read(&page->_count)); Modified: trunk/iscsi-scst/usr/event.c =================================================================== --- trunk/iscsi-scst/usr/event.c 2008-05-21 15:40:33 UTC (rev 382) +++ trunk/iscsi-scst/usr/event.c 2008-05-21 15:43:54 UTC (rev 383) @@ -49,7 +49,7 @@ nlh.nlmsg_type = 0; memset(&msg, 0, sizeof(msg)); - msg.msg_name= (void*)&dest_addr; + msg.msg_name= (void *)&dest_addr; msg.msg_namelen = sizeof(dest_addr); msg.msg_iov = iov; msg.msg_iovlen = 2; @@ -69,7 +69,7 @@ iov[1].iov_len = len; memset(&msg, 0, sizeof(msg)); - msg.msg_name= (void*)&src_addr; + msg.msg_name= (void *)&src_addr; msg.msg_namelen = sizeof(src_addr); msg.msg_iov = iov; msg.msg_iovlen = 2; Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c =================================================================== --- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2008-05-21 15:40:33 UTC (rev 382) +++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2008-05-21 15:43:54 UTC (rev 383) @@ -914,7 +914,7 @@ goto out_unlock; } - ctio = (ctio_ret_entry_t*)tgt_data.req_pkt(ha); + ctio = (ctio_ret_entry_t *)tgt_data.req_pkt(ha); if (ctio == NULL) { PRINT_ERROR("qla2x00tgt(%ld): %s failed: unable to allocate " "request packet", ha->instance, __func__); Modified: trunk/qla2x00t/qla_attr.c =================================================================== --- trunk/qla2x00t/qla_attr.c 2008-05-21 15:40:33 UTC (rev 382) +++ trunk/qla2x00t/qla_attr.c 2008-05-21 15:43:54 UTC (rev 383) @@ -143,7 +143,7 @@ dma_addr_t pmap_dma; port_data_t *pmap; ulong dma_size = 0x100*sizeof(*pmap); - pmap = (port_data_t*)dma_alloc_coherent(&ha->pdev->dev, dma_size, + pmap = (port_data_t *)dma_alloc_coherent(&ha->pdev->dev, dma_size, &pmap_dma, GFP_KERNEL); if (pmap == NULL) { size = snprintf(buffer, max_size, "DMA Alloc failed of %ld", Modified: trunk/qla2x00t/qla_isr.c =================================================================== --- trunk/qla2x00t/qla_isr.c 2008-05-21 15:40:33 UTC (rev 382) +++ trunk/qla2x00t/qla_isr.c 2008-05-21 15:43:54 UTC (rev 383) @@ -1373,7 +1373,7 @@ #if defined(QL_DEBUG_LEVEL_2) if (pkt->entry_status & RF_INV_E_ORDER) { qla_printk(KERN_ERR, ha, "%s: Invalid Entry Order:\n", __func__); - qla2x00_dump_buffer((void*)pkt, sizeof(*pkt)); + qla2x00_dump_buffer((void *)pkt, sizeof(*pkt)); } else if (pkt->entry_status & RF_INV_E_COUNT) qla_printk(KERN_ERR, ha, "%s: Invalid Entry Count\n", __func__); else if (pkt->entry_status & RF_INV_E_PARAM) Modified: trunk/scst/src/dev_handlers/scst_user.c =================================================================== --- trunk/scst/src/dev_handlers/scst_user.c 2008-05-21 15:40:33 UTC (rev 382) +++ trunk/scst/src/dev_handlers/scst_user.c 2008-05-21 15:43:54 UTC (rev 383) @@ -327,7 +327,7 @@ static struct page *dev_user_alloc_pages(struct scatterlist *sg, gfp_t gfp_mask, void *priv) { - struct scst_user_cmd *ucmd = (struct scst_user_cmd*)priv; + struct scst_user_cmd *ucmd = (struct scst_user_cmd *)priv; int offset = 0; TRACE_ENTRY(); @@ -426,7 +426,7 @@ static void dev_user_free_sg_entries(struct scatterlist *sg, int sg_count, void *priv) { - struct scst_user_cmd *ucmd = (struct scst_user_cmd*)priv; + struct scst_user_cmd *ucmd = (struct scst_user_cmd *)priv; TRACE_MEM("Freeing data pages (sg=%p, sg_count=%d, priv %p)", sg, sg_count, ucmd); @@ -493,7 +493,7 @@ &cmd->sg_cnt, &ucmd->sgv, ucmd); if (cmd->sg != NULL) { struct scst_user_cmd *buf_ucmd = - (struct scst_user_cmd*)sgv_get_priv(ucmd->sgv); + (struct scst_user_cmd *)sgv_get_priv(ucmd->sgv); TRACE_MEM("Buf ucmd %p", buf_ucmd); @@ -641,7 +641,7 @@ static int dev_user_get_block(struct scst_cmd *cmd) { - struct scst_user_dev *dev = (struct scst_user_dev*)cmd->dev->dh_priv; + struct scst_user_dev *dev = (struct scst_user_dev *)cmd->dev->dh_priv; /* * No need for locks here, since *_detach() can not be * called, when there are existing commands. @@ -655,7 +655,7 @@ int rc, res = SCST_CMD_STATE_DEFAULT; struct scst_user_cmd *ucmd; int atomic = scst_cmd_atomic(cmd); - struct scst_user_dev *dev = (struct scst_user_dev*)cmd->dev->dh_priv; + struct scst_user_dev *dev = (struct scst_user_dev *)cmd->dev->dh_priv; int gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL; TRACE_ENTRY(); @@ -674,7 +674,7 @@ ucmd->cmd = cmd; cmd->dh_priv = ucmd; } else { - ucmd = (struct scst_user_cmd*)cmd->dh_priv; + ucmd = (struct scst_user_cmd *)cmd->dh_priv; TRACE_DBG("Used ucmd %p, state %x", ucmd, ucmd->state); } @@ -783,7 +783,7 @@ static int dev_user_exec(struct scst_cmd *cmd) { - struct scst_user_cmd *ucmd = (struct scst_user_cmd*)cmd->dh_priv; + struct scst_user_cmd *ucmd = (struct scst_user_cmd *)cmd->dh_priv; int res = SCST_EXEC_COMPLETED; TRACE_ENTRY(); @@ -850,7 +850,7 @@ static void dev_user_on_free_cmd(struct scst_cmd *cmd) { - struct scst_user_cmd *ucmd = (struct scst_user_cmd*)cmd->dh_priv; + struct scst_user_cmd *ucmd = (struct scst_user_cmd *)cmd->dh_priv; TRACE_ENTRY(); @@ -893,7 +893,7 @@ static void dev_user_set_block(struct scst_cmd *cmd, int block) { - struct scst_user_dev *dev = (struct scst_user_dev*)cmd->dev->dh_priv; + struct scst_user_dev *dev = (struct scst_user_dev *)cmd->dev->dh_priv; /* * No need for locks here, since *_detach() can not be * called, when there are existing commands. @@ -1282,7 +1282,7 @@ if (res != 0) goto out_compl; res = copy_from_user(cmd->sense, - (void*)(unsigned long)ereply->psense_buffer, + (void *)(unsigned long)ereply->psense_buffer, min((unsigned int)SCST_SENSE_BUFFERSIZE, (unsigned int)ereply->sense_len)); if (res < 0) { @@ -1429,7 +1429,7 @@ TRACE_ENTRY(); mutex_lock(&dev_priv_mutex); - dev = (struct scst_user_dev*)file->private_data; + dev = (struct scst_user_dev *)file->private_data; res = dev_user_check_reg(dev); if (res != 0) { mutex_unlock(&dev_priv_mutex); @@ -1444,7 +1444,7 @@ goto out_up; } - res = copy_from_user(reply, (void*)arg, sizeof(*reply)); + res = copy_from_user(reply, (void *)arg, sizeof(*reply)); if (res < 0) goto out_free; @@ -1679,7 +1679,7 @@ TRACE_ENTRY(); mutex_lock(&dev_priv_mutex); - dev = (struct scst_user_dev*)file->private_data; + dev = (struct scst_user_dev *)file->private_data; res = dev_user_check_reg(dev); if (res != 0) { mutex_unlock(&dev_priv_mutex); @@ -1688,7 +1688,7 @@ down_read(&dev->dev_rwsem); mutex_unlock(&dev_priv_mutex); - res = copy_from_user(&ureply, (void*)arg, sizeof(ureply)); + res = copy_from_user(&ureply, (void *)arg, sizeof(ureply)); if (res < 0) goto out_up; @@ -1702,8 +1702,8 @@ if (ureply != 0) { unsigned long u = (unsigned long)ureply; - reply = (struct scst_user_reply_cmd*)cmd; - res = copy_from_user(reply, (void*)u, sizeof(*reply)); + reply = (struct scst_user_reply_cmd *)cmd; + res = copy_from_user(reply, (void *)u, sizeof(*reply)); if (res < 0) goto out_free; @@ -1723,7 +1723,7 @@ *cmd = ucmd->user_cmd; spin_unlock_irq(&dev->cmd_lists.cmd_list_lock); TRACE_BUFFER("UCMD", cmd, sizeof(*cmd)); - res = copy_to_user((void*)arg, cmd, sizeof(*cmd)); + res = copy_to_user((void *)arg, cmd, sizeof(*cmd)); } else spin_unlock_irq(&dev->cmd_lists.cmd_list_lock); @@ -1770,7 +1770,7 @@ res = -ENOMEM; goto out; } - res = copy_from_user(dev_desc, (void*)arg, sizeof(*dev_desc)); + res = copy_from_user(dev_desc, (void *)arg, sizeof(*dev_desc)); if (res < 0) { kfree(dev_desc); goto out; @@ -1786,7 +1786,7 @@ { struct scst_user_opt opt; TRACE_DBG("%s", "SET_OPTIONS"); - res = copy_from_user(&opt, (void*)arg, sizeof(opt)); + res = copy_from_user(&opt, (void *)arg, sizeof(opt)); if (res < 0) goto out; TRACE_BUFFER("opt", &opt, sizeof(opt)); @@ -1796,7 +1796,7 @@ case SCST_USER_GET_OPTIONS: TRACE_DBG("%s", "GET_OPTIONS"); - res = dev_user_get_opt(file, (void*)arg); + res = dev_user_get_opt(file, (void *)arg); break; default: @@ -1818,7 +1818,7 @@ TRACE_ENTRY(); mutex_lock(&dev_priv_mutex); - dev = (struct scst_user_dev*)file->private_data; + dev = (struct scst_user_dev *)file->private_data; res = dev_user_check_reg(dev); if (res != 0) { mutex_unlock(&dev_priv_mutex); @@ -2136,7 +2136,7 @@ { int res, rc; struct scst_user_cmd *ucmd; - struct scst_user_dev *dev = (struct scst_user_dev*)tgt_dev->dev->dh_priv; + struct scst_user_dev *dev = (struct scst_user_dev *)tgt_dev->dev->dh_priv; struct scst_user_cmd *ucmd_to_abort = NULL; TRACE_ENTRY(); @@ -2155,7 +2155,7 @@ ucmd->user_cmd.tm_cmd.cmd_sn_set = mcmd->cmd_sn_set; if (mcmd->cmd_to_abort != NULL) { - ucmd_to_abort = (struct scst_user_cmd*)mcmd->cmd_to_abort->dh_priv; + ucmd_to_abort = (struct scst_user_cmd *)mcmd->cmd_to_abort->dh_priv; if (ucmd_to_abort != NULL) ucmd->user_cmd.tm_cmd.cmd_h_to_abort = ucmd_to_abort->h; } @@ -2261,7 +2261,7 @@ static void dev_user_detach(struct scst_device *sdev) { - struct scst_user_dev *dev = (struct scst_user_dev*)sdev->dh_priv; + struct scst_user_dev *dev = (struct scst_user_dev *)sdev->dh_priv; TRACE_ENTRY(); @@ -2315,7 +2315,7 @@ static int dev_user_attach_tgt(struct scst_tgt_dev *tgt_dev) { struct scst_user_dev *dev = - (struct scst_user_dev*)tgt_dev->dev->dh_priv; + (struct scst_user_dev *)tgt_dev->dev->dh_priv; int res = 0, rc; struct scst_user_cmd *ucmd; @@ -2401,14 +2401,14 @@ #endif { #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) - struct scst_user_pre_unreg_sess_obj *pd = (struct scst_user_pre_unreg_sess_obj*)p; + struct scst_user_pre_unreg_sess_obj *pd = (struct scst_user_pre_unreg_sess_obj *)p; #else struct scst_user_pre_unreg_sess_obj *pd = container_of( - (struct delayed_work*)work, struct scst_user_pre_unreg_sess_obj, + (struct delayed_work *)work, struct scst_user_pre_unreg_sess_obj, pre_unreg_sess_work); #endif struct scst_user_dev *dev = - (struct scst_user_dev*)pd->tgt_dev->dev->dh_priv; + (struct scst_user_dev *)pd->tgt_dev->dev->dh_priv; TRACE_ENTRY(); @@ -2433,7 +2433,7 @@ static void dev_user_pre_unreg_sess(struct scst_tgt_dev *tgt_dev) { struct scst_user_dev *dev = - (struct scst_user_dev*)tgt_dev->dev->dh_priv; + (struct scst_user_dev *)tgt_dev->dev->dh_priv; struct scst_user_pre_unreg_sess_obj *pd; TRACE_ENTRY(); @@ -2465,7 +2465,7 @@ static void dev_user_detach_tgt(struct scst_tgt_dev *tgt_dev) { struct scst_user_dev *dev = - (struct scst_user_dev*)tgt_dev->dev->dh_priv; + (struct scst_user_dev *)tgt_dev->dev->dh_priv; struct scst_user_cmd *ucmd; struct scst_user_pre_unreg_sess_obj *pd = NULL, *p; @@ -2578,7 +2578,7 @@ char ver[sizeof(DEV_USER_VERSION)+1]; int res; - res = copy_from_user(ver, (void*)(unsigned long)dev_desc->version_str, + res = copy_from_user(ver, (void *)(unsigned long)dev_desc->version_str, sizeof(ver)); if (res < 0) { PRINT_ERROR("%s", "Unable to get version string"); @@ -2840,7 +2840,7 @@ TRACE_ENTRY(); mutex_lock(&dev_priv_mutex); - dev = (struct scst_user_dev*)file->private_data; + dev = (struct scst_user_dev *)file->private_data; res = dev_user_check_reg(dev); if (res != 0) { mutex_unlock(&dev_priv_mutex); @@ -2869,7 +2869,7 @@ TRACE_ENTRY(); mutex_lock(&dev_priv_mutex); - dev = (struct scst_user_dev*)file->private_data; + dev = (struct scst_user_dev *)file->private_data; res = dev_user_check_reg(dev); if (res != 0) { mutex_unlock(&dev_priv_mutex); @@ -2926,7 +2926,7 @@ TRACE_ENTRY(); mutex_lock(&dev_priv_mutex); - dev = (struct scst_user_dev*)file->private_data; + dev = (struct scst_user_dev *)file->private_data; if (dev == NULL) { mutex_unlock(&dev_priv_mutex); goto out; Modified: trunk/scst/src/dev_handlers/scst_vdisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_vdisk.c 2008-05-21 15:40:33 UTC (rev 382) +++ trunk/scst/src/dev_handlers/scst_vdisk.c 2008-05-21 15:43:54 UTC (rev 383) @@ -813,7 +813,7 @@ if (likely(!virt_dev->rd_only_flag)) { int do_fsync = vdisk_sync_queue_type(cmd->queue_type); struct scst_vdisk_tgt_dev *ftgt_dev = - (struct scst_vdisk_tgt_dev*) + (struct scst_vdisk_tgt_dev *) cmd->tgt_dev->dh_priv; enum scst_cmd_queue_type last_queue_type = ftgt_dev->last_write_cmd_queue_type; @@ -848,7 +848,7 @@ if (likely(!virt_dev->rd_only_flag)) { int do_fsync = vdisk_sync_queue_type(cmd->queue_type); struct scst_vdisk_tgt_dev *ftgt_dev = - (struct scst_vdisk_tgt_dev*) + (struct scst_vdisk_tgt_dev *) cmd->tgt_dev->dh_priv; enum scst_cmd_queue_type last_queue_type = ftgt_dev->last_write_cmd_queue_type; @@ -2165,7 +2165,7 @@ eiv_count--; } else { eiv->iov_base = - (uint8_t*)eiv->iov_base + err; + (uint8_t *)eiv->iov_base + err; eiv->iov_len -= err; break; } @@ -2439,7 +2439,7 @@ TRACE_DBG("Verify: length %zd - len_mem %zd", length, len_mem); if (!virt_dev->nullio) - err = fd->f_op->read(fd, (char*)mem_verify, len_mem, &fd->f_pos); + err = fd->f_op->read(fd, (char *)mem_verify, len_mem, &fd->f_pos); else err = len_mem; if ((err < 0) || (err < len_mem)) { @@ -3267,7 +3267,7 @@ static int vdisk_help_info_show(struct seq_file *seq, void *v) { - char *s = (char*)seq->private; + char *s = (char *)seq->private; TRACE_ENTRY(); Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2008-05-21 15:40:33 UTC (rev 382) +++ trunk/scst/src/scst_lib.c 2008-05-21 15:43:54 UTC (rev 383) @@ -1458,7 +1458,7 @@ void scst_tgt_retry_timer_fn(unsigned long arg) { - struct scst_tgt *tgt = (struct scst_tgt*)arg; + struct scst_tgt *tgt = (struct scst_tgt *)arg; unsigned long flags; TRACE_RETRY("Retry timer expired (retry_cmds %d)", tgt->retry_cmds); @@ -1854,16 +1854,16 @@ if (len > 2) { switch (len) { case 8: - if ((*((uint64_t*)lun) & + if ((*((uint64_t *)lun) & __constant_cpu_to_be64(0x0000FFFFFFFFFFFFLL)) != 0) goto out_err; break; case 4: - if (*((uint16_t*)&lun[2]) != 0) + if (*((uint16_t *)&lun[2]) != 0) goto out_err; break; case 6: - if (*((uint32_t*)&lun[2]) != 0) + if (*((uint32_t *)&lun[2]) != 0) goto out_err; break; default: Modified: trunk/scst/src/scst_main.c =================================================================== --- trunk/scst/src/scst_main.c 2008-05-21 15:40:33 UTC (rev 382) +++ trunk/scst/src/scst_main.c 2008-05-21 15:43:54 UTC (rev 383) @@ -1630,7 +1630,7 @@ for (i = 0; i < (int)ARRAY_SIZE(scst_tasklets); i++) { spin_lock_init(&scst_tasklets[i].tasklet_lock); INIT_LIST_HEAD(&scst_tasklets[i].tasklet_cmd_list); - tasklet_init(&scst_tasklets[i].tasklet, (void*)scst_cmd_tasklet, + tasklet_init(&scst_tasklets[i].tasklet, (void *)scst_cmd_tasklet, (unsigned long)&scst_tasklets[i]); } Modified: trunk/scst/src/scst_mem.c =================================================================== --- trunk/scst/src/scst_mem.c 2008-05-21 15:40:33 UTC (rev 382) +++ trunk/scst/src/scst_mem.c 2008-05-21 15:43:54 UTC (rev 383) @@ -264,7 +264,7 @@ sz = pages_to_alloc * sizeof(obj->sg_entries[0]); - obj->sg_entries = (struct scatterlist*)kmalloc(sz, gfp_mask); + obj->sg_entries = (struct scatterlist *)kmalloc(sz, gfp_mask); if (unlikely(obj->sg_entries == NULL)) { TRACE(TRACE_OUT_OF_MEM, "Allocation of sgv_pool_obj " "SG vector failed (size %d)", sz); @@ -276,14 +276,14 @@ if (obj->owner_pool->clustered) { if (order <= sgv_pools_mgr.sgv_max_trans_order) { - obj->trans_tbl = (struct trans_tbl_ent*)obj->sg_entries_data; + obj->trans_tbl = (struct trans_tbl_ent *)obj->sg_entries_data; /* * No need to clear trans_tbl, if needed, it will be * fully rewritten in scst_alloc_sg_entries() */ } else { tsz = pages_to_alloc * sizeof(obj->trans_tbl[0]); - obj->trans_tbl = (struct trans_tbl_ent*)kzalloc(tsz, gfp_mask); + obj->trans_tbl = (struct trans_tbl_ent *)kzalloc(tsz, gfp_mask); if (unlikely(obj->trans_tbl == NULL)) { TRACE(TRACE_OUT_OF_MEM, "Allocation of trans_tbl " "failed (size %d)", tsz); @@ -314,7 +314,7 @@ obj->sg_count, obj->allocator_priv); } if (obj->sg_entries != obj->sg_entries_data) { - if (obj->trans_tbl != (struct trans_tbl_ent*)obj->sg_entries_data) { + if (obj->trans_tbl != (struct trans_tbl_ent *)obj->sg_entries_data) { /* kfree() handles NULL parameter */ kfree(obj->trans_tbl); obj->trans_tbl = NULL; @@ -566,7 +566,7 @@ sg_init_table(obj->sg_entries, pages_to_alloc); TRACE_MEM("sg_entries %p", obj->sg_entries); if (pool->clustered) { - obj->trans_tbl = (struct trans_tbl_ent*) + obj->trans_tbl = (struct trans_tbl_ent *) (obj->sg_entries + pages_to_alloc); TRACE_MEM("trans_tbl %p", obj->trans_tbl); /* @@ -696,7 +696,7 @@ out_fail_free_sg_entries: if (obj->sg_entries != obj->sg_entries_data) { - if (obj->trans_tbl != (struct trans_tbl_ent*)obj->sg_entries_data) { + if (obj->trans_tbl != (struct trans_tbl_ent *)obj->sg_entries_data) { /* kfree() handles NULL parameter */ kfree(obj->trans_tbl); obj->trans_tbl = NULL; Modified: trunk/scst/src/scst_proc.c =================================================================== --- trunk/scst/src/scst_proc.c 2008-05-21 15:40:33 UTC (rev 382) +++ trunk/scst/src/scst_proc.c 2008-05-21 15:43:54 UTC (rev 383) @@ -977,7 +977,7 @@ if (vtt->tgtt->read_proc || vtt->tgtt->write_proc) { /* create the proc file entry for the device */ scnprintf(name, sizeof(name), "%d", vtt->tgtt->proc_dev_num); - scst_scsi_tgt_proc_data.data = (void*)vtt; + scst_scsi_tgt_proc_data.data = (void *)vtt; p = scst_create_proc_entry(vtt->tgtt->proc_tgt_root, name, &scst_scsi_tgt_proc_data); Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-05-21 15:40:33 UTC (rev 382) +++ trunk/scst/src/scst_targ.c 2008-05-21 15:43:54 UTC (rev 383) @@ -1214,7 +1214,7 @@ int i; struct scatterlist *sg = cmd->sg; TRACE_RECV_TOP("Exec'd %d S/G(s) at %p sg[0].page at " - "%p", cmd->sg_cnt, sg, (void*)sg_page(&sg[0])); + "%p", cmd->sg_cnt, sg, (void *)sg_page(&sg[0])); for (i = 0; i < cmd->sg_cnt; ++i) { TRACE_BUFF_FLAG(TRACE_RCV_TOP, "Exec'd sg", sg_virt(&sg[i]), @@ -2571,7 +2571,7 @@ int i; struct scatterlist *sg = cmd->sg; TRACE_SEND_BOT("Xmitting %d S/G(s) at %p sg[0].page at %p", - cmd->sg_cnt, sg, (void*)sg_page(&sg[0])); + cmd->sg_cnt, sg, (void *)sg_page(&sg[0])); for (i = 0; i < cmd->sg_cnt; ++i) { TRACE_BUFF_FLAG(TRACE_SND_BOT, "Xmitting sg", sg_virt(&sg[i]), @@ -3239,7 +3239,7 @@ int scst_cmd_thread(void *arg) { - struct scst_cmd_lists *p_cmd_lists = (struct scst_cmd_lists*)arg; + struct scst_cmd_lists *p_cmd_lists = (struct scst_cmd_lists *)arg; TRACE_ENTRY(); @@ -3302,7 +3302,7 @@ void scst_cmd_tasklet(long p) { - struct scst_tasklet *t = (struct scst_tasklet*)p; + struct scst_tasklet *t = (struct scst_tasklet *)p; TRACE_ENTRY(); @@ -4947,7 +4947,7 @@ /* Abort all outstanding commands and clear reservation, if necessary */ lun = 0; rc = scst_rx_mgmt_fn_lun(sess, SCST_UNREG_SESS_TM, - (uint8_t*)&lun, sizeof(lun), SCST_ATOMIC, NULL); + (uint8_t *)&lun, sizeof(lun), SCST_ATOMIC, NULL); if (rc != 0) { PRINT_ERROR("SCST_UNREG_SESS_TM failed %d (sess %p)", rc, sess); Modified: trunk/srpt/src/ib_srpt.c =================================================================== --- trunk/srpt/src/ib_srpt.c 2008-05-21 15:40:33 UTC (rev 382) +++ trunk/srpt/src/ib_srpt.c 2008-05-21 15:43:54 UTC (rev 383) @@ -815,7 +815,7 @@ if (ret) { srpt_build_cmd_rsp(ch, ioctx, NO_SENSE, NO_ADD_SENSE, srp_cmd->tag); - ((struct srp_rsp*)ioctx->buf)->status = + ((struct srp_rsp *)ioctx->buf)->status = SAM_STAT_TASK_SET_FULL; goto send_rsp; } @@ -823,7 +823,7 @@ if (indirect_desc) { srpt_build_cmd_rsp(ch, ioctx, NO_SENSE, NO_ADD_SENSE, srp_cmd->tag); - ((struct srp_rsp*)ioctx->buf)->status = + ((struct srp_rsp *)ioctx->buf)->status = SAM_STAT_TASK_SET_FULL; goto send_rsp; } @@ -843,7 +843,7 @@ if (!scmnd) { srpt_build_cmd_rsp(ch, ioctx, NO_SENSE, NO_ADD_SENSE, srp_cmd->tag); - ((struct srp_rsp*)ioctx->buf)->status = + ((struct srp_rsp *)ioctx->buf)->status = SAM_STAT_TASK_SET_FULL; goto send_rsp; } Modified: trunk/usr/fileio/common.c =================================================================== --- trunk/usr/fileio/common.c 2008-05-21 15:40:33 UTC (rev 382) +++ trunk/usr/fileio/common.c 2008-05-21 15:43:54 UTC (rev 383) @@ -521,7 +521,7 @@ TRACE_MEM("Cached mem free (cmd %d, buf %"PRIx64")", cmd->cmd_h, cmd->on_cached_mem_free.pbuf); - free((void*)(unsigned long)cmd->on_cached_mem_free.pbuf); + free((void *)(unsigned long)cmd->on_cached_mem_free.pbuf); memset(reply, 0, sizeof(*reply)); reply->cmd_h = cmd->cmd_h; @@ -550,7 +550,7 @@ if (!cmd->on_free_cmd.buffer_cached && (cmd->on_free_cmd.pbuf != 0)) { TRACE_MEM("Freeing buf %"PRIx64, cmd->on_free_cmd.pbuf); - free((void*)(unsigned long)cmd->on_free_cmd.pbuf); + free((void *)(unsigned long)cmd->on_free_cmd.pbuf); } memset(reply, 0, sizeof(*reply)); @@ -667,7 +667,7 @@ void *main_loop(void *arg) { int res = 0; - struct vdisk_dev *dev = (struct vdisk_dev*)arg; + struct vdisk_dev *dev = (struct vdisk_dev *)arg; struct scst_user_get_cmd cmd; struct scst_user_reply_cmd reply; struct vdisk_cmd vcmd = { -1, &cmd, dev, &reply, {0}}; @@ -757,7 +757,7 @@ case SCST_USER_EXEC: if (cmd.exec_cmd.data_direction == SCST_DATA_WRITE) { TRACE_BUFFER("Received cmd data", - (void*)(unsigned long)cmd.exec_cmd.pbuf, + (void *)(unsigned long)cmd.exec_cmd.pbuf, cmd.exec_cmd.bufflen); } res = do_exec(&vcmd); @@ -769,7 +769,7 @@ #endif if (reply.exec_reply.resp_data_len != 0) { TRACE_BUFFER("Reply data", - (void*)(unsigned long)reply.exec_reply.pbuf, + (void *)(unsigned long)reply.exec_reply.pbuf, reply.exec_reply.resp_data_len); } break; @@ -829,13 +829,13 @@ PRINT_INFO("Thread %d exiting (res=%d)", gettid(), res); TRACE_EXIT_RES(res); - return (void*)(long)res; + return (void *)(long)res; } void *prio_loop(void *arg) { int res = 0; - struct vdisk_dev *dev = (struct vdisk_dev*)arg; + struct vdisk_dev *dev = (struct vdisk_dev *)arg; struct scst_user_get_cmd cmd; struct scst_user_reply_cmd reply; struct vdisk_cmd vcmd = { -1, &cmd, dev, &reply, {0}}; @@ -901,7 +901,7 @@ PRINT_INFO("Prio thread %d exited (res=%d)", gettid(), res); TRACE_EXIT_RES(res); - return (void*)(long)res; + return (void *)(long)res; } static void exec_inquiry(struct vdisk_cmd *vcmd) @@ -958,7 +958,7 @@ else usn_len = len; buf[3] = usn_len; - strncpy((char*)&buf[4], dev->usn, usn_len); + strncpy((char *)&buf[4], dev->usn, usn_len); } resp_len = buf[3] + 4; } else if (0x83 == cmd->cdb[2]) { /* device identification */ @@ -1731,7 +1731,7 @@ TRACE_DBG("Verify: length %d - len_mem %d", length, len_mem); if (!dev->nullio) - err = read(fd, (char*)mem_verify, len_mem); + err = read(fd, (char *)mem_verify, len_mem); else err = len_mem; if ((err < 0) || (err < len_mem)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-05-22 16:25:18
|
Revision: 386 http://scst.svn.sourceforge.net/scst/?rev=386&view=rev Author: vlnb Date: 2008-05-22 09:13:36 -0700 (Thu, 22 May 2008) Log Message: ----------- Patch from Bart Van Assche <bar...@gm...> with one change ("/* To do */;;" replaced by "/* ToDo */"): The patch below fixes the following checkpatch complaints: - ERROR: else should follow close brace '}' - ERROR: need consistent spacing around '&' (ctx:VxW) - ERROR: open brace '{' following enum go on the same line - ERROR: open brace '{' following struct go on the same line - ERROR: that open brace { should be on the previous line - ERROR: trailing statements should be on next line - ERROR: trailing whitespace - WARNING: braces {} are not necessary for any arm of this statement The patch below has been verified as follows: - Verified the patch below by reading it. - Checked that checkpatch does no longer complain about the above categories of messages on the generated patch. - Checked that the generated kernel patch applies cleanly to the 2.6.25.4 kernel. - Checked that the patched 2.6.25.4 kernel compiles and installs cleanly, and that after reboot it was possible to load the iscsi-scst and ib_srpt kernel modules. Signed-off-by: Bart Van Assche <bar...@gm...> Modified Paths: -------------- trunk/iscsi-scst/include/iscsi_scst.h trunk/iscsi-scst/kernel/event.c trunk/iscsi-scst/kernel/iscsi.c trunk/iscsi-scst/kernel/nthread.c trunk/scst/include/scst.h trunk/scst/include/scst_const.h trunk/scst/include/scst_debug.h trunk/scst/include/scst_user.h trunk/scst/src/dev_handlers/scst_cdrom.c trunk/scst/src/dev_handlers/scst_changer.c trunk/scst/src/dev_handlers/scst_dev_handler.h trunk/scst/src/dev_handlers/scst_disk.c trunk/scst/src/dev_handlers/scst_modisk.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/dev_handlers/scst_user.c trunk/scst/src/dev_handlers/scst_vdisk.c trunk/scst/src/scst_cdbprobe.h trunk/scst/src/scst_debug.c trunk/scst/src/scst_lib.c trunk/scst/src/scst_main.c trunk/scst/src/scst_mem.c trunk/scst/src/scst_mem.h trunk/scst/src/scst_priv.h trunk/scst/src/scst_proc.c trunk/scst/src/scst_targ.c Modified: trunk/iscsi-scst/include/iscsi_scst.h =================================================================== --- trunk/iscsi-scst/include/iscsi_scst.h 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/iscsi-scst/include/iscsi_scst.h 2008-05-22 16:13:36 UTC (rev 386) @@ -141,8 +141,7 @@ static inline int iscsi_is_key_declarative(int key) { - switch (key) - { + switch (key) { case key_max_xmit_data_length: return 1; default: Modified: trunk/iscsi-scst/kernel/event.c =================================================================== --- trunk/iscsi-scst/kernel/event.c 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/iscsi-scst/kernel/event.c 2008-05-22 16:13:36 UTC (rev 386) @@ -56,9 +56,9 @@ rlen = NLMSG_ALIGN(nlh->nlmsg_len); if (rlen > skb->len) rlen = skb->len; - if ((err = event_recv_msg(skb, nlh))) { + if ((err = event_recv_msg(skb, nlh))) netlink_ack(skb, nlh, -err); - } else if (nlh->nlmsg_flags & NLM_F_ACK) + else if (nlh->nlmsg_flags & NLM_F_ACK) netlink_ack(skb, nlh, 0); skb_pull(skb, rlen); } Modified: trunk/iscsi-scst/kernel/iscsi.c =================================================================== --- trunk/iscsi-scst/kernel/iscsi.c 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/iscsi-scst/kernel/iscsi.c 2008-05-22 16:13:36 UTC (rev 386) @@ -24,9 +24,9 @@ #include "digest.h" #ifndef NET_PAGE_CALLBACKS_DEFINED -#warning Patch put_page_callback-<kernel-version>.patch not applied on your \ +#warning "Patch put_page_callback-<kernel-version>.patch not applied on your \ kernel. ISCSI-SCST will run in the performance degraded mode. Refer \ - README file for details. + README file for details." #endif #define ISCSI_INIT_WRITE_WAKE 0x1 @@ -668,7 +668,7 @@ sg = rsp->sg = scst_alloc(PAGE_SIZE, GFP_KERNEL|__GFP_NOFAIL, &rsp->sg_cnt); if (sg == NULL) { - /* ToDo(); */ + /* ToDo */ } rsp->own_sg = 1; sense = (struct iscsi_sense_data *)page_address(sg_page(&sg[0])); @@ -731,7 +731,7 @@ sg = rsp->sg = scst_alloc(PAGE_SIZE, GFP_KERNEL|__GFP_NOFAIL, &rsp->sg_cnt); if (sg == NULL) { - /* ToDo(); */ + /* ToDo */ } rsp->own_sg = 1; addr = page_address(sg_page(&sg[0])); @@ -940,7 +940,7 @@ sg = cmnd->sg = scst_alloc(PAGE_SIZE, GFP_KERNEL|__GFP_NOFAIL, &cmnd->sg_cnt); if (sg == NULL) { - /* ToDo(); */ + /* ToDo */ } cmnd->own_sg = 1; cmnd->bufflen = PAGE_SIZE; @@ -1226,10 +1226,10 @@ cmnd->sg = sg = scst_alloc(size, GFP_KERNEL|__GFP_NOFAIL, &cmnd->sg_cnt); if (sg == NULL) { - /* ToDo(); */ + /* ToDo */ } if (cmnd->sg_cnt > ISCSI_CONN_IOV_MAX) { - /* ToDo(); */ + /* ToDo */ } cmnd->own_sg = 1; cmnd->bufflen = size; @@ -2516,9 +2516,8 @@ int rc = 1; while (test_write_ready(conn)) { rc = iscsi_send(conn); - if ((rc <= 0) || single_only) { + if ((rc <= 0) || single_only) break; - } } spin_lock_bh(&iscsi_wr_lock); @@ -2881,9 +2880,8 @@ list_for_each_entry_safe(t, tmp, &iscsi_threads_list, threads_list_entry) { int rc = kthread_stop(t->thr); - if (rc < 0) { + if (rc < 0) TRACE_MGMT_DBG("kthread_stop() failed: %d", rc); - } list_del(&t->threads_list_entry); kfree(t); } Modified: trunk/iscsi-scst/kernel/nthread.c =================================================================== --- trunk/iscsi-scst/kernel/nthread.c 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/iscsi-scst/kernel/nthread.c 2008-05-22 16:13:36 UTC (rev 386) @@ -253,18 +253,18 @@ if (!list_empty(&session->pending_list)) { struct list_head *pending_list = &session->pending_list; int req_freed; - + TRACE_CONN_CLOSE_DBG("Disposing pending commands on " "connection %p (conn_ref_cnt=%d)", conn, atomic_read(&conn->conn_ref_cnt)); - + /* * Such complicated approach currently isn't necessary, * but it will be necessary for MC/S, if we won't want * to reestablish the whole session on a connection * failure. */ - + spin_lock(&session->sn_lock); do { req_freed = 0; @@ -976,46 +976,51 @@ iop = conn->write_iop; count = conn->write_iop_used; - if (iop) while (1) { - loff_t off = 0; - int rest; + if (iop) { + while (1) { + loff_t off = 0; + int rest; - sBUG_ON(count > sizeof(conn->write_iov)/sizeof(conn->write_iov[0])); -retry: - oldfs = get_fs(); - set_fs(KERNEL_DS); - res = vfs_writev(file, (struct iovec __user *)iop, count, &off); - set_fs(oldfs); - TRACE_WRITE("%#Lx:%u: %d(%ld)", conn->session->sid, conn->cid, - res, (long)iop->iov_len); - if (unlikely(res <= 0)) { - if (res == -EAGAIN) { - conn->write_iop = iop; - conn->write_iop_used = count; + sBUG_ON(count > sizeof(conn->write_iov) + / sizeof(conn->write_iov[0])); + retry: + oldfs = get_fs(); + set_fs(KERNEL_DS); + res = vfs_writev(file, (struct iovec __user *)iop, + count, &off); + set_fs(oldfs); + TRACE_WRITE("%#Lx:%u: %d(%ld)", conn->session->sid, + conn->cid, + res, (long)iop->iov_len); + if (unlikely(res <= 0)) { + if (res == -EAGAIN) { + conn->write_iop = iop; + conn->write_iop_used = count; + goto out_iov; + } else if (res == -EINTR) + goto retry; + goto out_err; + } + + rest = res; + size -= res; + while (iop->iov_len <= rest && rest) { + rest -= iop->iov_len; + iop++; + count--; + } + if (count == 0) { + conn->write_iop = NULL; + conn->write_iop_used = 0; + if (size) + break; goto out_iov; - } else if (res == -EINTR) - goto retry; - goto out_err; + } + sBUG_ON(iop > conn->write_iov + sizeof(conn->write_iov) + /sizeof(conn->write_iov[0])); + iop->iov_base += rest; + iop->iov_len -= rest; } - - rest = res; - size -= res; - while (iop->iov_len <= rest && rest) { - rest -= iop->iov_len; - iop++; - count--; - } - if (count == 0) { - conn->write_iop = NULL; - conn->write_iop_used = 0; - if (size) - break; - goto out_iov; - } - sBUG_ON(iop > conn->write_iov + - sizeof(conn->write_iov)/sizeof(conn->write_iov[0])); - iop->iov_base += rest; - iop->iov_len -= rest; } sg = write_cmnd->sg; Modified: trunk/scst/include/scst.h =================================================================== --- trunk/scst/include/scst.h 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/include/scst.h 2008-05-22 16:13:36 UTC (rev 386) @@ -411,8 +411,7 @@ typedef enum dma_data_direction scst_data_direction; -enum scst_cdb_flags -{ +enum scst_cdb_flags { SCST_TRANSFER_LEN_TYPE_FIXED = 0x01, /* must be equviv 1 (FIXED_BIT in cdb) */ SCST_SMALL_TIMEOUT = 0x02, SCST_LONG_TIMEOUT = 0x04, @@ -438,8 +437,7 @@ * SCST_TGT_RES_NEED_THREAD_CTX, and it will be recalled in the thread context, * where sleeping is allowed. */ -struct scst_tgt_template -{ +struct scst_tgt_template { /* public: */ /* @@ -683,8 +681,7 @@ int proc_dev_num; }; -struct scst_dev_type -{ +struct scst_dev_type { /* SCSI type of the supported device. MUST HAVE */ int type; @@ -843,8 +840,7 @@ struct proc_dir_entry *proc_dev_type_root; }; -struct scst_tgt -{ +struct scst_tgt { /* List of remote sessions per target, protected by scst_mutex */ struct list_head sess_list; @@ -889,8 +885,7 @@ #define TGT_DEV_HASH_SIZE (1<<TGT_DEV_HASH_SHIFT) #define HASH_VAL(_val) (_val & (TGT_DEV_HASH_SIZE - 1)) -struct scst_session -{ +struct scst_session { /* * Initialization phase, one of SCST_SESS_IPH_* constants, protected by * sess_list_lock @@ -975,16 +970,14 @@ #endif }; -struct scst_cmd_lists -{ +struct scst_cmd_lists { spinlock_t cmd_list_lock; struct list_head active_cmd_list; wait_queue_head_t cmd_list_waitQ; struct list_head lists_list_entry; }; -struct scst_cmd -{ +struct scst_cmd { /* List entry for below *_cmd_lists */ struct list_head cmd_list_entry; @@ -1246,8 +1239,7 @@ #endif }; -struct scst_rx_mgmt_params -{ +struct scst_rx_mgmt_params { int fn; uint64_t tag; const uint8_t *lun; @@ -1260,16 +1252,14 @@ unsigned char cmd_sn_set; }; -struct scst_mgmt_cmd_stub -{ +struct scst_mgmt_cmd_stub { struct scst_mgmt_cmd *mcmd; /* List entry in cmd->mgmt_cmd_list */ struct list_head cmd_mgmt_cmd_list_entry; }; -struct scst_mgmt_cmd -{ +struct scst_mgmt_cmd { /* List entry for *_mgmt_cmd_list */ struct list_head mgmt_cmd_list_entry; @@ -1321,8 +1311,7 @@ void *tgt_priv; }; -struct scst_device -{ +struct scst_device { struct scst_dev_type *handler; /* corresponding dev handler */ /* Pointer to lists of commands with the lock */ @@ -1437,8 +1426,7 @@ /* * Used to store threads local tgt_dev specific data */ -struct scst_thr_data_hdr -{ +struct scst_thr_data_hdr { /* List entry in tgt_dev->thr_data_list */ struct list_head thr_data_list_entry; pid_t pid; /* PID of the owner thread */ @@ -1450,8 +1438,7 @@ /* * Used to store per-session specific device information */ -struct scst_tgt_dev -{ +struct scst_tgt_dev { /* List entry in sess->sess_tgt_dev_list_hash */ struct list_head sess_tgt_dev_list_entry; @@ -1518,8 +1505,7 @@ /* * Used to store ACG-specific device information, like LUN */ -struct scst_acg_dev -{ +struct scst_acg_dev { struct scst_device *dev; /* corresponding device */ lun_t lun; /* device's LUN in this acg */ unsigned int rd_only_flag:1; /* if != 0, then read only */ @@ -1536,8 +1522,7 @@ * ACG - access control group. Used to store group related * control information. */ -struct scst_acg -{ +struct scst_acg { /* List of acg_dev's in this acg, protected by scst_mutex */ struct list_head acg_dev_list; @@ -1561,8 +1546,7 @@ * ACN - access control name. Used to store names, by which * incoming sessions will be assigned to appropriate ACG. */ -struct scst_acn -{ +struct scst_acn { /* Initiator's name */ const char *name; /* List entry in acg->acn_list */ @@ -1572,8 +1556,7 @@ /* * Used to store per-session UNIT ATTENTIONs */ -struct scst_tgt_dev_UA -{ +struct scst_tgt_dev_UA { /* List entry in tgt_dev->UA_list */ struct list_head UA_list_entry; /* Unit Attention sense */ Modified: trunk/scst/include/scst_const.h =================================================================== --- trunk/scst/include/scst_const.h 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/include/scst_const.h 2008-05-22 16:13:36 UTC (rev 386) @@ -92,8 +92,7 @@ /************************************************************* ** SCSI task attribute queue types *************************************************************/ -enum scst_cmd_queue_type -{ +enum scst_cmd_queue_type { SCST_CMD_QUEUE_UNTAGGED = 0, SCST_CMD_QUEUE_SIMPLE, SCST_CMD_QUEUE_ORDERED, Modified: trunk/scst/include/scst_debug.h =================================================================== --- trunk/scst/include/scst_debug.h 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/include/scst_debug.h 2008-05-22 16:13:36 UTC (rev 386) @@ -148,12 +148,10 @@ #define TRACE(trace, format, args...) \ do { \ - if (___unlikely(trace_flag & (trace))) \ - { \ + if (___unlikely(trace_flag & (trace))) { \ char *__tflag = LOG_FLAG; \ if (debug_print_prefix(trace_flag, __tflag, __LOG_PREFIX, \ - __FUNCTION__, __LINE__) > 0) \ - { \ + __FUNCTION__, __LINE__) > 0) { \ __tflag = NO_FLAG; \ } \ PRINT(NO_FLAG, "%s" format, __tflag, args); \ @@ -168,12 +166,10 @@ #define PRINT_BUFF_FLAG(flag, message, buff, len) \ do { \ - if (___unlikely(trace_flag & (flag))) \ - { \ + if (___unlikely(trace_flag & (flag))) { \ char *__tflag = INFO_FLAG; \ if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__,\ - __LINE__) > 0) \ - { \ + __LINE__) > 0) { \ __tflag = NO_FLAG; \ } \ PRINT(NO_FLAG, "%s%s:", __tflag, message); \ @@ -193,12 +189,10 @@ #define __TRACE(trace, format, args...) \ do { \ - if (trace_flag & (trace)) \ - { \ + if (trace_flag & (trace)) { \ char *__tflag = LOG_FLAG; \ if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__,\ - __LINE__) > 0) \ - { \ + __LINE__) > 0) { \ __tflag = NO_FLAG; \ } \ PRINT(NO_FLAG, "%s" format, __tflag, args); \ @@ -214,12 +208,10 @@ #define TRACE_BUFFER(message, buff, len) \ do { \ - if (trace_flag & TRACE_BUFF) \ - { \ + if (trace_flag & TRACE_BUFF) { \ char *__tflag = LOG_FLAG; \ if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__, \ - __LINE__) > 0) \ - { \ + __LINE__) > 0) { \ __tflag = NO_FLAG; \ } \ PRINT(NO_FLAG, "%s%s:", __tflag, message); \ @@ -229,12 +221,10 @@ #define TRACE_BUFF_FLAG(flag, message, buff, len) \ do { \ - if (trace_flag & (flag)) \ - { \ + if (trace_flag & (flag)) { \ char *__tflag = LOG_FLAG; \ if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__, \ - __LINE__) > 0) \ - { \ + __LINE__) > 0) { \ __tflag = NO_FLAG; \ } \ PRINT(NO_FLAG, "%s%s:", __tflag, message); \ @@ -246,8 +236,7 @@ do { \ char *__tflag = log_flag; \ if (debug_print_prefix(trace_flag, __tflag, __LOG_PREFIX, \ - __FUNCTION__, __LINE__) > 0) \ - { \ + __FUNCTION__, __LINE__) > 0) { \ __tflag = NO_FLAG; \ } \ PRINT(NO_FLAG, "%s" format, __tflag, args); \ @@ -255,8 +244,7 @@ #define PRINT_ERROR(format, args...) \ do { \ - if (strcmp(ERROR_FLAG, LOG_FLAG)) \ - { \ + if (strcmp(ERROR_FLAG, LOG_FLAG)) { \ PRINT_LOG_FLAG(LOG_FLAG, "***ERROR*** " format, args); \ } \ PRINT_LOG_FLAG(ERROR_FLAG, "***ERROR*** " format, args); \ @@ -273,8 +261,7 @@ #define PRINT_INFO(format, args...) \ do { \ - if (strcmp(INFO_FLAG, LOG_FLAG)) \ - { \ + if (strcmp(INFO_FLAG, LOG_FLAG)) { \ PRINT_LOG_FLAG(LOG_FLAG, format, args); \ } \ PRINT_LOG_FLAG(INFO_FLAG, format, args); \ @@ -282,14 +269,12 @@ #define TRACE_ENTRY() \ do { \ - if (trace_flag & TRACE_ENTRYEXIT) \ - { \ - if (trace_flag & TRACE_PID) \ - { \ + if (trace_flag & TRACE_ENTRYEXIT) { \ + if (trace_flag & TRACE_PID) { \ PRINT(LOG_FLAG, "[%d]: ENTRY %s", current->pid, \ __FUNCTION__); \ } \ - else \ + else { \ { \ PRINT(LOG_FLAG, "ENTRY %s", __FUNCTION__); \ } \ @@ -298,15 +283,12 @@ #define TRACE_EXIT() \ do { \ - if (trace_flag & TRACE_ENTRYEXIT) \ - { \ - if (trace_flag & TRACE_PID) \ - { \ + if (trace_flag & TRACE_ENTRYEXIT) { \ + if (trace_flag & TRACE_PID) { \ PRINT(LOG_FLAG, "[%d]: EXIT %s", current->pid, \ __FUNCTION__); \ } \ - else \ - { \ + else { \ PRINT(LOG_FLAG, "EXIT %s", __FUNCTION__); \ } \ } \ @@ -314,15 +296,12 @@ #define TRACE_EXIT_RES(res) \ do { \ - if (trace_flag & TRACE_ENTRYEXIT) \ - { \ - if (trace_flag & TRACE_PID) \ - { \ + if (trace_flag & TRACE_ENTRYEXIT) { \ + if (trace_flag & TRACE_PID) { \ PRINT(LOG_FLAG, "[%d]: EXIT %s: %ld", current->pid, \ __FUNCTION__, (long)(res)); \ } \ - else \ - { \ + else { \ PRINT(LOG_FLAG, "EXIT %s: %ld", __FUNCTION__, (long)(res)); \ } \ } \ @@ -330,15 +309,12 @@ #define TRACE_EXIT_HRES(res) \ do { \ - if (trace_flag & TRACE_ENTRYEXIT) \ - { \ - if (trace_flag & TRACE_PID) \ - { \ + if (trace_flag & TRACE_ENTRYEXIT) { \ + if (trace_flag & TRACE_PID) { \ PRINT(LOG_FLAG, "[%d]: EXIT %s: 0x%lx", current->pid, \ __FUNCTION__, (long)(res)); \ } \ - else \ - { \ + else { \ PRINT(LOG_FLAG, "EXIT %s: %lx", __FUNCTION__, (long)(res)); \ } \ } \ Modified: trunk/scst/include/scst_user.h =================================================================== --- trunk/scst/include/scst_user.h 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/include/scst_user.h 2008-05-22 16:13:36 UTC (rev 386) @@ -86,8 +86,7 @@ UCMD_STATE_RECV_MASK | \ UCMD_STATE_JAMMED_MASK) -struct scst_user_opt -{ +struct scst_user_opt { uint8_t parse_type; uint8_t on_free_cmd_type; uint8_t memory_reuse_type; @@ -104,8 +103,7 @@ uint8_t has_own_order_mgmt; }; -struct scst_user_dev_desc -{ +struct scst_user_dev_desc { aligned_u64 version_str; uint8_t type; struct scst_user_opt opt; @@ -113,8 +111,7 @@ char name[SCST_MAX_NAME]; }; -struct scst_user_sess -{ +struct scst_user_sess { aligned_u64 sess_h; aligned_u64 lun; uint16_t threads_num; @@ -122,8 +119,7 @@ char initiator_name[SCST_MAX_NAME]; }; -struct scst_user_scsi_cmd_parse -{ +struct scst_user_scsi_cmd_parse { aligned_u64 sess_h; uint8_t cdb[SCST_MAX_CDB_SIZE]; @@ -142,8 +138,7 @@ uint32_t sn; }; -struct scst_user_scsi_cmd_alloc_mem -{ +struct scst_user_scsi_cmd_alloc_mem { aligned_u64 sess_h; uint8_t cdb[SCST_MAX_CDB_SIZE]; @@ -157,8 +152,7 @@ uint32_t sn; }; -struct scst_user_scsi_cmd_exec -{ +struct scst_user_scsi_cmd_exec { aligned_u64 sess_h; uint8_t cdb[SCST_MAX_CDB_SIZE]; @@ -180,8 +174,7 @@ uint32_t partial_offset; }; -struct scst_user_scsi_on_free_cmd -{ +struct scst_user_scsi_on_free_cmd { aligned_u64 pbuf; int32_t resp_data_len; uint8_t buffer_cached; @@ -190,13 +183,11 @@ uint8_t delivery_status; }; -struct scst_user_on_cached_mem_free -{ +struct scst_user_on_cached_mem_free { aligned_u64 pbuf; }; -struct scst_user_tm -{ +struct scst_user_tm { aligned_u64 sess_h; uint32_t fn; uint32_t cmd_h_to_abort; @@ -204,8 +195,7 @@ uint8_t cmd_sn_set; }; -struct scst_user_get_cmd -{ +struct scst_user_get_cmd { aligned_u64 preply; uint32_t cmd_h; uint32_t subcode; @@ -220,21 +210,18 @@ }; }; -struct scst_user_scsi_cmd_reply_parse -{ +struct scst_user_scsi_cmd_reply_parse { uint8_t queue_type; uint8_t data_direction; int32_t data_len; int32_t bufflen; }; -struct scst_user_scsi_cmd_reply_alloc_mem -{ +struct scst_user_scsi_cmd_reply_alloc_mem { aligned_u64 pbuf; }; -struct scst_user_scsi_cmd_reply_exec -{ +struct scst_user_scsi_cmd_reply_exec { int32_t resp_data_len; aligned_u64 pbuf; @@ -247,8 +234,7 @@ aligned_u64 psense_buffer; }; -struct scst_user_reply_cmd -{ +struct scst_user_reply_cmd { uint32_t cmd_h; uint32_t subcode; union { Modified: trunk/scst/src/dev_handlers/scst_cdrom.c =================================================================== --- trunk/scst/src/dev_handlers/scst_cdrom.c 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/dev_handlers/scst_cdrom.c 2008-05-22 16:13:36 UTC (rev 386) @@ -44,8 +44,7 @@ #define CDROM_DEF_BLOCK_SHIFT 11 -struct cdrom_params -{ +struct cdrom_params { int block_shift; }; Modified: trunk/scst/src/dev_handlers/scst_changer.c =================================================================== --- trunk/scst/src/dev_handlers/scst_changer.c 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/dev_handlers/scst_changer.c 2008-05-22 16:13:36 UTC (rev 386) @@ -76,8 +76,7 @@ * If the device is offline, don't try to read capacity or any * of the other stuff */ - if (dev->scsi_dev->sdev_state == SDEV_OFFLINE) - { + if (dev->scsi_dev->sdev_state == SDEV_OFFLINE) { TRACE_DBG("%s", "Device is offline"); res = -ENODEV; goto out; @@ -150,11 +149,10 @@ cmd->retries = SCST_PASSTHROUGH_RETRIES; - if (cmd->op_flags & SCST_LONG_TIMEOUT) { + if (cmd->op_flags & SCST_LONG_TIMEOUT) cmd->timeout = CHANGER_LONG_TIMEOUT; - } else { + else cmd->timeout = CHANGER_TIMEOUT; - } return res; } Modified: trunk/scst/src/dev_handlers/scst_dev_handler.h =================================================================== --- trunk/scst/src/dev_handlers/scst_dev_handler.h 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/dev_handlers/scst_dev_handler.h 2008-05-22 16:13:36 UTC (rev 386) @@ -96,9 +96,8 @@ TRACE_ENTRY(); root = scst_proc_get_dev_type_root(dev_type); - if (root) { + if (root) remove_proc_entry(DEV_HANDLER_LOG_ENTRY_NAME, root); - } TRACE_EXIT(); #endif Modified: trunk/scst/src/dev_handlers/scst_disk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_disk.c 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/dev_handlers/scst_disk.c 2008-05-22 16:13:36 UTC (rev 386) @@ -63,8 +63,7 @@ #define DISK_DEF_BLOCK_SHIFT 9 -struct disk_params -{ +struct disk_params { int block_shift; }; @@ -196,9 +195,7 @@ TRACE_DBG("READ_CAPACITY done: %x", res); if (!res || (sbuff[12] != 0x28 && sbuff[12] != 0x29)) - { break; - } if (!--retries) { PRINT_ERROR("UA not clear after %d retries", SCST_DEV_UA_RETRIES); Modified: trunk/scst/src/dev_handlers/scst_modisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_modisk.c 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/dev_handlers/scst_modisk.c 2008-05-22 16:13:36 UTC (rev 386) @@ -63,8 +63,7 @@ #define MODISK_DEF_BLOCK_SHIFT 10 -struct modisk_params -{ +struct modisk_params { int block_shift; }; @@ -175,8 +174,7 @@ * If the device is offline, don't try to read capacity or any * of the other stuff */ - if (dev->scsi_dev->sdev_state == SDEV_OFFLINE) - { + if (dev->scsi_dev->sdev_state == SDEV_OFFLINE) { TRACE_DBG("%s", "Device is offline"); res = -ENODEV; goto out_free_params; Modified: trunk/scst/src/dev_handlers/scst_processor.c =================================================================== --- trunk/scst/src/dev_handlers/scst_processor.c 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/dev_handlers/scst_processor.c 2008-05-22 16:13:36 UTC (rev 386) @@ -76,8 +76,7 @@ * If the device is offline, don't try to read capacity or any * of the other stuff */ - if (dev->scsi_dev->sdev_state == SDEV_OFFLINE) - { + if (dev->scsi_dev->sdev_state == SDEV_OFFLINE) { TRACE_DBG("%s", "Device is offline"); res = -ENODEV; goto out; @@ -150,11 +149,10 @@ cmd->retries = SCST_PASSTHROUGH_RETRIES; - if (cmd->op_flags & SCST_LONG_TIMEOUT) { + if (cmd->op_flags & SCST_LONG_TIMEOUT) cmd->timeout = PROCESSOR_LONG_TIMEOUT; - } else { + else cmd->timeout = PROCESSOR_TIMEOUT; - } return res; } Modified: trunk/scst/src/dev_handlers/scst_raid.c =================================================================== --- trunk/scst/src/dev_handlers/scst_raid.c 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/dev_handlers/scst_raid.c 2008-05-22 16:13:36 UTC (rev 386) @@ -76,8 +76,7 @@ * If the device is offline, don't try to read capacity or any * of the other stuff */ - if (dev->scsi_dev->sdev_state == SDEV_OFFLINE) - { + if (dev->scsi_dev->sdev_state == SDEV_OFFLINE) { TRACE_DBG("%s", "Device is offline"); res = -ENODEV; goto out; @@ -150,11 +149,10 @@ cmd->retries = SCST_PASSTHROUGH_RETRIES; - if (cmd->op_flags & SCST_LONG_TIMEOUT) { + if (cmd->op_flags & SCST_LONG_TIMEOUT) cmd->timeout = RAID_LONG_TIMEOUT; - } else { + else cmd->timeout = RAID_TIMEOUT; - } return res; } Modified: trunk/scst/src/dev_handlers/scst_tape.c =================================================================== --- trunk/scst/src/dev_handlers/scst_tape.c 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/dev_handlers/scst_tape.c 2008-05-22 16:13:36 UTC (rev 386) @@ -68,8 +68,7 @@ /* The fixed bit in READ/WRITE/VERIFY */ #define SILI_BIT 2 -struct tape_params -{ +struct tape_params { int block_size; }; @@ -342,19 +341,18 @@ TRACE_ENTRY(); - if ((status == SAM_STAT_GOOD) || (status == SAM_STAT_CONDITION_MET)) { + if ((status == SAM_STAT_GOOD) || (status == SAM_STAT_CONDITION_MET)) res = scst_tape_generic_dev_done(cmd, tape_set_block_size); - } else if ((status == SAM_STAT_CHECK_CONDITION) && - SCST_SENSE_VALID(cmd->sense)) - { + else if ((status == SAM_STAT_CHECK_CONDITION) && + SCST_SENSE_VALID(cmd->sense)) { struct tape_params *params; TRACE_DBG("%s", "Extended sense"); if (opcode == READ_6 && !(cmd->cdb[1] & SILI_BIT) && - (cmd->sense[2] & 0xe0)) { /* EOF, EOM, or ILI */ + (cmd->sense[2] & 0xe0)) { + /* EOF, EOM, or ILI */ int TransferLength, Residue = 0; - if ((cmd->sense[2] & 0x0f) == BLANK_CHECK) { + if ((cmd->sense[2] & 0x0f) == BLANK_CHECK) cmd->sense[2] &= 0xcf; /* No need for EOM in this case */ - } TransferLength = ((cmd->cdb[2] << 16) | (cmd->cdb[3] << 8) | cmd->cdb[4]); /* Compute the residual count */ Modified: trunk/scst/src/dev_handlers/scst_user.c =================================================================== --- trunk/scst/src/dev_handlers/scst_user.c 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/dev_handlers/scst_user.c 2008-05-22 16:13:36 UTC (rev 386) @@ -40,8 +40,7 @@ #define DEV_USER_DETACH_TIMEOUT (5*HZ) #define DEV_USER_PRE_UNREG_POLL_TIME (HZ/10) -struct scst_user_dev -{ +struct scst_user_dev { struct rw_semaphore dev_rwsem; struct scst_cmd_lists cmd_lists; @@ -101,8 +100,7 @@ struct completion cleanup_cmpl; }; -struct scst_user_pre_unreg_sess_obj -{ +struct scst_user_pre_unreg_sess_obj { struct scst_tgt_dev *tgt_dev; unsigned int active:1; unsigned int exit:1; @@ -115,8 +113,7 @@ }; /* Most fields are unprotected, since only one thread at time can access them */ -struct scst_user_cmd -{ +struct scst_user_cmd { struct scst_cmd *cmd; struct scst_user_dev *dev; @@ -444,9 +441,9 @@ ((ucmd->cmd->data_direction == SCST_DATA_READ) && (mem_reuse_type == SCST_USER_MEM_REUSE_READ)) || ((ucmd->cmd->data_direction == SCST_DATA_WRITE) && - (mem_reuse_type == SCST_USER_MEM_REUSE_WRITE))) { + (mem_reuse_type == SCST_USER_MEM_REUSE_WRITE))) return 1; - } else + else return 0; } @@ -3175,9 +3172,8 @@ TRACE_ENTRY(); rc = kthread_stop(cleanup_thread); - if (rc < 0) { + if (rc < 0) TRACE_MGMT_DBG("kthread_stop() failed: %d", rc); - } unregister_chrdev(DEV_USER_MAJOR, DEV_USER_NAME); class_device_destroy(dev_user_sysfs_class, MKDEV(DEV_USER_MAJOR, 0)); Modified: trunk/scst/src/dev_handlers/scst_vdisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_vdisk.c 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/dev_handlers/scst_vdisk.c 2008-05-22 16:13:36 UTC (rev 386) @@ -1125,13 +1125,15 @@ len = scnprintf(dev_id_str, 6, "%d", dev_id_num); TRACE_DBG("num %d, str <%s>, len %d", dev_id_num, dev_id_str, len); - if (0 == cmd->cdb[2]) { /* supported vital product data pages */ + if (0 == cmd->cdb[2]) { + /* supported vital product data pages */ buf[3] = 3; buf[4] = 0x0; /* this page */ buf[5] = 0x80; /* unit serial number */ buf[6] = 0x83; /* device identification */ resp_len = buf[3] + 4; - } else if (0x80 == cmd->cdb[2]) { /* unit serial number */ + } else if (0x80 == cmd->cdb[2]) { + /* unit serial number */ buf[1] = 0x80; if (virt_dev->usn == NULL) { buf[3] = MAX_USN_LEN; @@ -1147,7 +1149,8 @@ strncpy(&buf[4], virt_dev->usn, usn_len); } resp_len = buf[3] + 4; - } else if (0x83 == cmd->cdb[2]) { /* device identification */ + } else if (0x83 == cmd->cdb[2]) { + /* device identification */ int num = 4; buf[1] = 0x83; @@ -1439,7 +1442,8 @@ offset = 8; } - if (0 != subpcode) { /* TODO: Control Extension page */ + if (0 != subpcode) { + /* TODO: Control Extension page */ TRACE_DBG("%s", "MODE SENSE: Only subpage 0 is supported"); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb)); @@ -1583,11 +1587,10 @@ goto out_put; } - if (mselect_6) { + if (mselect_6) offset = 4; - } else { + else offset = 8; - } if (address[offset - 1] == 8) { offset += 8; @@ -1606,7 +1609,8 @@ scst_sense_invalid_field_in_parm_list)); goto out_put; } - if ((address[offset] & 0x3f) == 0x8) { /* Caching page */ + if ((address[offset] & 0x3f) == 0x8) { + /* Caching page */ if (address[offset + 1] != 18) { PRINT_ERROR("%s", "MODE SELECT: Invalid " "caching page request"); @@ -1625,7 +1629,8 @@ * It's too early to implement it, since we can't control the backstorage * device parameters. ToDo */ - } else if ((address[offset] & 0x3f) == 0xA) { /* Control page */ + } else if ((address[offset] & 0x3f) == 0xA) { + /* Control page */ if (address[offset + 1] != 0xA) { PRINT_ERROR("%s", "MODE SELECT: Invalid " "control page request"); @@ -1742,7 +1747,7 @@ buffer[4] = (nblocks >> 24) & 0xFF; buffer[5] = (nblocks >> 16) & 0xFF; buffer[6] = (nblocks >> 8) & 0xFF; - buffer[7] = nblocks& 0xFF; + buffer[7] = nblocks & 0xFF; buffer[8] = (blocksize >> (BYTE * 3)) & 0xFF; buffer[9] = (blocksize >> (BYTE * 2)) & 0xFF; @@ -1822,16 +1827,14 @@ buffer[2] = 0x01; /* First Track/Session */ buffer[3] = 0x01; /* Last Track/Session */ off = 4; - if (cmd->cdb[6] <= 1) - { + if (cmd->cdb[6] <= 1) { /* Fistr TOC Track Descriptor */ buffer[off+1] = 0x14; /* ADDR 0x10 - Q Sub-channel encodes current position data CONTROL 0x04 - Data track, recoreded uninterrupted */ buffer[off+2] = 0x01; /* Track Number */ off += 8; } - if (!(cmd->cdb[2] & 0x01)) - { + if (!(cmd->cdb[2] & 0x01)) { /* Lead-out area TOC Track Descriptor */ buffer[off+1] = 0x14; buffer[off+2] = 0xAA; /* Track Number */ @@ -2021,11 +2024,10 @@ err = full_len; else { /* SEEK */ - if (fd->f_op->llseek) { + if (fd->f_op->llseek) err = fd->f_op->llseek(fd, loff, 0/*SEEK_SET*/); - } else { + else err = default_llseek(fd, loff, 0/*SEEK_SET*/); - } if (err != loff) { PRINT_ERROR("lseek trouble %Ld != %Ld", (uint64_t)err, (uint64_t)loff); @@ -2112,11 +2114,10 @@ err = full_len; else { /* SEEK */ - if (fd->f_op->llseek) { + if (fd->f_op->llseek) err = fd->f_op->llseek(fd, loff, 0 /*SEEK_SET */); - } else { + else err = default_llseek(fd, loff, 0 /*SEEK_SET */); - } if (err != loff) { PRINT_ERROR("lseek trouble %Ld != %Ld", (uint64_t)err, (uint64_t)loff); @@ -2404,11 +2405,10 @@ set_fs(get_ds()); if (!virt_dev->nullio) { - if (fd->f_op->llseek) { + if (fd->f_op->llseek) err = fd->f_op->llseek(fd, loff, 0/*SEEK_SET*/); - } else { + else err = default_llseek(fd, loff, 0/*SEEK_SET*/); - } if (err != loff) { PRINT_ERROR("lseek trouble %Ld != %Ld", (uint64_t)err, (uint64_t)loff); @@ -2658,9 +2658,8 @@ } p = buffer; - if (p[strlen(p) - 1] == '\n') { + if (p[strlen(p) - 1] == '\n') p[strlen(p) - 1] = '\0'; - } if (!strncmp("close ", p, 6)) { p += 6; action = 0; @@ -2690,7 +2689,8 @@ goto out_up; } - if (action) { /* open */ + if (action) { + /* open */ virt_dev = NULL; list_for_each_entry(vv, &vdisk_dev_list, vdisk_dev_list_entry) @@ -3089,11 +3089,10 @@ /* seek to end */ old_fs = get_fs(); set_fs(get_ds()); - if (fd->f_op->llseek) { + if (fd->f_op->llseek) err = fd->f_op->llseek(fd, 0, 2/*SEEK_END*/); - } else { + else err = default_llseek(fd, 0, 2/*SEEK_END*/); - } set_fs(old_fs); filp_close(fd, NULL); if (err < 0) { @@ -3207,9 +3206,8 @@ } p = buffer; - if (p[strlen(p) - 1] == '\n') { + if (p[strlen(p) - 1] == '\n') p[strlen(p) - 1] = '\0'; - } if (!strncmp("close ", p, 6)) { p += 6; action = 0; @@ -3242,15 +3240,18 @@ goto out_up; } - if (action == 2) { /* open */ + if (action == 2) { + /* open */ res = vcdrom_open(p, name); if (res != 0) goto out_up; - } else if (action == 1) { /* change */ + } else if (action == 1) { + /* change */ res = vcdrom_change(p, name); if (res != 0) goto out_up; - } else { /* close */ + } else { + /* close */ res = vcdrom_close(name); if (res != 0) goto out_up; Modified: trunk/scst/src/scst_cdbprobe.h =================================================================== --- trunk/scst/src/scst_cdbprobe.h 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/scst_cdbprobe.h 2008-05-22 16:13:36 UTC (rev 386) @@ -54,8 +54,7 @@ #define SCST_CDB_RESERVED 'R' /* reserved */ #define SCST_CDB_NOTSUPP ' ' /* don't use */ -struct scst_sdbops -{ +struct scst_sdbops { uint8_t ops; /* SCSI-2 op codes */ uint8_t devkey[16]; /* Key for every device type M,O,V,R * type_disk devkey[0] Modified: trunk/scst/src/scst_debug.c =================================================================== --- trunk/scst/src/scst_debug.c 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/scst_debug.c 2008-05-22 16:13:36 UTC (rev 386) @@ -109,11 +109,10 @@ trace_buf[i++] = '.'; } trace_buf[i] = '\0'; - if (f) { - PRINT(log_level, "%s", trace_buf) - } else { + if (f) + PRINT(log_level, "%s", trace_buf); + else PRINT(NO_FLAG, "%s", trace_buf); - } spin_unlock_irqrestore(&trace_buf_lock, flags); return; Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/scst_lib.c 2008-05-22 16:13:36 UTC (rev 386) @@ -438,9 +438,8 @@ tgt_dev->max_sg_cnt = min(ini_sg, sess->tgt->sg_tablesize); if ((sess->tgt->tgtt->use_clustering || ini_use_clustering) && - !sess->tgt->tgtt->no_clustering) { + !sess->tgt->tgtt->no_clustering) scst_sgv_pool_use_norm_clust(tgt_dev); - } if (sess->tgt->tgtt->unchecked_isa_dma || ini_unchecked_isa_dma) { scst_sgv_pool_use_dma(tgt_dev); @@ -455,8 +454,7 @@ "SCST lun=%Ld", dev->scsi_dev->host->host_no, dev->scsi_dev->channel, dev->scsi_dev->id, dev->scsi_dev->lun, (uint64_t)tgt_dev->lun); - } - else { + } else { TRACE_MGMT_DBG("Virtual device %s on SCST lun=%Ld", dev->virt_name, (uint64_t)tgt_dev->lun); } @@ -834,9 +832,8 @@ list_add_tail(&n->acn_list_entry, &acg->acn_list); out: - if (res == 0) { + if (res == 0) PRINT_INFO("Added name %s to group %s", name, acg->acg_name); - } TRACE_EXIT_RES(res); return res; @@ -1424,8 +1421,7 @@ */ atomic_inc(&tgt->finished_cmds); smp_mb__after_atomic_inc(); - if (unlikely(tgt->retry_cmds > 0)) - { + if (unlikely(tgt->retry_cmds > 0)) { struct scst_cmd *c, *tc; unsigned long flags; @@ -2729,9 +2725,8 @@ list_del(&cmd->sn_cmd_list_entry); spin_unlock_irq(&tgt_dev->sn_lock); if (test_and_set_bit(SCST_CMD_CAN_BE_DESTROYED, - &cmd->cmd_flags)) { + &cmd->cmd_flags)) scst_destroy_put_cmd(cmd); - } scst_inc_expected_sn(tgt_dev, slot); expected_sn = tgt_dev->expected_sn; spin_lock_irq(&tgt_dev->sn_lock); @@ -3163,7 +3158,8 @@ hi = rv / 127773; lo = rv % 127773; rv = 16807 * lo - 2836 * hi; - if (rv <= 0) rv += 2147483647; + if (rv <= 0) + rv += 2147483647; RandomValue = rv; spin_unlock_irqrestore(&lock, flags); return rv; @@ -3182,8 +3178,7 @@ static spinlock_t scst_tm_dbg_lock = SPIN_LOCK_UNLOCKED; /* All serialized by scst_tm_dbg_lock */ -struct -{ +struct { unsigned int tm_dbg_release:1; unsigned int tm_dbg_blocked:1; } tm_dbg_flags; Modified: trunk/scst/src/scst_main.c =================================================================== --- trunk/scst/src/scst_main.c 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/scst_main.c 2008-05-22 16:13:36 UTC (rev 386) @@ -147,8 +147,7 @@ MODULE_PARM_DESC(scst_max_cmd_mem, "Maximum memory allowed to be consumed by " "the SCST commands at any given time in MB"); -struct scst_dev_type scst_null_devtype = -{ +struct scst_dev_type scst_null_devtype = { .name = "none", }; @@ -542,8 +541,7 @@ "scsi%d, channel %d, id %d, lun %d, type %d", scsidp->host->host_no, scsidp->channel, scsidp->id, scsidp->lun, scsidp->type); - } - else { + } else { PRINT_ERROR("Failed to attach SCSI target mid-level " "at scsi%d, channel %d, id %d, lun %d, type %d", scsidp->host->host_no, scsidp->channel, scsidp->id, @@ -696,8 +694,7 @@ if (res > 0) { PRINT_INFO("Attached SCSI target mid-level to virtual " "device %s (id %d)", dev_name, dev->virt_id); - } - else { + } else { PRINT_INFO("Failed to attach SCSI target mid-level to " "virtual device %s", dev_name); } @@ -807,9 +804,8 @@ goto out_up; res = scst_build_proc_dev_handler_dir_entries(dev_type); - if (res < 0) { + if (res < 0) goto out_up; - } list_add_tail(&dev_type->dev_type_list_entry, &scst_dev_type_list); @@ -1033,9 +1029,8 @@ list_for_each_entry_safe(ct, tmp, &dev->threads_list, thread_list_entry) { int rc = kthread_stop(ct->cmd_thread); - if (rc < 0) { + if (rc < 0) TRACE_MGMT_DBG("kthread_stop() failed: %d", rc); - } list_del(&ct->thread_list_entry); kfree(ct); if ((num > 0) && (++i >= num)) @@ -1204,9 +1199,8 @@ int res; res = kthread_stop(ct->cmd_thread); - if (res < 0) { + if (res < 0) TRACE_MGMT_DBG("kthread_stop() failed: %d", res); - } list_del(&ct->thread_list_entry); kfree(ct); scst_threads_info.nr_cmd_threads--; @@ -1553,7 +1547,10 @@ p = KMEM_CACHE(s, SCST_SLAB_FLAGS); \ TRACE_MEM("Slab create: %s at %p size %zd", #s, p, \ sizeof(struct s)); \ - if (p == NULL) { res = -ENOMEM; goto o; } \ + if (p == NULL) { \ + res = -ENOMEM; \ + goto o; \ + } \ } while (0) INIT_CACHEP(scst_mgmt_cachep, scst_mgmt_cmd, out); Modified: trunk/scst/src/scst_mem.c =================================================================== --- trunk/scst/src/scst_mem.c 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/scst_mem.c 2008-05-22 16:13:36 UTC (rev 386) @@ -809,9 +809,8 @@ static void sgv_pool_cached_init(struct sgv_pool *pool) { int i; - for (i = 0; i < SGV_POOL_ELEMENTS; i++) { + for (i = 0; i < SGV_POOL_ELEMENTS; i++) INIT_LIST_HEAD(&pool->recycling_lists[i]); - } } int sgv_pool_init(struct sgv_pool *pool, const char *name, int clustered) Modified: trunk/scst/src/scst_mem.h =================================================================== --- trunk/scst/src/scst_mem.h 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/scst_mem.h 2008-05-22 16:13:36 UTC (rev 386) @@ -30,8 +30,7 @@ unsigned short pg_count; }; -struct sgv_pool_obj -{ +struct sgv_pool_obj { int order; struct { @@ -50,30 +49,26 @@ struct scatterlist sg_entries_data[0]; }; -struct sgv_pool_acc -{ +struct sgv_pool_acc { u32 cached_pages, cached_entries; atomic_t big_alloc, other_alloc; atomic_t big_pages, other_pages; atomic_t big_merged, other_merged; }; -struct sgv_pool_cache_acc -{ +struct sgv_pool_cache_acc { atomic_t total_alloc, hit_alloc; atomic_t merged; }; -struct sgv_pool_alloc_fns -{ +struct sgv_pool_alloc_fns { struct page *(*alloc_pages_fn)(struct scatterlist *sg, gfp_t gfp_mask, void *priv); void (*free_pages_fn)(struct scatterlist *sg, int sg_count, void *priv); }; -struct sgv_pool -{ +struct sgv_pool { unsigned int clustered; struct sgv_pool_alloc_fns alloc_fns; /* 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048 */ @@ -89,8 +84,7 @@ struct list_head sgv_pool_list_entry; }; -struct scst_sgv_pools_manager -{ +struct scst_sgv_pools_manager { struct { struct sgv_pool norm_clust, norm; struct sgv_pool dma; Modified: trunk/scst/src/scst_priv.h =================================================================== --- trunk/scst/src/scst_priv.h 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/scst_priv.h 2008-05-22 16:13:36 UTC (rev 386) @@ -181,8 +181,7 @@ extern struct list_head scst_delayed_mgmt_cmd_list; extern wait_queue_head_t scst_mgmt_cmd_list_waitQ; -struct scst_tasklet -{ +struct scst_tasklet { spinlock_t tasklet_lock; struct list_head tasklet_cmd_list; struct tasklet_struct tasklet; Modified: trunk/scst/src/scst_proc.c =================================================================== --- trunk/scst/src/scst_proc.c 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/scst_proc.c 2008-05-22 16:13:36 UTC (rev 386) @@ -268,9 +268,8 @@ p += 6; action = SCST_PROC_ACTION_VALUE; } else { - if (p[strlen(p) - 1] == '\n') { + if (p[strlen(p) - 1] == '\n') p[strlen(p) - 1] = '\0'; - } PRINT_ERROR("Unknown action \"%s\"", p); res = -EINVAL; goto out_free; @@ -289,13 +288,11 @@ case SCST_PROC_ACTION_SET: case SCST_PROC_ACTION_ADD: case SCST_PROC_ACTION_DEL: - while (isspace(*p) && *p != '\0') { + while (isspace(*p) && *p != '\0') p++; - } e = p; - while (!isspace(*e) && *e != '\0') { + while (!isspace(*e) && *e != '\0') e++; - } *e = 0; if (tbl) { t = tbl; @@ -324,9 +321,8 @@ } break; case SCST_PROC_ACTION_VALUE: - while (isspace(*p) && *p != '\0') { + while (isspace(*p) && *p != '\0') p++; - } level = simple_strtoul(p, NULL, 0); break; } @@ -802,17 +798,14 @@ goto out_remove4; } - if (scst_proc_init_module_log() < 0) { + if (scst_proc_init_module_log() < 0) goto out_remove5; - } - if (scst_proc_init_groups() < 0) { + if (scst_proc_init_groups() < 0) goto out_remove6; - } - if (scst_proc_init_sgv() < 0) { + if (scst_proc_init_sgv() < 0) goto out_remove7; - } out: TRACE_EXIT_RES(res); @@ -1251,9 +1244,8 @@ * or echo "assign H:C:I:L HANDLER_NAME" >/proc/scsi_tgt/scsi_tgt */ p = buffer; - if (p[strlen(p) - 1] == '\n') { + if (p[strlen(p) - 1] == '\n') p[strlen(p) - 1] = '\0'; - } if (!strncasecmp("assign ", p, 7)) { p += 7; action = SCST_PROC_ACTION_ASSIGN; @@ -1345,9 +1337,8 @@ TRACE_ENTRY(); - while (isspace(*p) && *p != '\0') { + while (isspace(*p) && *p != '\0') p++; - } host = simple_strtoul(p, &p, 0); if ((host == ULONG_MAX) || (*p != ':')) @@ -1367,13 +1358,11 @@ e = p; e++; - while (isspace(*e) && *e != '\0') { + while (isspace(*e) && *e != '\0') e++; - } ee = e; - while (!isspace(*ee) && *ee != '\0') { + while (!isspace(*ee) && *ee != '\0') ee++; - } *ee = '\0'; TRACE_DBG("Dev %ld:%ld:%ld:%ld, handler %s", host, channel, id, lun, e); @@ -1383,8 +1372,7 @@ d->scsi_dev->host->host_no == host && d->scsi_dev->channel == channel && d->scsi_dev->id == id && - d->scsi_dev->lun == lun) - { + d->scsi_dev->lun == lun) { dev = d; TRACE_DBG("Dev %p (%ld:%ld:%ld:%ld) found", dev, host, channel, id, lun); @@ -1476,9 +1464,8 @@ * or echo "clear" >/proc/scsi_tgt/groups/GROUP/devices */ p = buffer; - if (p[strlen(p) - 1] == '\n') { + if (p[strlen(p) - 1] == '\n') p[strlen(p) - 1] = '\0'; - } if (!strncasecmp("clear", p, 5)) { action = SCST_PROC_ACTION_CLEAR; } else if (!strncasecmp("add ", p, 4)) { @@ -1503,9 +1490,8 @@ switch (action) { case SCST_PROC_ACTION_ADD: case SCST_PROC_ACTION_DEL: - while (isspace(*p) && *p != '\0') { + while (isspace(*p) && *p != '\0') p++; - } e = p; /* save p */ host = simple_strtoul(p, &p, 0); if (*p == ':') { @@ -1516,9 +1502,8 @@ } else { virt++; p = e; /* restore p */ - while (!isspace(*e) && *e != '\0') { + while (!isspace(*e) && *e != '\0') e++; - } *e = 0; } @@ -1561,17 +1546,14 @@ switch (action) { case SCST_PROC_ACTION_ADD: e++; - while (isspace(*e) && *e != '\0') { + while (isspace(*e) && *e != '\0') e++; - } virt_lun = simple_strtoul(e, &e, 0); - while (isspace(*e) && *e != '\0') { + while (isspace(*e) && *e != '\0') e++; - } - if (!strncasecmp("READ_ONLY", e, 9)) { + if (!strncasecmp("READ_ONLY", e, 9)) read_only = 1; - } list_for_each_entry(acg_dev_tmp, &acg->acg_dev_list, acg_dev_list_entry) { @@ -1667,9 +1649,8 @@ * or echo "clear" >/proc/scsi_tgt/groups/GROUP/names */ p = buffer; - if (p[strlen(p) - 1] == '\n') { + if (p[strlen(p) - 1] == '\n') p[strlen(p) - 1] = '\0'; - } if (!strncasecmp("clear", p, 5)) { action = SCST_PROC_ACTION_CLEAR; } else if (!strncasecmp("add ", p, 4)) { @@ -1687,13 +1668,11 @@ switch (action) { case SCST_PROC_ACTION_ADD: case SCST_PROC_ACTION_DEL: - while (isspace(*p) && *p != '\0') { + while (isspace(*p) && *p != '\0') p++; - } e = p; - while (!isspace(*e) && *e != '\0') { + while (!isspace(*e) && *e != '\0') e++; - } *e = 0; break; } @@ -1976,9 +1955,8 @@ scst_proc_read_tlb(scst_proc_trace_tbl, seq, log_level, &first); - if (tbl) { + if (tbl) scst_proc_read_tlb(tbl, seq, log_level, &first); - } seq_printf(seq, "%s\n", first ? "none" : ""); Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-05-22 15:55:23 UTC (rev 385) +++ trunk/scst/src/scst_targ.c 2008-05-22 16:13:36 UTC (rev 386) @@ -201,8 +201,7 @@ #ifdef EXTRACHECKS if (unlikely(in_irq()) && ((pref_context == SCST_CONTEXT_DIRECT) || - (pref_context == SCST_CONTEXT_DIRECT_ATOMIC))) - { + (pref_context == SCST_CONTEXT_DIRECT_ATOMIC))) { PRINT_ERROR("Wrong context %d in IRQ from target %s, use " "SCST_CONTEXT_TASKLET instead\n", pref_context, cmd->tgtt->name); @@ -962,8 +961,7 @@ #ifdef EXTRACHECKS if (in_irq() && ((pref_context == SCST_CONTEXT_DIRECT) || - (pref_context == SCST_CONTEXT_DIRECT_ATOMIC))) - { + (pref_context == SCST_CONTEXT_DIRECT_ATOMIC))) { PRINT_ERROR("Wrong context %d in IRQ from target %s, use " "SCST_CONTEXT_TASKLET instead\n", pref_context, cmd->tgtt->name); @@ -1228,8 +1226,7 @@ #ifdef EXTRACHECKS if ((next_state != SCST_CMD_STATE_PRE_DEV_DONE) && (next_state != SCST_CMD_STATE_PRE_XMIT_RESP) && - (next_state != SCST_CMD_STATE_FINISHED)) - { + (next_state != SCST_CMD_STATE_FINISHED)) { PRINT_ERROR("scst_cmd_done_local() received invalid cmd " "state %d (opcode %d)", next_state, cmd->cdb[0]); scst_set_cmd_error(cmd, @@ -2390,8 +2387,7 @@ state = SCST_CMD_STATE_PRE_XMIT_RESP; if (likely(!scst_is_cmd_local(cmd)) && - likely(cmd->dev->handler->dev_done != NULL)) - { + likely(cmd->dev->handler->dev_done != NULL)) { int rc; TRACE_DBG("Calling dev handler %s dev_done(%p)", cmd->dev->handler->name, cmd); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-05-23 15:12:39
|
Revision: 391 http://scst.svn.sourceforge.net/scst/?rev=391&view=rev Author: vlnb Date: 2008-05-23 08:12:34 -0700 (Fri, 23 May 2008) Log Message: ----------- - Fixed problems with 64-bit platforms with 32-bit user space and with non-4K pages - From the main Makefile all all LSI/MPT related targets are commented out, because the recent changes in its Makefile have broken them. Modified Paths: -------------- trunk/Makefile trunk/iscsi-scst/include/iscsi_scst.h trunk/iscsi-scst/kernel/config.c trunk/iscsi-scst/kernel/iscsi.c trunk/iscsi-scst/usr/ctldev.c trunk/iscsi-scst/usr/iscsi_scstd.c trunk/iscsi-scst/usr/iscsid.h trunk/iscsi-scst/usr/param.c Modified: trunk/Makefile =================================================================== --- trunk/Makefile 2008-05-23 09:56:13 UTC (rev 390) +++ trunk/Makefile 2008-05-23 15:12:34 UTC (rev 391) @@ -98,7 +98,7 @@ uninstall: cd $(SCST_DIR) && $(MAKE) $@ @if [ -d $(QLA_DIR) ]; then cd $(QLA_DIR) && $(MAKE) $@; fi - @if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi +# @if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi @if [ -d $(SRP_DIR) ]; then cd $(SRP_DIR) && $(MAKE) $@; fi @if [ -d $(ISCSI_DIR) ]; then cd $(ISCSI_DIR) && $(MAKE) $@; fi @if [ -d $(USR_DIR) ]; then cd $(USR_DIR) && $(MAKE) $@; fi @@ -107,7 +107,7 @@ cd $(SCST_DIR) && $(MAKE) $@ @if [ -d $(QLA_INI_DIR) ]; then cd $(QLA_INI_DIR) && $(MAKE) $@; fi @if [ -d $(QLA_DIR) ]; then cd $(QLA_DIR) && $(MAKE) $@; fi - @if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi +# @if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi @if [ -d $(SRP_DIR) ]; then cd $(SRP_DIR) && $(MAKE) $@; fi @if [ -d $(ISCSI_DIR) ]; then cd $(ISCSI_DIR) && $(MAKE) $@; fi @if [ -d $(USR_DIR) ]; then cd $(USR_DIR) && $(MAKE) $@; fi @@ -116,7 +116,7 @@ cd $(SCST_DIR) && $(MAKE) $@ @if [ -d $(QLA_INI_DIR) ]; then cd $(QLA_INI_DIR) && $(MAKE) $@; fi @if [ -d $(QLA_DIR) ]; then cd $(QLA_DIR) && $(MAKE) $@; fi - @if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi +# @if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi @if [ -d $(SRP_DIR) ]; then cd $(SRP_DIR) && $(MAKE) $@; fi @if [ -d $(ISCSI_DIR) ]; then cd $(ISCSI_DIR) && $(MAKE) $@; fi @if [ -d $(USR_DIR) ]; then cd $(USR_DIR) && $(MAKE) $@; fi Modified: trunk/iscsi-scst/include/iscsi_scst.h =================================================================== --- trunk/iscsi-scst/include/iscsi_scst.h 2008-05-23 09:56:13 UTC (rev 390) +++ trunk/iscsi-scst/include/iscsi_scst.h 2008-05-23 15:12:34 UTC (rev 391) @@ -119,15 +119,18 @@ u32 state; }; +struct iscsi_register_info { + aligned_u64 version; + u32 max_data_seg_len; +}; + #define DEFAULT_NR_QUEUED_CMNDS 32 #define MIN_NR_QUEUED_CMNDS 1 #define MAX_NR_QUEUED_CMNDS 256 -#define MAX_DATA_SEG_LEN (4096/sizeof(struct iovec)*4096) - #define NETLINK_ISCSI_SCST 25 -#define REGISTER_USERD _IOW('s', 0, const char*) +#define REGISTER_USERD _IOW('s', 0, struct iscsi_register_info) #define ADD_TARGET _IOW('s', 1, struct target_info) #define DEL_TARGET _IOW('s', 2, struct target_info) #define ADD_SESSION _IOW('s', 3, struct session_info) Modified: trunk/iscsi-scst/kernel/config.c =================================================================== --- trunk/iscsi-scst/kernel/config.c 2008-05-23 09:56:13 UTC (rev 390) +++ trunk/iscsi-scst/kernel/config.c 2008-05-23 15:12:34 UTC (rev 391) @@ -371,23 +371,39 @@ static int iscsi_check_version(unsigned long arg) { + struct iscsi_register_info reg; char ver[sizeof(ISCSI_SCST_INTERFACE_VERSION)+1]; - int res; + int res, max_data_seg_len; - res = copy_from_user(ver, (void *)arg, sizeof(ver)); + res = copy_from_user(®, (void *)arg, sizeof(reg)); if (res < 0) { + PRINT_ERROR("%s", "Unable to get register info"); + goto out; + } + + res = copy_from_user(ver, (void *)(unsigned long)reg.version, + sizeof(ver)); + if (res < 0) { PRINT_ERROR("%s", "Unable to get version string"); goto out; } ver[sizeof(ver)-1] = '\0'; if (strcmp(ver, ISCSI_SCST_INTERFACE_VERSION) != 0) { - PRINT_ERROR("Incorrect version of user space %s (needed %s)", + PRINT_ERROR("Incorrect version of user space %s (expected %s)", ver, ISCSI_SCST_INTERFACE_VERSION); res = -EINVAL; goto out; } + max_data_seg_len = ISCSI_CONN_IOV_MAX << PAGE_SHIFT; + if (reg.max_data_seg_len != max_data_seg_len) { + PRINT_ERROR("Incorrect max_data_seg_len %d (expected %d)", + reg.max_data_seg_len, max_data_seg_len); + res = -EINVAL; + goto out; + } + out: return res; } Modified: trunk/iscsi-scst/kernel/iscsi.c =================================================================== --- trunk/iscsi-scst/kernel/iscsi.c 2008-05-23 09:56:13 UTC (rev 390) +++ trunk/iscsi-scst/kernel/iscsi.c 2008-05-23 15:12:34 UTC (rev 391) @@ -2907,8 +2907,6 @@ "degraded mode. Refer README file for details"); #endif - BUILD_BUG_ON(MAX_DATA_SEG_LEN != (ISCSI_CONN_IOV_MAX<<PAGE_SHIFT)); - if ((ctr_major = register_chrdev(0, ctr_name, &ctr_fops)) < 0) { PRINT_ERROR("failed to register the control device %d", ctr_major); err = ctr_major; Modified: trunk/iscsi-scst/usr/ctldev.c =================================================================== --- trunk/iscsi-scst/usr/ctldev.c 2008-05-23 09:56:13 UTC (rev 390) +++ trunk/iscsi-scst/usr/ctldev.c 2008-05-23 15:12:34 UTC (rev 391) @@ -34,7 +34,7 @@ int (*connection_op) (int fd, u32 tid, u64 sid, u32 cid, void *arg); }; -static int ctrdev_open(void) +static int ctrdev_open(int max_data_seg_len) { FILE *f; char devname[256]; @@ -42,6 +42,7 @@ int devn; int ctlfd = -1; int err; + struct iscsi_register_info reg = { 0 }; if (!(f = fopen("/proc/devices", "r"))) { perror("Cannot open control path to the driver\n"); @@ -81,9 +82,12 @@ goto out; } - err = ioctl(ctlfd, REGISTER_USERD, ISCSI_SCST_INTERFACE_VERSION); + reg.version = ISCSI_SCST_INTERFACE_VERSION; + reg.max_data_seg_len = max_data_seg_len; + err = ioctl(ctlfd, REGISTER_USERD, ®); if (err < 0) { - log_error("Unable to register: %s\n", strerror(errno)); + log_error("Unable to register: %s. Incompatible version of the " + "kernel module?\n", strerror(errno)); close(ctlfd); ctlfd = -1; goto out; Modified: trunk/iscsi-scst/usr/iscsi_scstd.c =================================================================== --- trunk/iscsi-scst/usr/iscsi_scstd.c 2008-05-23 09:56:13 UTC (rev 390) +++ trunk/iscsi-scst/usr/iscsi_scstd.c 2008-05-23 15:12:34 UTC (rev 391) @@ -518,6 +518,42 @@ } } +int init_max_data_seg_len(void) +{ + int page_size = getpagesize(); + int max_data_seg_len = page_size / sizeof(struct iovec) * page_size; + + if ((session_keys[3].local_def != -1) || + (session_keys[3].max != -1) || + (session_keys[4].local_def != -1) || + (session_keys[4].max != -1) || + (session_keys[5].local_def != -1) || + (session_keys[5].max != -1) || + (session_keys[6].local_def != -1) || + (session_keys[6].max != -1)) { + log_error("Wrong session_keys initialization"); + exit(-1); + } + + /* MaxRecvDataSegmentLength */ + session_keys[3].local_def = max_data_seg_len; + session_keys[3].max = max_data_seg_len; + + /* MaxXmitDataSegmentLength */ + session_keys[4].local_def = max_data_seg_len; + session_keys[4].max = max_data_seg_len; + + /* MaxBurstLength */ + session_keys[5].local_def = max_data_seg_len; + session_keys[5].max = max_data_seg_len; + + /* FirstBurstLength */ + session_keys[6].local_def = max_data_seg_len; + session_keys[6].max = max_data_seg_len; + + return max_data_seg_len; +} + int main(int argc, char **argv) { int ch, longindex, timeout = -1; @@ -526,6 +562,7 @@ gid_t gid = 0; char *isns = NULL; int isns_ac = 0; + int max_data_seg_len; if (pipe(init_report_pipe) == -1) { perror("pipe"); @@ -573,7 +610,9 @@ exit(-1); }; - if ((ctrl_fd = ki->ctldev_open()) < 0) + max_data_seg_len = init_max_data_seg_len(); + + if ((ctrl_fd = ki->ctldev_open(max_data_seg_len)) < 0) exit(-1); if ((ipc_fd = iscsi_adm_request_listen()) < 0) { Modified: trunk/iscsi-scst/usr/iscsid.h =================================================================== --- trunk/iscsi-scst/usr/iscsid.h 2008-05-23 09:56:13 UTC (rev 390) +++ trunk/iscsi-scst/usr/iscsid.h 2008-05-23 15:12:34 UTC (rev 391) @@ -210,7 +210,7 @@ /* ctldev.c */ struct iscsi_kernel_interface { - int (*ctldev_open) (void); + int (*ctldev_open) (int); int (*param_get) (u32, u64, int, struct iscsi_param *, int); int (*param_set) (u32, u64, int, u32, struct iscsi_param *, int); int (*target_create) (u32 *, char *); Modified: trunk/iscsi-scst/usr/param.c =================================================================== --- trunk/iscsi-scst/usr/param.c 2008-05-23 09:56:13 UTC (rev 390) +++ trunk/iscsi-scst/usr/param.c 2008-05-23 15:12:34 UTC (rev 391) @@ -293,10 +293,10 @@ {"InitialR2T", 1, 0, 0, 1, &or_ops}, {"ImmediateData", 1, 1, 0, 1, &and_ops}, {"MaxConnections", 1, 1, 1, 1, &minimum_ops}, - {"MaxRecvDataSegmentLength", 8192, MAX_DATA_SEG_LEN, 512, MAX_DATA_SEG_LEN, &minimum_ops}, - {"MaxXmitDataSegmentLength", 8192, MAX_DATA_SEG_LEN, 512, MAX_DATA_SEG_LEN, &minimum_ops}, - {"MaxBurstLength", 262144, MAX_DATA_SEG_LEN, 512, MAX_DATA_SEG_LEN, &minimum_ops}, - {"FirstBurstLength", 65536, MAX_DATA_SEG_LEN, 512, MAX_DATA_SEG_LEN, &minimum_ops}, + {"MaxRecvDataSegmentLength", 8192, -1, 512, -1, &minimum_ops}, + {"MaxXmitDataSegmentLength", 8192, -1, 512, -1, &minimum_ops}, + {"MaxBurstLength", 262144, -1, 512, -1, &minimum_ops}, + {"FirstBurstLength", 65536, -1, 512, -1, &minimum_ops}, {"DefaultTime2Wait", 2, 2, 0, 3600, &maximum_ops}, {"DefaultTime2Retain", 20, 20, 0, 3600, &minimum_ops}, {"MaxOutstandingR2T", 1, 20, 1, 65535, &minimum_ops}, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-05-27 14:26:20
|
Revision: 398 http://scst.svn.sourceforge.net/scst/?rev=398&view=rev Author: vlnb Date: 2008-05-27 07:26:15 -0700 (Tue, 27 May 2008) Log Message: ----------- Patch from Bart Van Assche <bar...@gm...>: The patch below fixes the following categories of checkpatch complaints: - ERROR: switch and case should be at the same indent - ERROR: do not initialise statics to 0 or NULL - ERROR: use tabs not spaces I have verified that the SCST source code still compiles. Signed-off-by: Bart Van Assche <bar...@gm...> Modified Paths: -------------- trunk/iscsi-scst/kernel/config.c trunk/iscsi-scst/kernel/event.c trunk/scst/src/dev_handlers/scst_vdisk.c trunk/scst/src/scst_lib.c trunk/scst/src/scst_main.c trunk/scst/src/scst_targ.c trunk/srpt/src/ib_srpt.c Modified: trunk/iscsi-scst/kernel/config.c =================================================================== --- trunk/iscsi-scst/kernel/config.c 2008-05-26 11:13:04 UTC (rev 397) +++ trunk/iscsi-scst/kernel/config.c 2008-05-27 14:26:15 UTC (rev 398) @@ -526,7 +526,7 @@ static void iscsi_dump_char(int ch) { static unsigned char text[16]; - static int i = 0; + static int i; if (ch < 0) { while ((i % 16) != 0) { Modified: trunk/iscsi-scst/kernel/event.c =================================================================== --- trunk/iscsi-scst/kernel/event.c 2008-05-26 11:13:04 UTC (rev 397) +++ trunk/iscsi-scst/kernel/event.c 2008-05-27 14:26:15 UTC (rev 398) @@ -89,7 +89,7 @@ { struct sk_buff *skb; struct nlmsghdr *nlh; - static u32 seq = 0; + static u32 seq; if (!(skb = alloc_skb(NLMSG_SPACE(len), gfp_mask))) return -ENOMEM; Modified: trunk/scst/src/dev_handlers/scst_vdisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_vdisk.c 2008-05-26 11:13:04 UTC (rev 397) +++ trunk/scst/src/dev_handlers/scst_vdisk.c 2008-05-27 14:26:15 UTC (rev 398) @@ -648,11 +648,11 @@ static inline int vdisk_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; + case SCST_CMD_QUEUE_ORDERED: + case SCST_CMD_QUEUE_HEAD_OF_QUEUE: + return 1; + default: + return 0; } } Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2008-05-26 11:13:04 UTC (rev 397) +++ trunk/scst/src/scst_lib.c 2008-05-27 14:26:15 UTC (rev 398) @@ -2443,8 +2443,8 @@ list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { TRACE(TRACE_MGMT, "Clearing RESERVE'ation for tgt_dev " - "lun %Ld", - (long long unsigned int)tgt_dev->lun); + "lun %Ld", + (long long unsigned int)tgt_dev->lun); clear_bit(SCST_TGT_DEV_RESERVED, &tgt_dev->tgt_dev_flags); } Modified: trunk/scst/src/scst_main.c =================================================================== --- trunk/scst/src/scst_main.c 2008-05-26 11:13:04 UTC (rev 397) +++ trunk/scst/src/scst_main.c 2008-05-27 14:26:15 UTC (rev 398) @@ -1217,7 +1217,7 @@ int __scst_add_cmd_threads(int num) { int res = 0, i; - static int scst_thread_num = 0; + static int scst_thread_num; TRACE_ENTRY(); Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-05-26 11:13:04 UTC (rev 397) +++ trunk/scst/src/scst_targ.c 2008-05-27 14:26:15 UTC (rev 398) @@ -3494,15 +3494,15 @@ { switch (mgmt_fn) { #ifdef ABORT_CONSIDER_FINISHED_TASKS_AS_NOT_EXISTING - case SCST_ABORT_TASK: + case SCST_ABORT_TASK: #endif #if 0 - case SCST_ABORT_TASK_SET: - case SCST_CLEAR_TASK_SET: + case SCST_ABORT_TASK_SET: + case SCST_CLEAR_TASK_SET: #endif - return 1; - default: - return 0; + return 1; + default: + return 0; } } Modified: trunk/srpt/src/ib_srpt.c =================================================================== --- trunk/srpt/src/ib_srpt.c 2008-05-26 11:13:04 UTC (rev 397) +++ trunk/srpt/src/ib_srpt.c 2008-05-27 14:26:15 UTC (rev 398) @@ -60,7 +60,7 @@ struct task_struct *thread; }; -static u64 mellanox_ioc_guid = 0; +static u64 mellanox_ioc_guid; static struct list_head srpt_devices; static int thread = 1; static struct srpt_thread srpt_thread; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-05-29 17:24:22
|
Revision: 402 http://scst.svn.sourceforge.net/scst/?rev=402&view=rev Author: vlnb Date: 2008-05-29 10:24:18 -0700 (Thu, 29 May 2008) Log Message: ----------- Patch from Bart Van Assche <bar...@gm...>: The patch below fixes the checkpatch complaints on kfree(): WARNING: kfree(NULL) is safe this check is probabally not required This patch has been verified as follows: - Verified that checkpatch does no longer complain about kfree(). - Verified that make -s clean && make -s iscsi scst && make -s -C srpt still works and does not trigger any new compiler warnings. - Checked that the patch generated by generate-kernel-patch still applies cleanly to the 2.6.25.4 kernel, and that the patched kernel tree still compiles, installs and boots fine, and that the iscsi-scst, ib_srpt, scst_disk and scst_vdisk modules still load. Note: I'm not sure any of the above verifications did trigger the code paths changed by this patch. Signed-off-by: Bart Van Assche <bar...@gm...> Modified Paths: -------------- trunk/mpt/mpt_scst.c trunk/scst/src/dev_handlers/scst_vdisk.c trunk/scst/src/scst_main.c trunk/srpt/src/ib_srpt.c Modified: trunk/mpt/mpt_scst.c =================================================================== --- trunk/mpt/mpt_scst.c 2008-05-28 11:17:08 UTC (rev 401) +++ trunk/mpt/mpt_scst.c 2008-05-29 17:24:18 UTC (rev 402) @@ -4592,8 +4592,7 @@ if (priv == NULL) { printk(KERN_ERR MYNAM ":%s failed to allocate private structure\n", ioc->name); - if (priv != NULL) - kfree(priv); + kfree(priv); return (-1); } memset(priv, 0, sizeof(*priv)); Modified: trunk/scst/src/dev_handlers/scst_vdisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_vdisk.c 2008-05-28 11:17:08 UTC (rev 401) +++ trunk/scst/src/dev_handlers/scst_vdisk.c 2008-05-29 17:24:18 UTC (rev 402) @@ -548,8 +548,7 @@ if (thr->fd) filp_close(thr->fd, NULL); - if (thr->iv != NULL) - kfree(thr->iv); + kfree(thr->iv); kmem_cache_free(vdisk_thr_cachep, thr); @@ -1926,8 +1925,7 @@ iv_count = scst_get_buf_count(cmd); if (iv_count > thr->iv_count) { - if (thr->iv != NULL) - kfree(thr->iv); + kfree(thr->iv); thr->iv = kmalloc(sizeof(*thr->iv) * iv_count, GFP_KERNEL); if (thr->iv == NULL) { PRINT_ERROR("Unable to allocate iv (%d)", iv_count); @@ -3011,8 +3009,7 @@ list_del(&virt_dev->vdisk_dev_list_entry); - if (virt_dev->file_name) - kfree(virt_dev->file_name); + kfree(virt_dev->file_name); kfree(virt_dev); out: @@ -3148,8 +3145,7 @@ virt_dev->name); } - if (old_fn) - kfree(old_fn); + kfree(old_fn); out_resume: scst_resume_activity(); Modified: trunk/scst/src/scst_main.c =================================================================== --- trunk/scst/src/scst_main.c 2008-05-28 11:17:08 UTC (rev 401) +++ trunk/scst/src/scst_main.c 2008-05-29 17:24:18 UTC (rev 402) @@ -352,8 +352,7 @@ return tgt; out_free_name: - if (tgt->default_group_name) - kfree(tgt->default_group_name); + kfree(tgt->default_group_name); out_free_err: mutex_unlock(&scst_mutex); @@ -406,8 +405,7 @@ scst_cleanup_proc_target_entries(tgt); - if (tgt->default_group_name) - kfree(tgt->default_group_name); + kfree(tgt->default_group_name); mutex_unlock(&scst_mutex); scst_resume_activity(); Modified: trunk/srpt/src/ib_srpt.c =================================================================== --- trunk/srpt/src/ib_srpt.c 2008-05-28 11:17:08 UTC (rev 401) +++ trunk/srpt/src/ib_srpt.c 2008-05-29 17:24:18 UTC (rev 402) @@ -614,14 +614,12 @@ if (ioctx->n_rdma_ius > 0 && ioctx->rdma_ius) { struct rdma_iu *riu = ioctx->rdma_ius; - for (i = 0; i < ioctx->n_rdma_ius; ++i, ++riu) { - if (riu->sge) - kfree(riu->sge); - } + for (i = 0; i < ioctx->n_rdma_ius; ++i, ++riu) + kfree(riu->sge); kfree(ioctx->rdma_ius); } - if (ioctx->n_rbuf > 1 && ioctx->rbufs) + if (ioctx->n_rbuf > 1) kfree(ioctx->rbufs); if (srpt_post_recv(ch->sport->sdev, ioctx)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-06-12 11:22:23
|
Revision: 404 http://scst.svn.sourceforge.net/scst/?rev=404&view=rev Author: vlnb Date: 2008-06-12 04:22:15 -0700 (Thu, 12 Jun 2008) Log Message: ----------- Patch from Bart Van Assche <bar...@gm...>: The patch below fixes all remaining checkpatch errors: - ERROR: do not use assignment in if condition - ERROR: that open brace { should be on the previous line - ERROR: trailing whitespace - ERROR: use tabs not spaces The last three had already been fixed before, but some occurences were reintroduced in r403. It would be great if new modifications could be checked for checkpatch errors before being committed. This patch has been tested as follows: - Reread the patch below carefully. - Verified that make -s clean && make -s iscsi scst && make -s -C srpt still works and does not trigger any compiler warnings. - Verified that checkpatch does no longer report any errors. - Checked that the patch generated by generate-kernel-patch still applies cleanly to the 2.6.25.4 kernel, and that the patched kernel tree still compiles, installs and boots fine, and that the iscsi-scst, ib_srpt, scst_disk and scst_vdisk modules still load. - Tested that iSCSI login/logout still works from a remote system, and that iSCSI I/O still works. Signed-off-by: Bart Van Assche <bar...@gm...> Modified Paths: -------------- trunk/iscsi-scst/kernel/config.c trunk/iscsi-scst/kernel/event.c trunk/iscsi-scst/kernel/iscsi.c trunk/iscsi-scst/kernel/param.c trunk/iscsi-scst/kernel/session.c trunk/iscsi-scst/kernel/target.c trunk/scst/include/scst_debug.h trunk/scst/src/dev_handlers/scst_user.c trunk/scst/src/scst_proc.c trunk/scst/src/scst_targ.c Modified: trunk/iscsi-scst/kernel/config.c =================================================================== --- trunk/iscsi-scst/kernel/config.c 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/iscsi-scst/kernel/config.c 2008-06-12 11:22:15 UTC (rev 404) @@ -235,7 +235,8 @@ struct conn_info info; struct iscsi_conn *conn; - if ((err = copy_from_user(&info, (void *) ptr, sizeof(info))) < 0) + err = copy_from_user(&info, (void *) ptr, sizeof(info)); + if (err < 0) return err; session = session_lookup(target, info.sid); @@ -260,10 +261,12 @@ struct iscsi_session *session; struct conn_info info; - if ((err = copy_from_user(&info, (void *) ptr, sizeof(info))) < 0) + err = copy_from_user(&info, (void *) ptr, sizeof(info)); + if (err < 0) return err; - if (!(session = session_lookup(target, info.sid))) + session = session_lookup(target, info.sid); + if (!session) return -ENOENT; return conn_add(session, &info); @@ -276,10 +279,12 @@ struct iscsi_session *session; struct conn_info info; - if ((err = copy_from_user(&info, (void *) ptr, sizeof(info))) < 0) + err = copy_from_user(&info, (void *) ptr, sizeof(info)); + if (err < 0) return err; - if (!(session = session_lookup(target, info.sid))) + session = session_lookup(target, info.sid); + if (!session) return -ENOENT; return conn_del(session, &info); @@ -292,7 +297,8 @@ struct iscsi_session *session; struct session_info info; - if ((err = copy_from_user(&info, (void *) ptr, sizeof(info))) < 0) + err = copy_from_user(&info, (void *) ptr, sizeof(info)); + if (err < 0) return err; session = session_lookup(target, info.sid); @@ -314,7 +320,8 @@ int err; struct session_info info; - if ((err = copy_from_user(&info, (void *) ptr, sizeof(info))) < 0) + err = copy_from_user(&info, (void *) ptr, sizeof(info)); + if (err < 0) return err; info.initiator_name[ISCSI_NAME_LEN-1] = '\0'; @@ -329,7 +336,8 @@ int err; struct session_info info; - if ((err = copy_from_user(&info, (void *) ptr, sizeof(info))) < 0) + err = copy_from_user(&info, (void *) ptr, sizeof(info)); + if (err < 0) return err; return session_del(target, info.sid); @@ -341,10 +349,12 @@ int err; struct iscsi_param_info info; - if ((err = copy_from_user(&info, (void *) ptr, sizeof(info))) < 0) + err = copy_from_user(&info, (void *) ptr, sizeof(info)); + if (err < 0) goto out; - if ((err = iscsi_param_set(target, &info, set)) < 0) + err = iscsi_param_set(target, &info, set); + if (err < 0) goto out; if (!set) @@ -360,10 +370,12 @@ int err; struct target_info info; - if ((err = copy_from_user(&info, (void *) ptr, sizeof(info))) < 0) + err = copy_from_user(&info, (void *) ptr, sizeof(info)); + if (err < 0) return err; - if (!(err = target_add(&info))) + err = target_add(&info); + if (!err) err = copy_to_user((void *) ptr, &info, sizeof(info)); return err; @@ -431,10 +443,12 @@ goto out; } - if ((err = get_user(id, (u32 *) arg)) != 0) + err = get_user(id, (u32 *) arg); + if (err != 0) goto out; - if ((err = mutex_lock_interruptible(&target_mgmt_mutex)) < 0) + err = mutex_lock_interruptible(&target_mgmt_mutex); + if (err < 0) goto out; if (cmd == DEL_TARGET) { Modified: trunk/iscsi-scst/kernel/event.c =================================================================== --- trunk/iscsi-scst/kernel/event.c 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/iscsi-scst/kernel/event.c 2008-06-12 11:22:15 UTC (rev 404) @@ -56,7 +56,8 @@ rlen = NLMSG_ALIGN(nlh->nlmsg_len); if (rlen > skb->len) rlen = skb->len; - if ((err = event_recv_msg(skb, nlh))) + err = event_recv_msg(skb, nlh); + if (err) netlink_ack(skb, nlh, -err); else if (nlh->nlmsg_flags & NLM_F_ACK) netlink_ack(skb, nlh, 0); @@ -91,7 +92,8 @@ struct nlmsghdr *nlh; static u32 seq; - if (!(skb = alloc_skb(NLMSG_SPACE(len), gfp_mask))) + skb = alloc_skb(NLMSG_SPACE(len), gfp_mask); + if (!skb) return -ENOMEM; nlh = __nlmsg_put(skb, iscsid_pid, seq++, NLMSG_DONE, len - sizeof(*nlh), 0); Modified: trunk/iscsi-scst/kernel/iscsi.c =================================================================== --- trunk/iscsi-scst/kernel/iscsi.c 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/iscsi-scst/kernel/iscsi.c 2008-06-12 11:22:15 UTC (rev 404) @@ -932,7 +932,8 @@ iscsi_extracheck_is_rd_thread(conn); - if (!(size = cmnd->pdu.datasize)) + size = cmnd->pdu.datasize; + if (!size) return; if (sg == NULL) { @@ -1210,13 +1211,17 @@ spin_unlock(&conn->session->sn_lock); if (unlikely(err)) goto out; - } else if (unlikely((err = cmnd_insert_hash(cmnd)) < 0)) { - PRINT_ERROR("Can't insert in hash: ignore this request %x", - cmnd_itt(cmnd)); - goto out; + } else { + err = cmnd_insert_hash(cmnd); + if (unlikely(err < 0)) { + PRINT_ERROR("Can't insert in hash: ignore this request %x", + cmnd_itt(cmnd)); + goto out; + } } - if ((size = cmnd->pdu.datasize)) { + size = cmnd->pdu.datasize; + if (size) { size = (size + 3) & -4; conn->read_msg.msg_iov = conn->read_iov; if (cmnd->pdu.bhs.itt != cpu_to_be32(ISCSI_RESERVED_TAG)) { @@ -1615,7 +1620,8 @@ goto out; } - if ((cmnd = cmnd_find_hash_get(session, req_hdr->rtt, ISCSI_RESERVED_TAG))) { + cmnd = cmnd_find_hash_get(session, req_hdr->rtt, ISCSI_RESERVED_TAG); + if (cmnd) { struct iscsi_conn *conn = cmnd->conn; struct iscsi_scsi_cmd_hdr *hdr = cmnd_hdr(cmnd); @@ -2909,13 +2915,15 @@ "degraded mode. Refer README file for details"); #endif - if ((ctr_major = register_chrdev(0, ctr_name, &ctr_fops)) < 0) { + ctr_major = register_chrdev(0, ctr_name, &ctr_fops); + if (ctr_major < 0) { PRINT_ERROR("failed to register the control device %d", ctr_major); err = ctr_major; goto out_callb; } - if ((err = event_init()) < 0) + err = event_init(); + if (err < 0) goto out_reg; iscsi_cmnd_cache = KMEM_CACHE(iscsi_cmnd, SCST_SLAB_FLAGS); @@ -2930,7 +2938,8 @@ iscsi_template_registered = 1; - if ((err = iscsi_procfs_init()) < 0) + err = iscsi_procfs_init(); + if (err < 0) goto out_reg_tmpl; num = max(num_online_cpus(), 2); Modified: trunk/iscsi-scst/kernel/param.c =================================================================== --- trunk/iscsi-scst/kernel/param.c 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/iscsi-scst/kernel/param.c 2008-06-12 11:22:15 UTC (rev 404) @@ -213,7 +213,8 @@ sess_param_check(info); if (info->sid) { - if (!(session = session_lookup(target, info->sid))) + session = session_lookup(target, info->sid); + if (!session) goto out; if (set && !list_empty(&session->conn_list)) { err = -EBUSY; Modified: trunk/iscsi-scst/kernel/session.c =================================================================== --- trunk/iscsi-scst/kernel/session.c 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/iscsi-scst/kernel/session.c 2008-06-12 11:22:15 UTC (rev 404) @@ -35,7 +35,8 @@ struct iscsi_session *session; char *name = NULL; - if (!(session = kzalloc(sizeof(*session), GFP_KERNEL))) + session = kzalloc(sizeof(*session), GFP_KERNEL); + if (!session) return -ENOMEM; session->target = target; Modified: trunk/iscsi-scst/kernel/target.c =================================================================== --- trunk/iscsi-scst/kernel/target.c 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/iscsi-scst/kernel/target.c 2008-06-12 11:22:15 UTC (rev 404) @@ -87,7 +87,8 @@ TRACE_MGMT_DBG("Creating target tid %u, name %s", tid, name); - if (!(len = strlen(name))) { + len = strlen(name); + if (!len) { PRINT_ERROR("The length of the target name is zero %u", tid); goto out; } @@ -97,7 +98,8 @@ goto out; } - if (!(target = kzalloc(sizeof(*target), GFP_KERNEL))) { + target = kzalloc(sizeof(*target), GFP_KERNEL); + if (!target) { err = -ENOMEM; goto out_put; } @@ -161,7 +163,8 @@ tid = next_target_id; } - if (!(err = iscsi_target_create(info, tid))) + err = iscsi_target_create(info, tid); + if (!err) nr_targets++; out: return err; @@ -184,7 +187,8 @@ struct iscsi_target *target; int err; - if (!(target = target_lookup_by_id(id))) { + target = target_lookup_by_id(id); + if (!target) { err = -ENOENT; goto out; } @@ -277,7 +281,8 @@ int err; struct iscsi_target *target; - if ((err = mutex_lock_interruptible(&target_mgmt_mutex)) < 0) + err = mutex_lock_interruptible(&target_mgmt_mutex); + if (err < 0) return err; list_for_each_entry(target, &target_list, target_list_entry) { Modified: trunk/scst/include/scst_debug.h =================================================================== --- trunk/scst/include/scst_debug.h 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/scst/include/scst_debug.h 2008-06-12 11:22:15 UTC (rev 404) @@ -244,8 +244,7 @@ #define PRINT_WARNING(format, args...) \ do { \ - if (strcmp(INFO_FLAG, LOG_FLAG)) \ - { \ + if (strcmp(INFO_FLAG, LOG_FLAG)) { \ PRINT_LOG_FLAG(LOG_FLAG, "***WARNING*** " format, args); \ } \ PRINT_LOG_FLAG(INFO_FLAG, "***WARNING*** " format, args); \ Modified: trunk/scst/src/dev_handlers/scst_user.c =================================================================== --- trunk/scst/src/dev_handlers/scst_user.c 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/scst/src/dev_handlers/scst_user.c 2008-06-12 11:22:15 UTC (rev 404) @@ -111,7 +111,7 @@ struct page **data_pages; struct sgv_pool_obj *sgv; - /* + /* * Special flags, which can be accessed asynchronously (hence "long"). * Protected by cmd_lists.cmd_list_lock. */ @@ -983,15 +983,15 @@ if ((ucmd->state == UCMD_STATE_PARSING) || (ucmd->state == UCMD_STATE_BUF_ALLOCING)) { - /* - * If we don't put such commands in the queue head, then under - * high load we might delay threads, waiting for memory - * allocations, for too long and start loosing NOPs, which - * would lead to consider us by remote initiators as - * unresponsive and stuck => broken connections, etc. If none - * of our commands completed in NOP timeout to allow the head - * commands to go, then we are really overloaded and/or stuck. - */ + /* + * If we don't put such commands in the queue head, then under + * high load we might delay threads, waiting for memory + * allocations, for too long and start loosing NOPs, which + * would lead to consider us by remote initiators as + * unresponsive and stuck => broken connections, etc. If none + * of our commands completed in NOP timeout to allow the head + * commands to go, then we are really overloaded and/or stuck. + */ TRACE_DBG("Adding ucmd %p (state %d) to head of ready " "cmd list", ucmd, ucmd->state); list_add(&ucmd->ready_cmd_list_entry, Modified: trunk/scst/src/scst_proc.c =================================================================== --- trunk/scst/src/scst_proc.c 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/scst/src/scst_proc.c 2008-06-12 11:22:15 UTC (rev 404) @@ -1171,7 +1171,8 @@ goto out; } - if (!(buffer = (char *)__get_free_page(GFP_KERNEL))) { + buffer = (char *)__get_free_page(GFP_KERNEL); + if (!buffer) { res = -ENOMEM; goto out; } Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/scst/src/scst_targ.c 2008-06-12 11:22:15 UTC (rev 404) @@ -541,7 +541,7 @@ } if (unlikely(cmd->bufflen != cmd->expected_transfer_len)) { static int repd; - + if (repd < 100) { /* * Intentionally unlocked. Few messages more This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-06-12 11:39:30
|
Revision: 408 http://scst.svn.sourceforge.net/scst/?rev=408&view=rev Author: vlnb Date: 2008-06-12 04:39:28 -0700 (Thu, 12 Jun 2008) Log Message: ----------- Copyrights updated Modified Paths: -------------- trunk/Makefile trunk/iscsi-scst/include/iscsi_scst.h trunk/iscsi-scst/include/iscsi_scst_ver.h trunk/iscsi-scst/kernel/Makefile trunk/iscsi-scst/kernel/config.c trunk/iscsi-scst/kernel/conn.c trunk/iscsi-scst/kernel/digest.c trunk/iscsi-scst/kernel/digest.h trunk/iscsi-scst/kernel/event.c trunk/iscsi-scst/kernel/iscsi.c trunk/iscsi-scst/kernel/iscsi.h trunk/iscsi-scst/kernel/iscsi_dbg.h trunk/iscsi-scst/kernel/iscsi_hdr.h trunk/iscsi-scst/kernel/nthread.c trunk/iscsi-scst/kernel/param.c trunk/iscsi-scst/kernel/session.c trunk/iscsi-scst/kernel/target.c trunk/iscsi-scst/usr/Makefile trunk/iscsi-scst/usr/chap.c trunk/iscsi-scst/usr/config.h trunk/iscsi-scst/usr/conn.c trunk/iscsi-scst/usr/ctldev.c trunk/iscsi-scst/usr/event.c trunk/iscsi-scst/usr/iscsi_adm.c trunk/iscsi-scst/usr/iscsi_adm.h trunk/iscsi-scst/usr/iscsi_hdr.h trunk/iscsi-scst/usr/iscsi_scstd.c trunk/iscsi-scst/usr/iscsid.c trunk/iscsi-scst/usr/iscsid.h trunk/iscsi-scst/usr/isns.c trunk/iscsi-scst/usr/isns_proto.h trunk/iscsi-scst/usr/log.c trunk/iscsi-scst/usr/message.c trunk/iscsi-scst/usr/misc.h trunk/iscsi-scst/usr/param.c trunk/iscsi-scst/usr/param.h trunk/iscsi-scst/usr/plain.c trunk/iscsi-scst/usr/session.c trunk/iscsi-scst/usr/target.c trunk/iscsi-scst/usr/types.h trunk/mpt/mpt_scst.c trunk/qla2x00t/qla2x00-target/Makefile trunk/qla2x00t/qla2x00-target/qla2x00t.c trunk/qla2x00t/qla2x00-target/qla2x00t.h trunk/qla2x00t/qla2x_tgt.h trunk/qla2x00t/qla2x_tgt_def.h trunk/scst/Makefile trunk/scst/include/scst.h trunk/scst/include/scst_const.h trunk/scst/include/scst_debug.h trunk/scst/include/scst_user.h trunk/scst/src/Makefile trunk/scst/src/dev_handlers/Makefile trunk/scst/src/dev_handlers/scst_cdrom.c trunk/scst/src/dev_handlers/scst_changer.c trunk/scst/src/dev_handlers/scst_disk.c trunk/scst/src/dev_handlers/scst_modisk.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/dev_handlers/scst_user.c trunk/scst/src/dev_handlers/scst_vdisk.c trunk/scst/src/scst_cdbprobe.h trunk/scst/src/scst_debug.c trunk/scst/src/scst_lib.c trunk/scst/src/scst_main.c trunk/scst/src/scst_mem.c trunk/scst/src/scst_mem.h trunk/scst/src/scst_module.c trunk/scst/src/scst_priv.h trunk/scst/src/scst_proc.c trunk/scst/src/scst_targ.c trunk/usr/fileio/Makefile trunk/usr/fileio/common.c trunk/usr/fileio/common.h trunk/usr/fileio/debug.c trunk/usr/fileio/debug.h trunk/usr/fileio/fileio.c Modified: trunk/Makefile =================================================================== --- trunk/Makefile 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/Makefile 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,8 @@ # # Common makefile for SCSI target mid-level and its drivers # -# Copyright (C) 2006 Vladislav Bolkhovitin <vs...@vl...> +# Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> +# Copyright (C) 2007 - 2008 CMS Distribution Limited # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/include/iscsi_scst.h =================================================================== --- trunk/iscsi-scst/include/iscsi_scst.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/include/iscsi_scst.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,6 +1,6 @@ /* - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/include/iscsi_scst_ver.h =================================================================== --- trunk/iscsi-scst/include/iscsi_scst_ver.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/include/iscsi_scst_ver.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,6 +1,6 @@ /* - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/kernel/Makefile =================================================================== --- trunk/iscsi-scst/kernel/Makefile 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/kernel/Makefile 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,8 @@ # # Makefile for the kernel part of iSCSI-SCST. # -# Copyright (C) 2007 Vladislav Bolkhovitin -# Copyright (C) 2007 CMS Distribution Limited +# Copyright (C) 2007 - 2008 Vladislav Bolkhovitin +# Copyright (C) 2007 - 2008 CMS Distribution Limited # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/kernel/config.c =================================================================== --- trunk/iscsi-scst/kernel/config.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/kernel/config.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* * Copyright (C) 2004 - 2005 FUJITA Tomonori <to...@ac...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/kernel/conn.c =================================================================== --- trunk/iscsi-scst/kernel/conn.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/kernel/conn.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* - * Copyright (C) 2002-2003 Ardis Technolgies <ro...@ar...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2002 - 2003 Ardis Technolgies <ro...@ar...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/kernel/digest.c =================================================================== --- trunk/iscsi-scst/kernel/digest.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/kernel/digest.c 2008-06-12 11:39:28 UTC (rev 408) @@ -2,8 +2,8 @@ * iSCSI digest handling. * * Copyright (C) 2004 - 2006 Xiranet Communications GmbH <arn...@xi...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/kernel/digest.h =================================================================== --- trunk/iscsi-scst/kernel/digest.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/kernel/digest.h 2008-06-12 11:39:28 UTC (rev 408) @@ -2,8 +2,8 @@ * iSCSI digest handling. * * Copyright (C) 2004 Xiranet Communications GmbH <arn...@xi...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/kernel/event.c =================================================================== --- trunk/iscsi-scst/kernel/event.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/kernel/event.c 2008-06-12 11:39:28 UTC (rev 408) @@ -2,8 +2,8 @@ * Event notification code. * * Copyright (C) 2005 FUJITA Tomonori <to...@ac...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/kernel/iscsi.c =================================================================== --- trunk/iscsi-scst/kernel/iscsi.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/kernel/iscsi.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* - * Copyright (C) 2002-2003 Ardis Technolgies <ro...@ar...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2002 - 2003 Ardis Technolgies <ro...@ar...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/kernel/iscsi.h =================================================================== --- trunk/iscsi-scst/kernel/iscsi.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/kernel/iscsi.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* - * Copyright (C) 2002-2003 Ardis Technolgies <ro...@ar...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2002 - 2003 Ardis Technolgies <ro...@ar...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/kernel/iscsi_dbg.h =================================================================== --- trunk/iscsi-scst/kernel/iscsi_dbg.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/kernel/iscsi_dbg.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,6 +1,6 @@ /* - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/kernel/iscsi_hdr.h =================================================================== --- trunk/iscsi-scst/kernel/iscsi_hdr.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/kernel/iscsi_hdr.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* - * Copyright (C) 2002-2003 Ardis Technolgies <ro...@ar...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2002 - 2003 Ardis Technolgies <ro...@ar...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/kernel/nthread.c =================================================================== --- trunk/iscsi-scst/kernel/nthread.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/kernel/nthread.c 2008-06-12 11:39:28 UTC (rev 408) @@ -2,8 +2,8 @@ * Network threads. * * Copyright (C) 2004 - 2005 FUJITA Tomonori <to...@ac...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/kernel/param.c =================================================================== --- trunk/iscsi-scst/kernel/param.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/kernel/param.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* * Copyright (C) 2005 FUJITA Tomonori <to...@ac...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/kernel/session.c =================================================================== --- trunk/iscsi-scst/kernel/session.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/kernel/session.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* - * Copyright (C) 2002-2003 Ardis Technolgies <ro...@ar...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2002 - 2003 Ardis Technolgies <ro...@ar...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/kernel/target.c =================================================================== --- trunk/iscsi-scst/kernel/target.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/kernel/target.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* - * Copyright (C) 2002-2003 Ardis Technolgies <ro...@ar...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2002 - 2003 Ardis Technolgies <ro...@ar...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/Makefile =================================================================== --- trunk/iscsi-scst/usr/Makefile 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/Makefile 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,8 @@ # # Makefile for the user space part of iSCSI-SCST. # -# Copyright (C) 2007 Vladislav Bolkhovitin -# Copyright (C) 2007 CMS Distribution Limited +# Copyright (C) 2007 - 2008 Vladislav Bolkhovitin +# Copyright (C) 2007 - 2008 CMS Distribution Limited # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/chap.c =================================================================== --- trunk/iscsi-scst/usr/chap.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/chap.c 2008-06-12 11:39:28 UTC (rev 408) @@ -2,9 +2,9 @@ * chap.c - support for (mutual) CHAP authentication. * * Copyright (C) 2004 Xiranet Communications GmbH <arn...@xi...> - * Copyright (C) 2002-2003 Ardis Technolgies <ro...@ar...>, - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2002 - 2003 Ardis Technolgies <ro...@ar...>, + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * and code taken from UNH iSCSI software: * Copyright (C) 2001-2003 InterOperability Lab (IOL) Modified: trunk/iscsi-scst/usr/config.h =================================================================== --- trunk/iscsi-scst/usr/config.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/config.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,6 +1,6 @@ /* - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/conn.c =================================================================== --- trunk/iscsi-scst/usr/conn.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/conn.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* - * Copyright (C) 2002-2003 Ardis Technolgies <ro...@ar...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2002 - 2003 Ardis Technolgies <ro...@ar...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/ctldev.c =================================================================== --- trunk/iscsi-scst/usr/ctldev.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/ctldev.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* * Copyright (C) 2004 - 2005 FUJITA Tomonori <to...@ac...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/event.c =================================================================== --- trunk/iscsi-scst/usr/event.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/event.c 2008-06-12 11:39:28 UTC (rev 408) @@ -2,8 +2,8 @@ * Event notification code. * * Copyright (C) 2005 FUJITA Tomonori <to...@ac...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/iscsi_adm.c =================================================================== --- trunk/iscsi-scst/usr/iscsi_adm.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/iscsi_adm.c 2008-06-12 11:39:28 UTC (rev 408) @@ -2,8 +2,8 @@ * iscsi_adm - manage iSCSI-SCST Target software. * * Copyright (C) 2004 - 2005 FUJITA Tomonori <to...@ac...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/iscsi_adm.h =================================================================== --- trunk/iscsi-scst/usr/iscsi_adm.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/iscsi_adm.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,6 +1,6 @@ /* - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/iscsi_hdr.h =================================================================== --- trunk/iscsi-scst/usr/iscsi_hdr.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/iscsi_hdr.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* - * Copyright (C) 2002-2003 Ardis Technolgies <ro...@ar...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2002 - 2003 Ardis Technolgies <ro...@ar...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/iscsi_scstd.c =================================================================== --- trunk/iscsi-scst/usr/iscsi_scstd.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/iscsi_scstd.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* - * Copyright (C) 2002-2003 Ardis Technolgies <ro...@ar...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2002 - 2003 Ardis Technolgies <ro...@ar...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/iscsid.c =================================================================== --- trunk/iscsi-scst/usr/iscsid.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/iscsid.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* - * Copyright (C) 2002-2003 Ardis Technolgies <ro...@ar...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2002 - 2003 Ardis Technolgies <ro...@ar...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/iscsid.h =================================================================== --- trunk/iscsi-scst/usr/iscsid.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/iscsid.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* - * Copyright (C) 2002-2003 Ardis Technolgies <ro...@ar...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2002 - 2003 Ardis Technolgies <ro...@ar...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/isns.c =================================================================== --- trunk/iscsi-scst/usr/isns.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/isns.c 2008-06-12 11:39:28 UTC (rev 408) @@ -2,8 +2,8 @@ * iSNS functions * * Copyright (C) 2006 FUJITA Tomonori <to...@ac...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as Modified: trunk/iscsi-scst/usr/isns_proto.h =================================================================== --- trunk/iscsi-scst/usr/isns_proto.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/isns_proto.h 2008-06-12 11:39:28 UTC (rev 408) @@ -2,8 +2,8 @@ * iSNS protocol data types * * Copyright (C) 2006 FUJITA Tomonori <to...@ac...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as Modified: trunk/iscsi-scst/usr/log.c =================================================================== --- trunk/iscsi-scst/usr/log.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/log.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* - * Copyright (C) 2002-2003 Ardis Technolgies <ro...@ar...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2002 - 2003 Ardis Technolgies <ro...@ar...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/message.c =================================================================== --- trunk/iscsi-scst/usr/message.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/message.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* * Copyright (C) 2004 - 2005 FUJITA Tomonori <to...@ac...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/misc.h =================================================================== --- trunk/iscsi-scst/usr/misc.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/misc.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,6 +1,6 @@ /* - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/param.c =================================================================== --- trunk/iscsi-scst/usr/param.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/param.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* * Copyright (C) 2005 FUJITA Tomonori <to...@ac...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/param.h =================================================================== --- trunk/iscsi-scst/usr/param.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/param.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* * Copyright (C) 2005 FUJITA Tomonori <to...@ac...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/plain.c =================================================================== --- trunk/iscsi-scst/usr/plain.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/plain.c 2008-06-12 11:39:28 UTC (rev 408) @@ -2,8 +2,8 @@ * Plain file-based configuration file code. * * Copyright (C) 2005 FUJITA Tomonori <to...@ac...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/session.c =================================================================== --- trunk/iscsi-scst/usr/session.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/session.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* - * Copyright (C) 2002-2003 Ardis Technolgies <ro...@ar...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2002 - 2003 Ardis Technolgies <ro...@ar...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/target.c =================================================================== --- trunk/iscsi-scst/usr/target.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/target.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* - * Copyright (C) 2002-2003 Ardis Technolgies <ro...@ar...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2002 - 2003 Ardis Technolgies <ro...@ar...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/iscsi-scst/usr/types.h =================================================================== --- trunk/iscsi-scst/usr/types.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/iscsi-scst/usr/types.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,7 @@ /* -* Copyright (C) 2002-2003 Ardis Technolgies <ro...@ar...> - * Copyright (C) 2007 Vladislav Bolkhovitin - * Copyright (C) 2007 CMS Distribution Limited +* Copyright (C) 2002 - 2003 Ardis Technolgies <ro...@ar...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/mpt/mpt_scst.c =================================================================== --- trunk/mpt/mpt_scst.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/mpt/mpt_scst.c 2008-06-12 11:39:28 UTC (rev 408) @@ -4,7 +4,7 @@ * Copyright (C) 2005 Beijing Soul Technology Co., Ltd. * Copyright (C) 2002, 2003, 2004 LSI Logic Corporation * Copyright (C) 2004 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 Leonid Stoljar * * MPT SCSI target mode driver for SCST. * Modified: trunk/qla2x00t/qla2x00-target/Makefile =================================================================== --- trunk/qla2x00t/qla2x00-target/Makefile 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/qla2x00t/qla2x00-target/Makefile 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,8 @@ # # Qlogic 2x00 SCSI target driver makefile # -# Copyright (C) 2004 Vladislav Bolkhovitin <vs...@vl...> -# and Leonid Stoljar +# Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> +# Copyright (C) 2004 - 2005 Leonid Stoljar # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c =================================================================== --- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,9 +1,9 @@ /* * qla2x00t.c * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * Leonid Stoljar - * Nathaniel Clark <na...@mi...> + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2006 Nathaniel Clark <na...@mi...> * * Qlogic 2x00 SCSI target driver. * Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.h =================================================================== --- trunk/qla2x00t/qla2x00-target/qla2x00t.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/qla2x00t/qla2x00-target/qla2x00t.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,12 +1,10 @@ /* * qla2x00t.h * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * Leonid Stoljar - * Nathaniel Clark <na...@mi...> + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2006 Nathaniel Clark <na...@mi...> * - * Significant modification 2006 by Nathaniel Clark <na...@mi...> - * * Qlogic 2x00 SCSI target driver. * * This program is free software; you can redistribute it and/or Modified: trunk/qla2x00t/qla2x_tgt.h =================================================================== --- trunk/qla2x00t/qla2x_tgt.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/qla2x00t/qla2x_tgt.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,8 @@ /* * qla2x_tgt.h * - * Copyright (C) 2004-2005 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar * * Additional file for the target driver support. * Modified: trunk/qla2x00t/qla2x_tgt_def.h =================================================================== --- trunk/qla2x00t/qla2x_tgt_def.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/qla2x00t/qla2x_tgt_def.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,8 @@ /* * qla2x_tgt_def.h * - * Copyright (C) 2004-2005 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar * * Additional file for the target driver support. Intended to define * for 2200 and 2300 thier own exported symbols with unique names. Modified: trunk/scst/Makefile =================================================================== --- trunk/scst/Makefile 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/Makefile 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ # # Common makefile for SCSI target mid-level and its drivers # -# Copyright (C) 2004 Vladislav Bolkhovitin <vs...@vl...> -# and Leonid Stoljar +# Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> +# Copyright (C) 2004 - 2005 Leonid Stoljar +# Copyright (C) 2007 - 2008 CMS Distribution Limited # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License Modified: trunk/scst/include/scst.h =================================================================== --- trunk/scst/include/scst.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/include/scst.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * include/scst.h * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * Main SCSI target mid-level include file. * Modified: trunk/scst/include/scst_const.h =================================================================== --- trunk/scst/include/scst_const.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/include/scst_const.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,8 @@ /* * include/scst_const.h * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * Contains common SCST constants. * Modified: trunk/scst/include/scst_debug.h =================================================================== --- trunk/scst/include/scst_debug.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/include/scst_debug.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * include/scst_debug.h * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * Contains macroses for execution tracing and error reporting * Modified: trunk/scst/include/scst_user.h =================================================================== --- trunk/scst/include/scst_user.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/include/scst_user.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,8 @@ /* * include/scst_user.h * - * Copyright (C) 2007 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * Contains constants and data structures for scst_user module. * See http://scst.sourceforge.net/doc/scst_user_spec.txt or Modified: trunk/scst/src/Makefile =================================================================== --- trunk/scst/src/Makefile 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/Makefile 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ # # SCSI target mid-level makefile # -# Copyright (C) 2004 Vladislav Bolkhovitin <vs...@vl...> -# and Leonid Stoljar +# Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> +# Copyright (C) 2004 - 2005 Leonid Stoljar +# Copyright (C) 2007 - 2008 CMS Distribution Limited # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License Modified: trunk/scst/src/dev_handlers/Makefile =================================================================== --- trunk/scst/src/dev_handlers/Makefile 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/dev_handlers/Makefile 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ # # SCSI target mid-level dev handler's makefile # -# Copyright (C) 2004 Vladislav Bolkhovitin <vs...@vl...> -# and Leonid Stoljar +# Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> +# Copyright (C) 2004 - 2005 Leonid Stoljar +# Copyright (C) 2007 - 2008 CMS Distribution Limited # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License Modified: trunk/scst/src/dev_handlers/scst_cdrom.c =================================================================== --- trunk/scst/src/dev_handlers/scst_cdrom.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/dev_handlers/scst_cdrom.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * scst_cdrom.c * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * SCSI CDROM (type 5) dev handler * Modified: trunk/scst/src/dev_handlers/scst_changer.c =================================================================== --- trunk/scst/src/dev_handlers/scst_changer.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/dev_handlers/scst_changer.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * scst_changer.c * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * SCSI medium changer (type 8) dev handler * Modified: trunk/scst/src/dev_handlers/scst_disk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_disk.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/dev_handlers/scst_disk.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * scst_disk.c * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * SCSI disk (type 0) dev handler * & Modified: trunk/scst/src/dev_handlers/scst_modisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_modisk.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/dev_handlers/scst_modisk.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * scst_modisk.c * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * SCSI MO disk (type 7) dev handler * & Modified: trunk/scst/src/dev_handlers/scst_processor.c =================================================================== --- trunk/scst/src/dev_handlers/scst_processor.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/dev_handlers/scst_processor.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * scst_processor.c * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * SCSI medium processor (type 3) dev handler * Modified: trunk/scst/src/dev_handlers/scst_raid.c =================================================================== --- trunk/scst/src/dev_handlers/scst_raid.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/dev_handlers/scst_raid.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * scst_raid.c * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * SCSI raid(controller) (type 0xC) dev handler * Modified: trunk/scst/src/dev_handlers/scst_tape.c =================================================================== --- trunk/scst/src/dev_handlers/scst_tape.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/dev_handlers/scst_tape.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * scst_tape.c * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * SCSI tape (type 1) dev handler * & Modified: trunk/scst/src/dev_handlers/scst_user.c =================================================================== --- trunk/scst/src/dev_handlers/scst_user.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/dev_handlers/scst_user.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,8 @@ /* * scst_user.c * - * Copyright (C) 2007 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * SCSI virtual user space device handler * Modified: trunk/scst/src/dev_handlers/scst_vdisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_vdisk.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/dev_handlers/scst_vdisk.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,10 +1,11 @@ /* * scst_vdisk.c * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar - * (C) 2007 Ming Zhang <blackmagic02881 at gmail dot com> - * (C) 2007 Ross Walker <rswwalker at hotmail dot com> + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 Ming Zhang <blackmagic02881 at gmail dot com> + * Copyright (C) 2007 Ross Walker <rswwalker at hotmail dot com> + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * SCSI disk (type 0) and CDROM (type 5) dev handler using files * on file systems or block devices (VDISK) Modified: trunk/scst/src/scst_cdbprobe.h =================================================================== --- trunk/scst/src/scst_cdbprobe.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/scst_cdbprobe.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * scst_cdbprobe.h * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/scst/src/scst_debug.c =================================================================== --- trunk/scst/src/scst_debug.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/scst_debug.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * scst_debug.c * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * Contains helper functions for execution tracing and error reporting. * Intended to be included in main .c file. Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/scst_lib.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * scst_lib.c * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/scst/src/scst_main.c =================================================================== --- trunk/scst/src/scst_main.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/scst_main.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * scst_main.c * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/scst/src/scst_mem.c =================================================================== --- trunk/scst/src/scst_mem.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/scst_mem.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,9 +1,9 @@ /* * scst_mem.c * - * Copyright (C) 2006-2007 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2006 - 2008 Vladislav Bolkhovitin <vs...@vl...> * Copyright (C) 2007 Krzysztof Blaszkowski <kb...@sy...> - * Copyright (C) 2007 CMS Distribution Limited + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/scst/src/scst_mem.h =================================================================== --- trunk/scst/src/scst_mem.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/scst_mem.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,9 @@ /* * scst_mem.h * - * Copyright (C) 2006-2007 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2006 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2007 Krzysztof Blaszkowski <kb...@sy...> + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/scst/src/scst_module.c =================================================================== --- trunk/scst/src/scst_module.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/scst_module.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * scst_module.c * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * Support for loading target modules. The usage is similar to scsi_module.c * Modified: trunk/scst/src/scst_priv.h =================================================================== --- trunk/scst/src/scst_priv.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/scst_priv.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * scst_priv.h * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/scst/src/scst_proc.c =================================================================== --- trunk/scst/src/scst_proc.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/scst_proc.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * scst_proc.c * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/scst/src/scst_targ.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * scst_targ.c * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/usr/fileio/Makefile =================================================================== --- trunk/usr/fileio/Makefile 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/usr/fileio/Makefile 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,8 @@ # # SCSI target mid-level makefile # -# Copyright (C) 2007 Vladislav Bolkhovitin <vs...@vl...> +# Copyright (C) 2007 - 2008 Vladislav Bolkhovitin <vs...@vl...> +# Copyright (C) 2007 - 2008 CMS Distribution Limited # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License Modified: trunk/usr/fileio/common.c =================================================================== --- trunk/usr/fileio/common.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/usr/fileio/common.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,8 @@ /* * common.c * - * Copyright (C) 2007 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/usr/fileio/common.h =================================================================== --- trunk/usr/fileio/common.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/usr/fileio/common.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,8 @@ /* * common.h * - * Copyright (C) 2007 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/usr/fileio/debug.c =================================================================== --- trunk/usr/fileio/debug.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/usr/fileio/debug.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * debug.c * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * Contains helper functions for execution tracing and error reporting. * Intended to be included in main .c file. Modified: trunk/usr/fileio/debug.h =================================================================== --- trunk/usr/fileio/debug.h 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/usr/fileio/debug.h 2008-06-12 11:39:28 UTC (rev 408) @@ -1,8 +1,9 @@ /* * debug.h * - * Copyright (C) 2004-2007 Vladislav Bolkhovitin <vs...@vl...> - * and Leonid Stoljar + * Copyright (C) 2004 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2004 - 2005 Leonid Stoljar + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * Contains macroses for execution tracing and error reporting * Modified: trunk/usr/fileio/fileio.c =================================================================== --- trunk/usr/fileio/fileio.c 2008-06-12 11:35:40 UTC (rev 407) +++ trunk/usr/fileio/fileio.c 2008-06-12 11:39:28 UTC (rev 408) @@ -1,7 +1,8 @@ /* * fileio.c * - * Copyright (C) 2007 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2007 - 2008 Vladislav Bolkhovitin <vs...@vl...> + * Copyright (C) 2007 - 2008 CMS Distribution Limited * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-06-12 18:55:15
|
Revision: 411 http://scst.svn.sourceforge.net/scst/?rev=411&view=rev Author: vlnb Date: 2008-06-12 11:55:13 -0700 (Thu, 12 Jun 2008) Log Message: ----------- - ISCSI sending response timeout increased to 30 seconds - Fixed 2 problems in scst_user on release() cleanup - Added per-device memory limit and new scst.ko module parameter scst_max_dev_cmd_mem - Cleanups, including important ones - Version changed to 1.0.0-rc1 Modified Paths: -------------- trunk/doc/scst_user_spec.txt trunk/iscsi-scst/README trunk/iscsi-scst/include/iscsi_scst_ver.h trunk/iscsi-scst/kernel/iscsi.c trunk/iscsi-scst/kernel/iscsi.h trunk/qla2x00t/qla2x00-target/README trunk/qla2x00t/qla2x00-target/qla2x00t.h trunk/scst/README trunk/scst/include/scst.h trunk/scst/include/scst_user.h trunk/scst/src/dev_handlers/scst_user.c trunk/scst/src/scst_lib.c trunk/scst/src/scst_main.c trunk/scst/src/scst_mem.c trunk/scst/src/scst_mem.h trunk/scst/src/scst_priv.h trunk/scst/src/scst_targ.c trunk/usr/fileio/README trunk/usr/fileio/fileio.c Modified: trunk/doc/scst_user_spec.txt =================================================================== --- trunk/doc/scst_user_spec.txt 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/doc/scst_user_spec.txt 2008-06-12 18:55:13 UTC (rev 411) @@ -2,7 +2,7 @@ USER SPACE INTERFACE DESCRIPTION. - Version 0.9.6/4 + Version 1.0.0 I. Description. Modified: trunk/iscsi-scst/README =================================================================== --- trunk/iscsi-scst/README 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/iscsi-scst/README 2008-06-12 18:55:13 UTC (rev 411) @@ -1,8 +1,8 @@ iSCSI SCST target driver ======================== -Version 0.9.6/XXXX, XX XXX 200X -------------------------------- +Version 1.0.0/0.4.16r151, XX June 2008 +-------------------------------------- This driver is a forked with all respects version of iSCSI Enterprise Target (IET) (http://iscsitarget.sourceforge.net/) with updates to work @@ -21,7 +21,7 @@ * iscsi-target -> iscsi-scst * iscsi-target.ko -> iscsi-scst.ko -This version is compatible with SCST version 0.9.6 and higher. +This version is compatible with SCST version 1.0.0 and higher. Tested on 2.6.21.1 kernel, but it should also work on other versions, starting from 2.6.16.x. Modified: trunk/iscsi-scst/include/iscsi_scst_ver.h =================================================================== --- trunk/iscsi-scst/include/iscsi_scst_ver.h 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/iscsi-scst/include/iscsi_scst_ver.h 2008-06-12 18:55:13 UTC (rev 411) @@ -13,4 +13,4 @@ * GNU General Public License for more details. */ -#define ISCSI_VERSION_STRING "0.9.6/0.4.16r151" +#define ISCSI_VERSION_STRING "1.0.0/0.4.16r151" Modified: trunk/iscsi-scst/kernel/iscsi.c =================================================================== --- trunk/iscsi-scst/kernel/iscsi.c 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/iscsi-scst/kernel/iscsi.c 2008-06-12 18:55:13 UTC (rev 411) @@ -1569,7 +1569,7 @@ * it. But, since this function can be called from any thread, not only * from the read one, we at the moment can't do that, because of * absence of appropriate locking protection. But this isn't a stuff - * for 0.9.6. So, currently a misbehaving initiator, not sending + * for 1.0.0. So, currently a misbehaving initiator, not sending * data in R2T state for a sharing between targets device, for which * for some reason an aborting TM command, e.g. TARGET RESET, from * another initiator is issued, can block response for this TM command Modified: trunk/iscsi-scst/kernel/iscsi.h =================================================================== --- trunk/iscsi-scst/kernel/iscsi.h 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/iscsi-scst/kernel/iscsi.h 2008-06-12 18:55:13 UTC (rev 411) @@ -324,7 +324,7 @@ /* Flags for req_cmnd_release_force() */ #define ISCSI_FORCE_RELEASE_WRITE 1 -#define ISCSI_RSP_TIMEOUT (7*HZ) +#define ISCSI_RSP_TIMEOUT (30 * HZ) extern struct mutex target_mgmt_mutex; Modified: trunk/qla2x00t/qla2x00-target/README =================================================================== --- trunk/qla2x00t/qla2x00-target/README 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/qla2x00t/qla2x00-target/README 2008-06-12 18:55:13 UTC (rev 411) @@ -1,8 +1,8 @@ Target driver for Qlogic 2200/2300 Fibre Channel cards ====================================================== -Version 0.9.6, XX XXX 200X --------------------------- +Version 1.0.0, XX June 2008 +--------------------------- This driver has all required features and looks to be quite stable (for beta) and useful. It consists from two parts: the target mode driver @@ -13,7 +13,7 @@ only. Mode, when a host acts as the initiator and the target simultaneously, is supported as well. -This version is compatible with SCST version 0.9.5 and higher. +This version is compatible with SCST version 1.0.0 and higher. The original initiator driver was taken from the kernel 2.6.17.8. Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.h =================================================================== --- trunk/qla2x00t/qla2x00-target/qla2x00t.h 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/qla2x00t/qla2x00-target/qla2x00t.h 2008-06-12 18:55:13 UTC (rev 411) @@ -38,7 +38,7 @@ /* Version numbers, the same as for the kernel */ #define Q2T_VERSION(a,b,c,d) (((a) << 030) + ((b) << 020) + (c) << 010 + (d)) #define Q2T_VERSION_CODE Q2T_VERSION(0,9,6,0) -#define Q2T_VERSION_STRING "0.9.6-pre1" +#define Q2T_VERSION_STRING "1.0.0-rc1" #define Q2T_MAX_CDB_LEN 16 #define Q2T_TIMEOUT 10 /* in seconds */ Modified: trunk/scst/README =================================================================== --- trunk/scst/README 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/scst/README 2008-06-12 18:55:13 UTC (rev 411) @@ -1,8 +1,8 @@ Generic SCSI target mid-level for Linux (SCST) ============================================== -Version 0.9.6, XX XXX 200X --------------------------- +Version 1.0.0, XX June 2008 +--------------------------- SCST is designed to provide unified, consistent interface between SCSI target drivers and Linux kernel and simplify target drivers development Modified: trunk/scst/include/scst.h =================================================================== --- trunk/scst/include/scst.h 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/scst/include/scst.h 2008-06-12 18:55:13 UTC (rev 411) @@ -50,7 +50,7 @@ /* Version numbers, the same as for the kernel */ #define SCST_VERSION_CODE 0x00090601 #define SCST_VERSION(a, b, c, d) (((a) << 24) + ((b) << 16) + ((c) << 8) + d) -#define SCST_VERSION_STRING "0.9.6-rc1" +#define SCST_VERSION_STRING "1.0.0-rc1" #define SCST_INTERFACE_VERSION SCST_VERSION_STRING "$Revision$" SCST_CONST_VERSION /************************************************************* @@ -98,7 +98,6 @@ #define SCST_CMD_STATE_LAST_ACTIVE (SCST_CMD_STATE_FINISHED+100) - /* A cmd is created, but scst_cmd_init_done() not called */ #define SCST_CMD_STATE_INIT_WAIT (SCST_CMD_STATE_LAST_ACTIVE+1) @@ -1302,6 +1301,17 @@ void *tgt_priv; }; +struct scst_mem_lim { + /* How much memory allocated under this object */ + atomic_t alloced_pages; + + /* + * How much memory allowed to allocated under this object. Put here + * mostly to save a possible cache miss accessing scst_max_dev_cmd_mem. + */ + unsigned int max_allowed_pages; +}; + struct scst_device { struct scst_dev_type *handler; /* corresponding dev handler */ @@ -1317,6 +1327,8 @@ /* How many write cmds alive on this dev. Temporary, ToDo */ atomic_t write_cmd_count; + struct scst_mem_lim dev_mem_lim; + unsigned short type; /* SCSI type of the device */ /************************************************************* @@ -2481,6 +2493,18 @@ int scst_check_local_events(struct scst_cmd *cmd); /* + * Returns the next state of the SCSI target state machine in case if command's + * completed abnormally. + */ +int scst_get_cmd_abnormal_done_state(const struct scst_cmd *cmd); + +/* + * Sets state of the SCSI target state machine in case if command's completed + * abnormally. + */ +void scst_set_cmd_abnormal_done_state(struct scst_cmd *cmd); + +/* * Returns target driver's root entry in SCST's /proc hierarchy. * The driver can create own files/directoryes here, which should * be deleted in the driver's release(). @@ -2566,8 +2590,8 @@ unsigned int len); /* - * Returnes a pseudo-random number for debugging purposes. Available only with - * DEBUG on + * Returnes a pseudo-random number for debugging purposes. Available only in + * the DEBUG build. */ unsigned long scst_random(void); @@ -2579,16 +2603,6 @@ void scst_set_resp_data_len(struct scst_cmd *cmd, int resp_data_len); /* - * Checks if total memory allocated by commands is less, than defined - * limit (scst_cur_max_cmd_mem) and returns 0, if it is so. Otherwise, - * returnes 1 and sets on cmd QUEUE FULL or BUSY status as well as - * SCST_CMD_STATE_PRE_XMIT_RESP state. Target drivers and dev handlers are - * required to call this function if they allocate data buffers on their - * own. - */ -int scst_check_mem(struct scst_cmd *cmd); - -/* * Get/put global ref counter that prevents from entering into suspended * activities stage, so protects from any global management operations. */ @@ -2661,12 +2675,14 @@ void (*free_pages_fn)(struct scatterlist *, int, void *)); struct scatterlist *sgv_pool_alloc(struct sgv_pool *pool, unsigned int size, - unsigned long gfp_mask, int atomic, int *count, - struct sgv_pool_obj **sgv, void *priv); -void sgv_pool_free(struct sgv_pool_obj *sgv); + unsigned long gfp_mask, int flags, int *count, + struct sgv_pool_obj **sgv, struct scst_mem_lim *mem_lim, void *priv); +void sgv_pool_free(struct sgv_pool_obj *sgv, struct scst_mem_lim *mem_lim); void *sgv_get_priv(struct sgv_pool_obj *sgv); +void scst_init_mem_lim(struct scst_mem_lim *mem_lim); + /** ** Generic parse() support routines. ** Done via pointer on functions to avoid unneeded dereferences on Modified: trunk/scst/include/scst_user.h =================================================================== --- trunk/scst/include/scst_user.h 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/scst/include/scst_user.h 2008-06-12 18:55:13 UTC (rev 411) @@ -26,7 +26,7 @@ #define DEV_USER_NAME "scst_user" #define DEV_USER_PATH "/dev/" -#define DEV_USER_VERSION_NAME "0.9.6" +#define DEV_USER_VERSION_NAME "1.0.0-rc1" #define DEV_USER_VERSION DEV_USER_VERSION_NAME "$Revision$" SCST_CONST_VERSION /* Modified: trunk/scst/src/dev_handlers/scst_user.c =================================================================== --- trunk/scst/src/dev_handlers/scst_user.c 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/scst/src/dev_handlers/scst_user.c 2008-06-12 18:55:13 UTC (rev 411) @@ -51,7 +51,6 @@ /* Protected by dev_rwsem or don't need any protection */ unsigned int blocking:1; unsigned int cleanup_done:1; - unsigned int cleaning:1; unsigned int tst:3; unsigned int queue_alg:4; unsigned int tas:1; @@ -64,6 +63,7 @@ int block; int def_block; + struct scst_mem_lim udev_mem_lim; struct sgv_pool *pool; uint8_t parse_type; @@ -84,8 +84,6 @@ struct list_head dev_list_entry; char name[SCST_MAX_NAME]; - /* Protected by cleanup_lock */ - unsigned char in_cleanup_list:1; struct list_head cleanup_list_entry; /* ToDo: make it on-stack */ struct completion cleanup_cmpl; @@ -160,7 +158,6 @@ static void dev_user_unjam_cmd(struct scst_user_cmd *ucmd, int busy, unsigned long *flags); -static void dev_user_unjam_dev(struct scst_user_dev *dev); static int dev_user_process_reply_on_free(struct scst_user_cmd *ucmd); static int dev_user_process_reply_tm_exec(struct scst_user_cmd *ucmd, @@ -245,6 +242,7 @@ __ucmd_get(ucmd, false); } +/* Must not be called under cmd_list_lock!! */ static inline void ucmd_put(struct scst_user_cmd *ucmd) { TRACE_DBG("ucmd %p, ucmd_ref %d", ucmd, atomic_read(&ucmd->ucmd_ref)); @@ -517,7 +515,7 @@ ucmd->buff_cached = cached_buff; cmd->sg = sgv_pool_alloc(dev->pool, bufflen, gfp_mask, flags, - &cmd->sg_cnt, &ucmd->sgv, ucmd); + &cmd->sg_cnt, &ucmd->sgv, &dev->udev_mem_lim, ucmd); if (cmd->sg != NULL) { struct scst_user_cmd *buf_ucmd = (struct scst_user_cmd *)sgv_get_priv(ucmd->sgv); @@ -592,7 +590,7 @@ PRINT_ERROR("Target driver %s requested own memory " "allocation", ucmd->cmd->tgtt->name); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); - res = SCST_CMD_STATE_PRE_XMIT_RESP; + res = scst_get_cmd_abnormal_done_state(cmd); goto out; } @@ -604,7 +602,7 @@ goto out; else if (rc < 0) { scst_set_busy(cmd); - res = SCST_CMD_STATE_PRE_XMIT_RESP; + res = scst_get_cmd_abnormal_done_state(cmd); goto out; } @@ -776,7 +774,7 @@ scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode)); out_error: - res = SCST_CMD_STATE_PRE_XMIT_RESP; + res = scst_get_cmd_abnormal_done_state(cmd); goto out; } @@ -865,7 +863,7 @@ static void dev_user_free_sgv(struct scst_user_cmd *ucmd) { if (ucmd->sgv != NULL) { - sgv_pool_free(ucmd->sgv); + sgv_pool_free(ucmd->sgv, &ucmd->dev->udev_mem_lim); ucmd->sgv = NULL; } else if (ucmd->data_pages != NULL) { /* We mapped pages, but for some reason didn't allocate them */ @@ -1022,19 +1020,6 @@ spin_unlock_irqrestore(&dev->cmd_lists.cmd_list_lock, flags); - smp_mb(); - if (unlikely(dev->cleaning)) { - spin_lock_irqsave(&cleanup_lock, flags); - if (!dev->in_cleanup_list) { - TRACE_DBG("Adding dev %p to the cleanup list (ucmd %p)", - dev, ucmd); - list_add_tail(&dev->cleanup_list_entry, &cleanup_list); - dev->in_cleanup_list = 1; - wake_up(&cleanup_list_waitQ); - } - spin_unlock_irqrestore(&cleanup_lock, flags); - } - TRACE_EXIT(); return; } @@ -1090,7 +1075,7 @@ /* go through */ out_err: - ucmd->cmd->state = SCST_CMD_STATE_PRE_XMIT_RESP; + scst_set_cmd_abnormal_done_state(ucmd->cmd); goto out; out_unmap: @@ -1131,7 +1116,7 @@ res = dev_user_map_buf(ucmd, reply->alloc_reply.pbuf, pages); } else { scst_set_busy(ucmd->cmd); - ucmd->cmd->state = SCST_CMD_STATE_PRE_XMIT_RESP; + scst_set_cmd_abnormal_done_state(ucmd->cmd); } out_process: @@ -1142,7 +1127,7 @@ out_hwerr: scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); - ucmd->cmd->state = SCST_CMD_STATE_PRE_XMIT_RESP; + scst_set_cmd_abnormal_done_state(ucmd->cmd); res = -EINVAL; goto out_process; } @@ -1193,7 +1178,7 @@ (long long unsigned int)cmd->lun, cmd->cdb[0], cmd); PRINT_BUFFER("Invalid parse_reply", reply, sizeof(*reply)); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); - cmd->state = SCST_CMD_STATE_PRE_XMIT_RESP; + scst_set_cmd_abnormal_done_state(cmd); res = -EINVAL; goto out_process; } @@ -1857,9 +1842,8 @@ scst_set_cmd_error(ucmd->cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); } + scst_set_cmd_abnormal_done_state(ucmd->cmd); - ucmd->cmd->state = SCST_CMD_STATE_PRE_XMIT_RESP; - TRACE_MGMT_DBG("Adding ucmd %p to active list", ucmd); list_add(&ucmd->cmd->cmd_list_entry, &ucmd->cmd->cmd_lists->active_cmd_list); @@ -1944,43 +1928,42 @@ static void dev_user_unjam_dev(struct scst_user_dev *dev) { int i; - unsigned long flags; struct scst_user_cmd *ucmd; TRACE_ENTRY(); TRACE_MGMT_DBG("Unjamming dev %p", dev); - spin_lock_irqsave(&dev->cmd_lists.cmd_list_lock, flags); + spin_lock_irq(&dev->cmd_lists.cmd_list_lock); repeat: for (i = 0; i < (int)ARRAY_SIZE(dev->ucmd_hash); i++) { struct list_head *head = &dev->ucmd_hash[i]; - bool repeat = false; list_for_each_entry(ucmd, head, hash_list_entry) { + if (!ucmd->sent_to_user) + continue; + if (ucmd_get_check(ucmd)) continue; - TRACE_DBG("ucmd %p, state %x, scst_cmd %p", - ucmd, ucmd->state, ucmd->cmd); + TRACE_MGMT_DBG("ucmd %p, state %x, scst_cmd %p", ucmd, + ucmd->state, ucmd->cmd); - if (ucmd->sent_to_user) { - dev_user_unjam_cmd(ucmd, 0, &flags); - repeat = true; - } + dev_user_unjam_cmd(ucmd, 0, NULL); + spin_unlock_irq(&dev->cmd_lists.cmd_list_lock); ucmd_put(ucmd); + spin_lock_irq(&dev->cmd_lists.cmd_list_lock); - if (repeat) - goto repeat; + goto repeat; } } if (dev_user_process_scst_commands(dev) != 0) goto repeat; - spin_unlock_irqrestore(&dev->cmd_lists.cmd_list_lock, flags); + spin_unlock_irq(&dev->cmd_lists.cmd_list_lock); TRACE_EXIT(); return; @@ -2458,6 +2441,8 @@ strncpy(dev->name, dev_desc->name, sizeof(dev->name)-1); dev->name[sizeof(dev->name)-1] = '\0'; + scst_init_mem_lim(&dev->udev_mem_lim); + /* * We don't use clustered pool, since it implies pages reordering, * which isn't possible with user space supplied buffers. Although @@ -2732,14 +2717,7 @@ down_write(&dev->dev_rwsem); spin_lock_irq(&cleanup_lock); - - dev->cleaning = 1; - smp_mb(); /* pair to dev_user_add_to_ready() */ - - sBUG_ON(dev->in_cleanup_list); list_add_tail(&dev->cleanup_list_entry, &cleanup_list); - dev->in_cleanup_list = 1; - spin_unlock_irq(&cleanup_lock); wake_up(&cleanup_list_waitQ); @@ -2753,15 +2731,7 @@ TRACE_DBG("Unregistering finished (dev %p)", dev); dev->cleanup_done = 1; - smp_mb(); /* just in case */ - spin_lock_irq(&cleanup_lock); - if (!dev->in_cleanup_list) { - list_add_tail(&dev->cleanup_list_entry, &cleanup_list); - dev->in_cleanup_list = 1; - } - spin_unlock_irq(&cleanup_lock); - wake_up(&cleanup_list_waitQ); wake_up(&dev->cmd_lists.cmd_list_waitQ); @@ -2780,10 +2750,10 @@ return res; } -static void dev_user_process_cleanup(struct scst_user_dev *dev) +static int dev_user_process_cleanup(struct scst_user_dev *dev) { struct scst_user_cmd *ucmd; - int rc; + int rc, res = 1; TRACE_ENTRY(); @@ -2795,12 +2765,11 @@ dev_user_unjam_dev(dev); spin_lock_irq(&dev->cmd_lists.cmd_list_lock); - smp_mb(); /* just in case, pair for dev_user_release() - * cleanup_done assignment. - */ + rc = dev_user_get_next_cmd(dev, &ucmd); if (rc == 0) dev_user_unjam_cmd(ucmd, 1, NULL); + spin_unlock_irq(&dev->cmd_lists.cmd_list_lock); if (rc == -EAGAIN) { @@ -2832,10 +2801,11 @@ TRACE_DBG("Cleanuping done (dev %p)", dev); complete_all(&dev->cleanup_cmpl); + res = 0; out: - TRACE_EXIT(); - return; + TRACE_EXIT_RES(res); + return res; } static inline int test_cleanup_list(void) @@ -2847,8 +2817,6 @@ static int dev_user_cleanup_thread(void *arg) { - struct scst_user_dev *dev; - TRACE_ENTRY(); PRINT_INFO("Cleanup thread started, PID %d", current->pid); @@ -2874,16 +2842,45 @@ remove_wait_queue(&cleanup_list_waitQ, &wait); } - while (!list_empty(&cleanup_list)) { - dev = list_entry(cleanup_list.next, typeof(*dev), - cleanup_list_entry); - list_del(&dev->cleanup_list_entry); - dev->in_cleanup_list = 0; - spin_unlock_irq(&cleanup_lock); + /* + * We have to poll devices, because commands can go from SCST + * core on cmd_list_waitQ and we have no practical way to + * detect them. + */ - dev_user_process_cleanup(dev); + while (1) { + struct scst_user_dev *dev; + LIST_HEAD(cl_devs); + while (!list_empty(&cleanup_list)) { + int rc; + + dev = list_entry(cleanup_list.next, + typeof(*dev), cleanup_list_entry); + list_del(&dev->cleanup_list_entry); + + spin_unlock_irq(&cleanup_lock); + rc = dev_user_process_cleanup(dev); + spin_lock_irq(&cleanup_lock); + + if (rc != 0) + list_add_tail(&dev->cleanup_list_entry, + &cl_devs); + } + + if (list_empty(&cl_devs)) + break; + + spin_unlock_irq(&cleanup_lock); + msleep(100); spin_lock_irq(&cleanup_lock); + + while (!list_empty(&cl_devs)) { + dev = list_entry(cl_devs.next, typeof(*dev), + cleanup_list_entry); + list_move_tail(&dev->cleanup_list_entry, + &cleanup_list); + } } } spin_unlock_irq(&cleanup_lock); Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/scst/src/scst_lib.c 2008-06-12 18:55:13 UTC (rev 411) @@ -186,6 +186,56 @@ } EXPORT_SYMBOL(scst_set_busy); +int scst_get_cmd_abnormal_done_state(const struct scst_cmd *cmd) +{ + int res; + + TRACE_ENTRY(); + + switch(cmd->state) { + case SCST_CMD_STATE_INIT_WAIT: + case SCST_CMD_STATE_INIT: + case SCST_CMD_STATE_PRE_PARSE: + case SCST_CMD_STATE_DEV_PARSE: + res = SCST_CMD_STATE_PRE_XMIT_RESP; + break; + + default: + res = SCST_CMD_STATE_PRE_DEV_DONE; + break; + } + + TRACE_EXIT_RES(res); + return res; +} +EXPORT_SYMBOL(scst_get_cmd_abnormal_done_state); + +void scst_set_cmd_abnormal_done_state(struct scst_cmd *cmd) +{ + TRACE_ENTRY(); + +#ifdef EXTRACHECKS + switch(cmd->state) { + case SCST_CMD_STATE_PRE_XMIT_RESP: + case SCST_CMD_STATE_XMIT_RESP: + case SCST_CMD_STATE_FINISHED: + case SCST_CMD_STATE_XMIT_WAIT: + PRINT_CRIT_ERROR("Wrong cmd state %x (cmd %p, op %x)", + cmd->state, cmd, cmd->cdb[0]); + sBUG(); + } +#endif + + cmd->state = scst_get_cmd_abnormal_done_state(cmd); + + EXTRACHECKS_BUG_ON((cmd->state != SCST_CMD_STATE_PRE_XMIT_RESP) && + (cmd->tgt_dev == NULL)); + + TRACE_EXIT(); + return; +} +EXPORT_SYMBOL(scst_set_cmd_abnormal_done_state); + void scst_set_resp_data_len(struct scst_cmd *cmd, int resp_data_len) { int i, l; @@ -248,6 +298,7 @@ dev->p_cmd_lists = &scst_main_cmd_lists; atomic_set(&dev->dev_cmd_count, 0); atomic_set(&dev->write_cmd_count, 0); + scst_init_mem_lim(&dev->dev_mem_lim); spin_lock_init(&dev->dev_lock); atomic_set(&dev->on_dev_count, 0); INIT_LIST_HEAD(&dev->blocked_cmd_list); @@ -287,6 +338,14 @@ return; } +void scst_init_mem_lim(struct scst_mem_lim *mem_lim) +{ + atomic_set(&mem_lim->alloced_pages, 0); + mem_lim->max_allowed_pages = + ((uint64_t)scst_max_dev_cmd_mem << 10) >> (PAGE_SHIFT - 10); +} +EXPORT_SYMBOL(scst_init_mem_lim); + struct scst_acg_dev *scst_alloc_acg_dev(struct scst_acg *acg, struct scst_device *dev, lun_t lun) { @@ -1611,7 +1670,7 @@ } cmd->sg = sgv_pool_alloc(tgt_dev->pool, bufflen, gfp_mask, flags, - &cmd->sg_cnt, &cmd->sgv, NULL); + &cmd->sg_cnt, &cmd->sgv, &cmd->dev->dev_mem_lim, NULL); if (cmd->sg == NULL) goto out; @@ -1634,7 +1693,7 @@ return res; out_sg_free: - sgv_pool_free(cmd->sgv); + sgv_pool_free(cmd->sgv, &cmd->dev->dev_mem_lim); cmd->sgv = NULL; cmd->sg = NULL; cmd->sg_cnt = 0; @@ -1653,7 +1712,7 @@ goto out; } - sgv_pool_free(cmd->sgv); + sgv_pool_free(cmd->sgv, &cmd->dev->dev_mem_lim); cmd->sgv = NULL; cmd->sg_cnt = 0; Modified: trunk/scst/src/scst_main.c =================================================================== --- trunk/scst/src/scst_main.c 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/scst/src/scst_main.c 2008-06-12 18:55:13 UTC (rev 411) @@ -104,10 +104,6 @@ unsigned long scst_flags; atomic_t scst_cmd_count; -spinlock_t scst_cmd_mem_lock; -unsigned long scst_cur_cmd_mem, scst_cur_max_cmd_mem; -unsigned long scst_max_cmd_mem; - struct scst_cmd_lists scst_main_cmd_lists; struct scst_tasklet scst_tasklets[NR_CPUS]; @@ -141,13 +137,20 @@ spinlock_t scst_temp_UA_lock; uint8_t scst_temp_UA[SCST_SENSE_BUFFERSIZE]; +unsigned int scst_max_cmd_mem; +unsigned int scst_max_dev_cmd_mem; + module_param_named(scst_threads, scst_threads, int, 0); MODULE_PARM_DESC(scst_threads, "SCSI target threads count"); -module_param_named(scst_max_cmd_mem, scst_max_cmd_mem, long, 0); +module_param_named(scst_max_cmd_mem, scst_max_cmd_mem, int, 0); MODULE_PARM_DESC(scst_max_cmd_mem, "Maximum memory allowed to be consumed by " - "the SCST commands at any given time in MB"); + "all SCSI commands of all devices at any given time in MB"); +module_param_named(scst_max_dev_cmd_mem, scst_max_dev_cmd_mem, int, 0); +MODULE_PARM_DESC(scst_max_dev_cmd_mem, "Maximum memory allowed to be consumed " + "by all SCSI commands of a device at any given time in MB"); + struct scst_dev_type scst_null_devtype = { .name = "none", }; @@ -1620,7 +1623,6 @@ scst_trace_flag = SCST_DEFAULT_LOG_FLAGS; #endif atomic_set(&scst_cmd_count, 0); - spin_lock_init(&scst_cmd_mem_lock); spin_lock_init(&scst_mcmd_lock); INIT_LIST_HEAD(&scst_active_mgmt_cmd_list); INIT_LIST_HEAD(&scst_delayed_mgmt_cmd_list); @@ -1712,15 +1714,27 @@ struct sysinfo si; si_meminfo(&si); #if BITS_PER_LONG == 32 - scst_max_cmd_mem = min(((uint64_t)si.totalram << PAGE_SHIFT) >> 2, - (uint64_t)1 << 30); + scst_max_cmd_mem = min( + (((uint64_t)si.totalram << PAGE_SHIFT) >> 20) >> 2, + (uint64_t)1 << 30); #else - scst_max_cmd_mem = (si.totalram << PAGE_SHIFT) >> 2; + scst_max_cmd_mem = ((si.totalram << PAGE_SHIFT) >> 20) >> 2; #endif + } + + if (scst_max_dev_cmd_mem != 0) { + if (scst_max_dev_cmd_mem > scst_max_cmd_mem) { + PRINT_ERROR("scst_max_dev_cmd_mem (%d) > " + "scst_max_cmd_mem (%d)", + scst_max_dev_cmd_mem, + scst_max_cmd_mem); + scst_max_dev_cmd_mem = scst_max_cmd_mem; + } } else - scst_max_cmd_mem <<= 20; + scst_max_dev_cmd_mem = scst_max_cmd_mem * 2 / 5; - res = scst_sgv_pools_init(scst_max_cmd_mem, 0); + res = scst_sgv_pools_init( + ((uint64_t)scst_max_cmd_mem << 10) >> (PAGE_SHIFT - 10), 0); if (res != 0) goto out_destroy_sense_mempool; @@ -1756,7 +1770,8 @@ PRINT_INFO("SCST version %s loaded successfully (max mem for " - "commands %ld Mb)", SCST_VERSION_STRING, scst_max_cmd_mem >> 20); + "commands %dMB, per device %dMB)", SCST_VERSION_STRING, + scst_max_cmd_mem, scst_max_dev_cmd_mem); scst_print_config(); Modified: trunk/scst/src/scst_mem.c =================================================================== --- trunk/scst/src/scst_mem.c 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/scst/src/scst_mem.c 2008-06-12 18:55:13 UTC (rev 411) @@ -322,7 +322,7 @@ kfree(obj->sg_entries); } - kmem_cache_free(obj->owner_pool->caches[obj->order], obj); + kmem_cache_free(obj->owner_pool->caches[obj->order_or_pages], obj); return; } @@ -330,22 +330,28 @@ int order, unsigned long gfp_mask) { struct sgv_pool_obj *obj; + int pages = 1 << order; spin_lock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); if (likely(!list_empty(&pool->recycling_lists[order]))) { obj = list_entry(pool->recycling_lists[order].next, struct sgv_pool_obj, recycle_entry.recycling_list_entry); + list_del(&obj->recycle_entry.sorted_recycling_list_entry); list_del(&obj->recycle_entry.recycling_list_entry); - sgv_pools_mgr.mgr.thr.inactive_pages_total -= 1 << order; + + sgv_pools_mgr.mgr.throttle.inactive_pages_total -= pages; + sgv_pools_mgr.mgr.throttle.active_pages_total += pages; + spin_unlock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); - EXTRACHECKS_BUG_ON(obj->order != order); + + EXTRACHECKS_BUG_ON(obj->order_or_pages != order); goto out; } pool->acc.cached_entries++; - pool->acc.cached_pages += (1 << order); + pool->acc.cached_pages += pages; spin_unlock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); @@ -353,12 +359,12 @@ gfp_mask & ~(__GFP_HIGHMEM|GFP_DMA)); if (likely(obj)) { memset(obj, 0, sizeof(*obj)); - obj->order = order; + obj->order_or_pages = order; obj->owner_pool = pool; } else { spin_lock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); pool->acc.cached_entries--; - pool->acc.cached_pages -= (1 << order); + pool->acc.cached_pages -= pages; spin_unlock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); } @@ -370,12 +376,15 @@ { struct sgv_pool *owner = sgv->owner_pool; struct list_head *entry; - struct list_head *list = &owner->recycling_lists[sgv->order]; + struct list_head *list = &owner->recycling_lists[sgv->order_or_pages]; int sched = 0; + int pages = 1 << sgv->order_or_pages; + EXTRACHECKS_BUG_ON(sgv->order_or_pages < 0); + spin_lock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); - TRACE_MEM("sgv %p, order %d, sg_count %d", sgv, sgv->order, + TRACE_MEM("sgv %p, order %d, sg_count %d", sgv, sgv->order_or_pages, sgv->sg_count); if (owner->clustered) { @@ -385,7 +394,7 @@ struct sgv_pool_obj, recycle_entry.recycling_list_entry); TRACE_DBG("tmp %p, order %d, sg_count %d", tmp, - tmp->order, tmp->sg_count); + tmp->order_or_pages, tmp->sg_count); if (sgv->sg_count <= tmp->sg_count) break; } @@ -401,7 +410,9 @@ sgv->recycle_entry.time_stamp = jiffies; - sgv_pools_mgr.mgr.thr.inactive_pages_total += 1 << sgv->order; + sgv_pools_mgr.mgr.throttle.inactive_pages_total += pages; + sgv_pools_mgr.mgr.throttle.active_pages_total -= pages; + if (!sgv_pools_mgr.mgr.pitbool_running) { sgv_pools_mgr.mgr.pitbool_running = 1; sched = 1; @@ -417,13 +428,13 @@ /* Must be called under pool_mgr_lock held */ static void __sgv_pool_cached_purge(struct sgv_pool_obj *e) { - int pages = 1 << e->order; + int pages = 1 << e->order_or_pages; list_del(&e->recycle_entry.sorted_recycling_list_entry); list_del(&e->recycle_entry.recycling_list_entry); e->owner_pool->acc.cached_entries--; e->owner_pool->acc.cached_pages -= pages; - sgv_pools_mgr.mgr.thr.inactive_pages_total -= pages; + sgv_pools_mgr.mgr.throttle.inactive_pages_total -= pages; return; } @@ -445,8 +456,8 @@ static int sgv_pool_oom_free_objs(int pgs) { TRACE_MEM("Shrinking pools about %d pages", pgs); - while ((sgv_pools_mgr.mgr.thr.inactive_pages_total > - sgv_pools_mgr.mgr.thr.lo_wmk) && + while ((sgv_pools_mgr.mgr.throttle.inactive_pages_total > + sgv_pools_mgr.mgr.throttle.lo_wmk) && (pgs > 0)) { struct sgv_pool_obj *e; @@ -457,7 +468,7 @@ recycle_entry.sorted_recycling_list_entry); __sgv_pool_cached_purge(e); - pgs -= 1 << e->order; + pgs -= 1 << e->order_or_pages; spin_unlock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); sgv_dtor_and_free(e); @@ -468,22 +479,19 @@ return pgs; } -static int sgv_pool_hiwmk_check(int pages_to_alloc, int no_fail) +static int sgv_pool_hiwmk_check(int pages_to_alloc) { int res = 0; int pages = pages_to_alloc; - if (unlikely(no_fail)) - goto out; - spin_lock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); - pages += atomic_read(&sgv_pools_mgr.mgr.thr.active_pages_total); - pages += sgv_pools_mgr.mgr.thr.inactive_pages_total; + pages += sgv_pools_mgr.mgr.throttle.active_pages_total; + pages += sgv_pools_mgr.mgr.throttle.inactive_pages_total; - if (unlikely((u32)pages > sgv_pools_mgr.mgr.thr.hi_wmk)) { - pages -= sgv_pools_mgr.mgr.thr.hi_wmk; - sgv_pools_mgr.mgr.thr.releases_on_hiwmk++; + if (unlikely((u32)pages > sgv_pools_mgr.mgr.throttle.hi_wmk)) { + pages -= sgv_pools_mgr.mgr.throttle.hi_wmk; + sgv_pools_mgr.mgr.throttle.releases_on_hiwmk++; pages = sgv_pool_oom_free_objs(pages); if (pages > 0) { @@ -491,26 +499,70 @@ "memory (%d pages) for being executed " "commands together with the already " "allocated memory exceeds the allowed " - "maximum %dMB. Should you increase " + "maximum %d. Should you increase " "scst_max_cmd_mem?", pages_to_alloc, - sgv_pools_mgr.mgr.thr.hi_wmk >> - (20-PAGE_SHIFT)); - sgv_pools_mgr.mgr.thr.releases_failed++; + sgv_pools_mgr.mgr.throttle.hi_wmk); + sgv_pools_mgr.mgr.throttle.releases_failed++; res = -ENOMEM; goto out_unlock; } } + sgv_pools_mgr.mgr.throttle.active_pages_total += pages_to_alloc; + out_unlock: + TRACE_MEM("pages_to_alloc %d, new active %d", pages_to_alloc, + sgv_pools_mgr.mgr.throttle.active_pages_total); + spin_unlock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); + return res; +} -out: +static void sgv_pool_hiwmk_uncheck(int pages) +{ + spin_lock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); + sgv_pools_mgr.mgr.throttle.active_pages_total -= pages; + TRACE_MEM("pages %d, new active %d", pages, + sgv_pools_mgr.mgr.throttle.active_pages_total); + spin_unlock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); + return; +} + +static bool scst_check_allowed_mem(struct scst_mem_lim *mem_lim, int pages) +{ + int alloced; + bool res = true; + + alloced = atomic_add_return(pages, &mem_lim->alloced_pages); + if (unlikely(alloced > mem_lim->max_allowed_pages)) { + TRACE(TRACE_OUT_OF_MEM, "Requested amount of memory " + "(%d pages) for being executed commands on a device " + "together with the already allocated memory exceeds " + "the allowed maximum %d. Should you increase " + "scst_max_dev_cmd_mem?", pages, + mem_lim->max_allowed_pages); + atomic_sub(pages, &mem_lim->alloced_pages); + res = false; + } + + TRACE_MEM("mem_lim %p, pages %d, res %d, new alloced %d", mem_lim, + pages, res, atomic_read(&mem_lim->alloced_pages)); + return res; } +static void scst_uncheck_allowed_mem(struct scst_mem_lim *mem_lim, int pages) +{ + atomic_sub(pages, &mem_lim->alloced_pages); + + TRACE_MEM("mem_lim %p, pages %d, new alloced %d", mem_lim, + pages, atomic_read(&mem_lim->alloced_pages)); + return; +} + struct scatterlist *sgv_pool_alloc(struct sgv_pool *pool, unsigned int size, unsigned long gfp_mask, int flags, int *count, - struct sgv_pool_obj **sgv, void *priv) + struct sgv_pool_obj **sgv, struct scst_mem_lim *mem_lim, void *priv) { struct sgv_pool_obj *obj; int order, pages, cnt; @@ -518,13 +570,15 @@ int pages_to_alloc; struct kmem_cache *cache; int no_cached = flags & SCST_POOL_ALLOC_NO_CACHED; - bool no_fail = ((gfp_mask & __GFP_NOFAIL) == __GFP_NOFAIL); + bool allowed_mem_checked = false, hiwmk_checked = false; TRACE_ENTRY(); if (unlikely(size == 0)) goto out; + sBUG_ON((gfp_mask & __GFP_NOFAIL) == __GFP_NOFAIL); + pages = ((size + PAGE_SIZE - 1) >> PAGE_SHIFT); order = get_order(size); @@ -533,34 +587,51 @@ if (*sgv != NULL) { obj = *sgv; + pages_to_alloc = (1 << order); + cache = pool->caches[obj->order_or_pages]; - TRACE_MEM("Supplied sgv_obj %p, sgv_order %d", obj, obj->order); - EXTRACHECKS_BUG_ON(obj->order != order); + TRACE_MEM("Supplied sgv_obj %p, sgv_order %d", obj, + obj->order_or_pages); + + EXTRACHECKS_BUG_ON(obj->order_or_pages != order); EXTRACHECKS_BUG_ON(obj->sg_count != 0); - pages_to_alloc = (1 << order); - cache = pool->caches[obj->order]; - if (sgv_pool_hiwmk_check(pages_to_alloc, no_fail) != 0) + + if (unlikely(!scst_check_allowed_mem(mem_lim, pages_to_alloc))) goto out_fail_free_sg_entries; + allowed_mem_checked = true; + + if (unlikely(sgv_pool_hiwmk_check(pages_to_alloc) != 0)) + goto out_fail_free_sg_entries; + hiwmk_checked = true; } else if ((order < SGV_POOL_ELEMENTS) && !no_cached) { + pages_to_alloc = (1 << order); cache = pool->caches[order]; + + if (unlikely(!scst_check_allowed_mem(mem_lim, pages_to_alloc))) + goto out_fail; + allowed_mem_checked = true; + obj = sgv_pool_cached_get(pool, order, gfp_mask); if (unlikely(obj == NULL)) { TRACE(TRACE_OUT_OF_MEM, "Allocation of " "sgv_pool_obj failed (size %d)", size); goto out_fail; } + if (obj->sg_count != 0) { TRACE_MEM("Cached sgv_obj %p", obj); - EXTRACHECKS_BUG_ON(obj->order != order); + EXTRACHECKS_BUG_ON(obj->order_or_pages != order); atomic_inc(&pool->cache_acc[order].hit_alloc); goto success; } - pages_to_alloc = (1 << order); + if (flags & SCST_POOL_NO_ALLOC_ON_CACHE_MISS) { if (!(flags & SCST_POOL_RETURN_OBJ_ON_ALLOC_FAIL)) goto out_fail_free; } + TRACE_MEM("Brand new sgv_obj %p", obj); + if (order <= sgv_pools_mgr.sgv_max_local_order) { obj->sg_entries = obj->sg_entries_data; sg_init_table(obj->sg_entries, pages_to_alloc); @@ -585,15 +656,25 @@ goto out_return; obj->allocator_priv = priv; - if (sgv_pool_hiwmk_check(pages_to_alloc, no_fail) != 0) + + if (unlikely(sgv_pool_hiwmk_check(pages_to_alloc) != 0)) goto out_fail_free_sg_entries; + hiwmk_checked = true; } else { int sz; + pages_to_alloc = pages; + + if (unlikely(!scst_check_allowed_mem(mem_lim, pages_to_alloc))) + goto out_fail; + allowed_mem_checked = true; + if (flags & SCST_POOL_NO_ALLOC_ON_CACHE_MISS) goto out_return2; + cache = NULL; sz = sizeof(*obj) + pages*sizeof(obj->sg_entries[0]); + obj = kmalloc(sz, gfp_mask); if (unlikely(obj == NULL)) { TRACE(TRACE_OUT_OF_MEM, "Allocation of " @@ -601,15 +682,18 @@ goto out_fail; } memset(obj, 0, sizeof(*obj)); + obj->owner_pool = pool; - obj->order = -1 - order; + obj->order_or_pages = -pages_to_alloc; obj->allocator_priv = priv; obj->sg_entries = obj->sg_entries_data; sg_init_table(obj->sg_entries, pages); - if (sgv_pool_hiwmk_check(pages_to_alloc, no_fail) != 0) + if (unlikely(sgv_pool_hiwmk_check(pages_to_alloc) != 0)) goto out_fail_free_sg_entries; + hiwmk_checked = true; + TRACE_MEM("Big or no_cached sgv_obj %p (size %d)", obj, sz); } @@ -642,8 +726,6 @@ } success: - atomic_add(1 << order, &sgv_pools_mgr.mgr.thr.active_pages_total); - if (cache) { int sg; atomic_inc(&pool->cache_acc[order].total_alloc); @@ -692,7 +774,7 @@ out_return2: *count = pages_to_alloc; res = NULL; - goto out; + goto out_uncheck; out_fail_free_sg_entries: if (obj->sg_entries != obj->sg_entries_data) { @@ -716,6 +798,12 @@ *count = 0; *sgv = NULL; TRACE_MEM("%s", "Allocation failed"); + +out_uncheck: + if (hiwmk_checked) + sgv_pool_hiwmk_uncheck(pages_to_alloc); + if (allowed_mem_checked) + scst_uncheck_allowed_mem(mem_lim, pages_to_alloc); goto out; } EXPORT_SYMBOL(sgv_pool_alloc); @@ -726,27 +814,28 @@ } EXPORT_SYMBOL(sgv_get_priv); -void sgv_pool_free(struct sgv_pool_obj *sgv) +void sgv_pool_free(struct sgv_pool_obj *sgv, struct scst_mem_lim *mem_lim) { - int order = sgv->order, pages; + int pages; TRACE_MEM("Freeing sgv_obj %p, order %d, sg_entries %p, " - "sg_count %d, allocator_priv %p", sgv, order, + "sg_count %d, allocator_priv %p", sgv, sgv->order_or_pages, sgv->sg_entries, sgv->sg_count, sgv->allocator_priv); - if (order >= 0) { + + if (sgv->order_or_pages >= 0) { sgv->sg_entries[sgv->orig_sg].length = sgv->orig_length; - - pages = (sgv->sg_count) ? 1 << order : 0; + pages = (sgv->sg_count != 0) ? 1 << sgv->order_or_pages : 0; sgv_pool_cached_put(sgv); } else { sgv->owner_pool->alloc_fns.free_pages_fn(sgv->sg_entries, sgv->sg_count, sgv->allocator_priv); - - pages = (sgv->sg_count) ? 1 << (-order - 1) : 0; + pages = (sgv->sg_count != 0) ? -sgv->order_or_pages : 0; kfree(sgv); + sgv_pool_hiwmk_uncheck(pages); } - atomic_sub(pages, &sgv_pools_mgr.mgr.thr.active_pages_total); + scst_uncheck_allowed_mem(mem_lim, pages); + return; } EXPORT_SYMBOL(sgv_pool_free); @@ -763,14 +852,19 @@ atomic_inc(&sgv_pools_mgr.sgv_other_total_alloc); - if (sgv_pool_hiwmk_check(pages, no_fail) != 0) { - res = NULL; - goto out; + if (unlikely(!no_fail)) { + if (unlikely(sgv_pool_hiwmk_check(pages) != 0)) { + res = NULL; + goto out; + } } res = kmalloc(pages*sizeof(*res), gfp_mask); - if (res == NULL) - goto out; + if (res == NULL) { + TRACE(TRACE_OUT_OF_MEM, "Unable to allocate sg for %d pages", + pages); + goto out_uncheck; + } sg_init_table(res, pages); @@ -784,8 +878,6 @@ if (*count <= 0) goto out_free; - atomic_add(pages, &sgv_pools_mgr.mgr.thr.active_pages_total); - out: TRACE_MEM("Alloced sg %p (count %d)", res, *count); @@ -795,6 +887,10 @@ out_free: kfree(res); res = NULL; + +out_uncheck: + if (!no_fail) + sgv_pool_hiwmk_uncheck(pages); goto out; } EXPORT_SYMBOL(scst_alloc); @@ -803,7 +899,7 @@ { TRACE_MEM("Freeing sg=%p", sg); - atomic_sub(count, &sgv_pools_mgr.mgr.thr.active_pages_total); + sgv_pool_hiwmk_uncheck(count); scst_free_sys_sg_entries(sg, count, NULL); kfree(sg); @@ -1040,7 +1136,7 @@ recycle_entry.sorted_recycling_list_entry); if (sgv_pool_cached_purge(e, SHRINK_TIME_AFTER, rt) == 0) { - nr -= 1 << e->order; + nr -= 1 << e->order_or_pages; spin_unlock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); sgv_dtor_and_free(e); spin_lock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); @@ -1052,7 +1148,7 @@ } } - nr = sgv_pools_mgr.mgr.thr.inactive_pages_total; + nr = sgv_pools_mgr.mgr.throttle.inactive_pages_total; spin_unlock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); @@ -1085,7 +1181,7 @@ break; } - total_pages = sgv_pools_mgr.mgr.thr.inactive_pages_total; + total_pages = sgv_pools_mgr.mgr.throttle.inactive_pages_total; spin_unlock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); @@ -1098,6 +1194,7 @@ return; } +/* Both parameters in pages */ int scst_sgv_pools_init(unsigned long mem_hwmark, unsigned long mem_lwmark) { int res; @@ -1107,11 +1204,9 @@ memset(pools, 0, sizeof(*pools)); - atomic_set(&sgv_pools_mgr.mgr.thr.active_pages_total, 0); + sgv_pools_mgr.mgr.throttle.hi_wmk = mem_hwmark; + sgv_pools_mgr.mgr.throttle.lo_wmk = mem_lwmark; - sgv_pools_mgr.mgr.thr.hi_wmk = mem_hwmark >> PAGE_SHIFT; - sgv_pools_mgr.mgr.thr.lo_wmk = mem_lwmark >> PAGE_SHIFT; - sgv_pool_evaluate_local_order(&sgv_pools_mgr); atomic_set(&pools->sgv_other_total_alloc, 0); @@ -1255,12 +1350,12 @@ seq_printf(seq, "%-42s %d/%d\n%-42s %d/%d\n%-42s %d/%d\n\n", "Inactive/active pages", - sgv_pools_mgr.mgr.thr.inactive_pages_total, - atomic_read(&sgv_pools_mgr.mgr.thr.active_pages_total), - "Hi/lo watermarks [pages]", sgv_pools_mgr.mgr.thr.hi_wmk, - sgv_pools_mgr.mgr.thr.lo_wmk, "Hi watermark releases/failures", - sgv_pools_mgr.mgr.thr.releases_on_hiwmk, - sgv_pools_mgr.mgr.thr.releases_failed); + sgv_pools_mgr.mgr.throttle.inactive_pages_total, + sgv_pools_mgr.mgr.throttle.active_pages_total, + "Hi/lo watermarks [pages]", sgv_pools_mgr.mgr.throttle.hi_wmk, + sgv_pools_mgr.mgr.throttle.lo_wmk, "Hi watermark releases/failures", + sgv_pools_mgr.mgr.throttle.releases_on_hiwmk, + sgv_pools_mgr.mgr.throttle.releases_failed); seq_printf(seq, "%-30s %-11s %-11s %-11s %-11s", "Name", "Hit", "Total", "% merged", "Cached"); Modified: trunk/scst/src/scst_mem.h =================================================================== --- trunk/scst/src/scst_mem.h 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/scst/src/scst_mem.h 2008-06-12 18:55:13 UTC (rev 411) @@ -33,7 +33,8 @@ }; struct sgv_pool_obj { - int order; + /* if <0 - pages, >0 - order */ + int order_or_pages; struct { unsigned long time_stamp; /* jiffies, protected by pool_mgr_lock */ @@ -102,14 +103,14 @@ struct sgv_mem_throttling { u32 inactive_pages_total; - atomic_t active_pages_total; + u32 active_pages_total; u32 hi_wmk; /* compared against inactive_pages_total + active_pages_total */ u32 lo_wmk; /* compared against inactive_pages_total only */ u32 releases_on_hiwmk; u32 releases_failed; - } thr; /* protected by pool_mgr_lock */ + } throttle; /* protected by pool_mgr_lock */ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)) struct shrinker *sgv_shrinker; Modified: trunk/scst/src/scst_priv.h =================================================================== --- trunk/scst/src/scst_priv.h 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/scst/src/scst_priv.h 2008-06-12 18:55:13 UTC (rev 411) @@ -138,7 +138,8 @@ return irqs_disabled() || in_atomic() || in_interrupt(); } -extern unsigned long scst_max_cmd_mem; +extern unsigned int scst_max_cmd_mem; +extern unsigned int scst_max_dev_cmd_mem; extern mempool_t *scst_mgmt_mempool; extern mempool_t *scst_mgmt_stub_mempool; @@ -273,7 +274,7 @@ void scst_del_dev_threads(struct scst_device *dev, int num); int scst_alloc_device(int gfp_mask, struct scst_device **out_dev); -void scst_free_device(struct scst_device *tgt_dev); +void scst_free_device(struct scst_device *dev); struct scst_acg *scst_alloc_add_acg(const char *acg_name); int scst_destroy_acg(struct scst_acg *acg); Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/scst/src/scst_targ.c 2008-06-12 18:55:13 UTC (rev 411) @@ -149,7 +149,7 @@ */ sBUG_ON(context != SCST_CONTEXT_DIRECT); scst_set_busy(cmd); - cmd->state = SCST_CMD_STATE_PRE_XMIT_RESP; + scst_set_cmd_abnormal_done_state(cmd); /* Keep initiator away from too many BUSY commands */ if (!in_interrupt() && !in_atomic()) msleep(50); @@ -239,7 +239,7 @@ case SCST_SESS_IPH_FAILED: spin_unlock_irqrestore(&sess->sess_list_lock, flags); scst_set_busy(cmd); - cmd->state = SCST_CMD_STATE_PRE_XMIT_RESP; + scst_set_cmd_abnormal_done_state(cmd); goto active; default: sBUG(); @@ -253,7 +253,7 @@ PRINT_ERROR("Wrong LUN %d, finishing cmd", -1); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_lun_not_supported)); - cmd->state = SCST_CMD_STATE_PRE_XMIT_RESP; + scst_set_cmd_abnormal_done_state(cmd); goto active; } @@ -261,7 +261,7 @@ PRINT_ERROR("Wrong CDB len %d, finishing cmd", 0); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode)); - cmd->state = SCST_CMD_STATE_PRE_XMIT_RESP; + scst_set_cmd_abnormal_done_state(cmd); goto active; } @@ -269,7 +269,7 @@ PRINT_ERROR("Unsupported queue type %d", cmd->queue_type); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_message)); - cmd->state = SCST_CMD_STATE_PRE_XMIT_RESP; + scst_set_cmd_abnormal_done_state(cmd); goto active; } @@ -393,10 +393,10 @@ /* * Command data length can't be easily * determined from the CDB. ToDo, all such - * commands should be fixed. Until they are - * fixed, get it from the supplied expected - * value, but limit it to some reasonable - * value (15MB). + * commands processing should be fixed. Until + * it's done, get the length from the supplied + * expected value, but limit it to some + * reasonable value (15MB). */ cmd->bufflen = min(cmd->expected_transfer_len, 15*1024*1024); @@ -429,7 +429,7 @@ return res; out_xmit: - cmd->state = SCST_CMD_STATE_PRE_XMIT_RESP; + scst_set_cmd_abnormal_done_state(cmd); res = SCST_CMD_STATE_RES_CONT_SAME; goto out; } @@ -684,7 +684,7 @@ if (unlikely(test_bit(SCST_CMD_ABORTED, &cmd->cmd_flags))) { TRACE_MGMT_DBG("ABORTED set, returning ABORTED for " "cmd %p", cmd); - cmd->state = SCST_CMD_STATE_PRE_DEV_DONE; + scst_set_cmd_abnormal_done_state(cmd); res = SCST_CMD_STATE_RES_CONT_SAME; goto out; } @@ -717,13 +717,13 @@ TRACE(TRACE_OUT_OF_MEM, "Unable to allocate or build requested buffer " "(size %d), sending BUSY or QUEUE FULL status", cmd->bufflen); scst_set_busy(cmd); - cmd->state = SCST_CMD_STATE_PRE_DEV_DONE; + scst_set_cmd_abnormal_done_state(cmd); res = SCST_CMD_STATE_RES_CONT_SAME; goto out; out_error: scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); - cmd->state = SCST_CMD_STATE_PRE_DEV_DONE; + scst_set_cmd_abnormal_done_state(cmd); res = SCST_CMD_STATE_RES_CONT_SAME; goto out; } @@ -775,7 +775,7 @@ break; case SCST_PREPROCESS_STATUS_ERROR_SENSE_SET: - cmd->state = SCST_CMD_STATE_PRE_DEV_DONE; + scst_set_cmd_abnormal_done_state(cmd); break; case SCST_PREPROCESS_STATUS_ERROR_FATAL: @@ -784,13 +784,13 @@ case SCST_PREPROCESS_STATUS_ERROR: scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); - cmd->state = SCST_CMD_STATE_PRE_DEV_DONE; + scst_set_cmd_abnormal_done_state(cmd); break; default: PRINT_ERROR("%s() received unknown status %x", __func__, status); - cmd->state = SCST_CMD_STATE_PRE_DEV_DONE; + scst_set_cmd_abnormal_done_state(cmd); break; } @@ -915,7 +915,7 @@ scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); out_dev_done: - cmd->state = SCST_CMD_STATE_PRE_DEV_DONE; + scst_set_cmd_abnormal_done_state(cmd); res = SCST_CMD_STATE_RES_CONT_SAME; goto out; } @@ -1002,7 +1002,7 @@ break; case SCST_RX_STATUS_ERROR_SENSE_SET: - cmd->state = SCST_CMD_STATE_PRE_DEV_DONE; + scst_set_cmd_abnormal_done_state(cmd); break; case SCST_RX_STATUS_ERROR_FATAL: @@ -1011,13 +1011,13 @@ case SCST_RX_STATUS_ERROR: scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); - cmd->state = SCST_CMD_STATE_PRE_DEV_DONE; + scst_set_cmd_abnormal_done_state(cmd); break; default: PRINT_ERROR("scst_rx_data() received unknown status %x", status); - cmd->state = SCST_CMD_STATE_PRE_DEV_DONE; + scst_set_cmd_abnormal_done_state(cmd); break; } @@ -1046,7 +1046,7 @@ if (unlikely(rc != SCST_PREPROCESS_STATUS_SUCCESS)) { switch (rc) { case SCST_PREPROCESS_STATUS_ERROR_SENSE_SET: - cmd->state = SCST_CMD_STATE_PRE_DEV_DONE; + scst_set_cmd_abnormal_done_state(cmd); break; case SCST_PREPROCESS_STATUS_ERROR_FATAL: set_bit(SCST_CMD_NO_RESP, &cmd->cmd_flags); @@ -1054,7 +1054,7 @@ case SCST_PREPROCESS_STATUS_ERROR: scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); - cmd->state = SCST_CMD_STATE_PRE_DEV_DONE; + scst_set_cmd_abnormal_done_state(cmd); break; case SCST_PREPROCESS_STATUS_NEED_THREAD: TRACE_DBG("Target driver's %s pre_exec() requested " @@ -1243,6 +1243,7 @@ } #endif + cmd->state = next_state; #ifdef EXTRACHECKS if ((next_state != SCST_CMD_STATE_PRE_DEV_DONE) && @@ -1252,11 +1253,9 @@ "state %d (opcode %d)", next_state, cmd->cdb[0]); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); - next_state = SCST_CMD_STATE_PRE_DEV_DONE; + scst_set_cmd_abnormal_done_state(cmd); } #endif - cmd->state = next_state; - context = scst_optimize_post_exec_context(cmd, scst_get_context()); if (cmd->context_processable) context |= SCST_CONTEXT_PROCESSABLE; @@ -1960,7 +1959,7 @@ cmd, (long long unsigned)cmd->tag); tgt_dev->def_cmd_count--; - cmd->state = SCST_CMD_STATE_PRE_DEV_DONE; + scst_set_cmd_abnormal_done_state(cmd); res = SCST_CMD_STATE_RES_CONT_SAME; } else { TRACE_SN("Deferring cmd %p (sn=%ld, set %d, " @@ -2472,7 +2471,7 @@ } scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); - cmd->state = SCST_CMD_STATE_PRE_XMIT_RESP; + scst_set_cmd_abnormal_done_state(cmd); res = SCST_CMD_STATE_RES_CONT_SAME; break; } @@ -2957,7 +2956,7 @@ TRACE_DBG("Finishing cmd %p", cmd); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_lun_not_supported)); - cmd->state = SCST_CMD_STATE_PRE_XMIT_RESP; + scst_set_cmd_abnormal_done_state(cmd); } else goto out; @@ -2967,7 +2966,7 @@ out_busy: scst_set_busy(cmd); - cmd->state = SCST_CMD_STATE_PRE_XMIT_RESP; + scst_set_cmd_abnormal_done_state(cmd); goto out; } @@ -3003,7 +3002,7 @@ } else { TRACE_MGMT_DBG("Aborting not inited cmd %p (tag %llu)", cmd, (long long unsigned int)cmd->tag); - cmd->state = SCST_CMD_STATE_PRE_XMIT_RESP; + scst_set_cmd_abnormal_done_state(cmd); } /* @@ -3676,9 +3675,11 @@ * after this TM command completed. */ TRACE_MGMT_DBG("cmd %p (tag %llu) being executed/xmitted " - "(state %d, proc time %ld sec.), deferring ABORT...", - cmd, (long long unsigned int)cmd->tag, cmd->state, - (long)(jiffies - cmd->start_time)/HZ); + "(state %d, op %x, proc time %ld sec., timeout %d " + "sec.), deferring ABORT...", cmd, + (long long unsigned int)cmd->tag, cmd->state, + cmd->cdb[0], (long)(jiffies - cmd->start_time) / HZ, + cmd->timeout / HZ); mcmd->cmd_finish_wait_count++; Modified: trunk/usr/fileio/README =================================================================== --- trunk/usr/fileio/README 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/usr/fileio/README 2008-06-12 18:55:13 UTC (rev 411) @@ -1,8 +1,8 @@ User space FILEIO handler ========================= -Version 0.9.6, XX XXX 200X --------------------------- +Version 1.0.0, XX June 2008 +--------------------------- User space program fileio_tgt uses interface of SCST's scst_user dev handler as well as allows to see how it works in various modes. Modified: trunk/usr/fileio/fileio.c =================================================================== --- trunk/usr/fileio/fileio.c 2008-06-12 18:37:31 UTC (rev 410) +++ trunk/usr/fileio/fileio.c 2008-06-12 18:55:13 UTC (rev 411) @@ -66,7 +66,7 @@ #endif /* defined(DEBUG) || defined(TRACING) */ #define DEF_BLOCK_SHIFT 9 -#define VERSION_STR "0.9.6" +#define VERSION_STR "1.0.0" #define THREADS 7 static struct option const long_options[] = This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-06-26 16:35:17
|
Revision: 422 http://scst.svn.sourceforge.net/scst/?rev=422&view=rev Author: vlnb Date: 2008-06-26 09:35:10 -0700 (Thu, 26 Jun 2008) Log Message: ----------- Minor cleanups and docs updates Modified Paths: -------------- trunk/AskingQuestions trunk/README trunk/doc/Makefile trunk/doc/scst_pg.sgml trunk/doc/scst_user_spec.txt trunk/iscsi-scst/AskingQuestions trunk/iscsi-scst/README trunk/iscsi-scst/kernel/target.c trunk/iscsi-scst/usr/ctldev.c trunk/qla2x00t/qla2x00-target/AskingQuestions trunk/qla2x00t/qla2x00-target/README trunk/qla2x00t/qla2x00-target/qla2x00t.c trunk/scst/AskingQuestions trunk/scst/README trunk/scst/src/scst_main.c Modified: trunk/AskingQuestions =================================================================== --- trunk/AskingQuestions 2008-06-26 11:52:09 UTC (rev 421) +++ trunk/AskingQuestions 2008-06-26 16:35:10 UTC (rev 422) @@ -313,4 +313,7 @@ Also it is very desirable if you attach to your question full kernel log from target since it's booted. +If you experience kernel crash, hang, etc., you should follow +REPORTING-BUGS file from your kernel source tree. + Vladislav Bolkhovitin <vs...@vl...>, http://scst.sourceforge.net Modified: trunk/README =================================================================== --- trunk/README 2008-06-26 11:52:09 UTC (rev 421) +++ trunk/README 2008-06-26 16:35:10 UTC (rev 422) @@ -4,12 +4,14 @@ 1. SCST core in scst/ subdirectory -2. Target drivers in own subdirectories qla2x00t/, iscsi-scst/, etc. +2. Administration utility for SCST core scstadmin in scstadmin/ -3. User space programs in usr/ subdirectory, like fileio_tgt. +3. Target drivers in own subdirectories qla2x00t/, iscsi-scst/, etc. -4. Some various docs in doc/ subdirectory. +4. User space programs in usr/ subdirectory, like fileio_tgt. +5. Some various docs in doc/ subdirectory. + Those subprojects are in most cases independent from each other, although some of them depend from the SCST core. They put in the single repository only to simplify their development, they are released Modified: trunk/doc/Makefile =================================================================== --- trunk/doc/Makefile 2008-06-26 11:52:09 UTC (rev 421) +++ trunk/doc/Makefile 2008-06-26 16:35:10 UTC (rev 422) @@ -54,7 +54,9 @@ $(COMMAND)rtf $(SOURCE) clean: + @mv scst_user_spec.txt scst_user_spec.tx rm -f *.txt *.html *.tex *.dvi *.ps *.pdf *.info *.lyx *.rtf + @mv scst_user_spec.tx scst_user_spec.txt extraclean: clean Modified: trunk/doc/scst_pg.sgml =================================================================== --- trunk/doc/scst_pg.sgml 2008-06-26 11:52:09 UTC (rev 421) +++ trunk/doc/scst_pg.sgml 2008-06-26 16:35:10 UTC (rev 422) @@ -5,7 +5,7 @@ <title>Generic SCSI Target Middle Level for Linux</title> <author> - <name>Vladislav Bolkhovitin <<tt/vst @at@ vlnb .dot. net/></name> + <name>Vladislav Bolkhovitin</name> </author> <date>Version 0.9.5 2006/12/01, actual for SCST 0.9.5 and later</date> @@ -39,8 +39,8 @@ <item> Undertakes most problems, related to execution contexts, thus practically eliminating one of the most complicated problem in the -kernel drivers development. For example, a target driver for Qlogic -2200/2300 cards, which has all necessary features, is about 2000 +kernel drivers development. For example, a target driver for QLogic +22xx/23xx cards, which has all necessary features, is about 2000 lines of code long, that is at least in several times less, than the initiator one. Modified: trunk/doc/scst_user_spec.txt =================================================================== --- trunk/doc/scst_user_spec.txt 2008-06-26 11:52:09 UTC (rev 421) +++ trunk/doc/scst_user_spec.txt 2008-06-26 16:35:10 UTC (rev 422) @@ -872,3 +872,5 @@ Then, if no more 4K commands come for some time, for it SCST_USER_ON_CACHED_MEM_FREE subcommand will be returned to the VTL in order to ask it to free that buffer. + +Vladislav Bolkhovitin Modified: trunk/iscsi-scst/AskingQuestions =================================================================== --- trunk/iscsi-scst/AskingQuestions 2008-06-26 11:52:09 UTC (rev 421) +++ trunk/iscsi-scst/AskingQuestions 2008-06-26 16:35:10 UTC (rev 422) @@ -313,4 +313,7 @@ Also it is very desirable if you attach to your question full kernel log from target since it's booted. +If you experience kernel crash, hang, etc., you should follow +REPORTING-BUGS file from your kernel source tree. + Vladislav Bolkhovitin <vs...@vl...>, http://scst.sourceforge.net Modified: trunk/iscsi-scst/README =================================================================== --- trunk/iscsi-scst/README 2008-06-26 11:52:09 UTC (rev 421) +++ trunk/iscsi-scst/README 2008-06-26 16:35:10 UTC (rev 422) @@ -111,7 +111,8 @@ ISCSI parameters like iSNS, CHAP and target parameters are configured in iscsi-scstd.conf. All LUN information is configured using the regular -SCST interface. The LUN information in iscsi-scstd.conf will be ignored. +SCST interface. It is highly recommended to use scstadmin utility for +that purpose. The LUN information in iscsi-scstd.conf will be ignored. This is because now responsibilities are divided (as it should be) between the target driver (iSCSI-SCST) and the SCST core as it logically should be: the target driver is responsible for handling targets and Modified: trunk/iscsi-scst/kernel/target.c =================================================================== --- trunk/iscsi-scst/kernel/target.c 2008-06-26 11:52:09 UTC (rev 421) +++ trunk/iscsi-scst/kernel/target.c 2008-06-26 16:35:10 UTC (rev 422) @@ -223,7 +223,7 @@ TRACE_MGMT_DBG("%s", "Deleting all targets"); - /* Complete brain damage, ToDo */ + /* Not the best, ToDo */ while (1) { mutex_lock(&target_mgmt_mutex); Modified: trunk/iscsi-scst/usr/ctldev.c =================================================================== --- trunk/iscsi-scst/usr/ctldev.c 2008-06-26 11:52:09 UTC (rev 421) +++ trunk/iscsi-scst/usr/ctldev.c 2008-06-26 16:35:10 UTC (rev 422) @@ -144,10 +144,6 @@ return err; } -/** - ** ToDo: the below code is a brain damage, rewrite it. - **/ - static int __conn_close(int fd, u32 tid, u64 sid, u32 cid, void *arg) { return ki->conn_destroy(tid, sid, cid); Modified: trunk/qla2x00t/qla2x00-target/AskingQuestions =================================================================== --- trunk/qla2x00t/qla2x00-target/AskingQuestions 2008-06-26 11:52:09 UTC (rev 421) +++ trunk/qla2x00t/qla2x00-target/AskingQuestions 2008-06-26 16:35:10 UTC (rev 422) @@ -313,4 +313,7 @@ Also it is very desirable if you attach to your question full kernel log from target since it's booted. +If you experience kernel crash, hang, etc., you should follow +REPORTING-BUGS file from your kernel source tree. + Vladislav Bolkhovitin <vs...@vl...>, http://scst.sourceforge.net Modified: trunk/qla2x00t/qla2x00-target/README =================================================================== --- trunk/qla2x00t/qla2x00-target/README 2008-06-26 11:52:09 UTC (rev 421) +++ trunk/qla2x00t/qla2x00-target/README 2008-06-26 16:35:10 UTC (rev 422) @@ -13,7 +13,7 @@ only. Mode, when a host acts as the initiator and the target simultaneously, is supported as well. -This version is compatible with SCST version 1.0.0 and higher. +This version is compatible with SCST core version 1.0.0 and higher. The original initiator driver was taken from the kernel 2.6.17.8. @@ -62,12 +62,18 @@ /lib/modules/`you_kernel_version`/extra. To uninstall it, type 'make uninstall'. -After the drivers are loaded, 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: +After the drivers are loaded and adapters successfully initialized by +the initiator driver, including firmware image load, 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 +Then you should configure exported devices using the corresponding +interface of SCST core. It is highly recommended to use scstadmin +utility for that purpose. + Compilation options ------------------- Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c =================================================================== --- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2008-06-26 11:52:09 UTC (rev 421) +++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2008-06-26 16:35:10 UTC (rev 422) @@ -176,7 +176,7 @@ /* ha->hardware_lock supposed to be held on entry */ static void __q2t_send_notify_ack(scsi_qla_host_t *ha, uint16_t target_id, uint16_t status, uint16_t task_flags, - uint16_t seq_id, uint32_t add_flags, uint16_t resp_code, + uint16_t seq_id, uint32_t add_flags, uint16_t resp_code, int resp_code_valid, uint16_t ox_id) { nack_entry_t *ntfy; Modified: trunk/scst/AskingQuestions =================================================================== --- trunk/scst/AskingQuestions 2008-06-26 11:52:09 UTC (rev 421) +++ trunk/scst/AskingQuestions 2008-06-26 16:35:10 UTC (rev 422) @@ -313,4 +313,7 @@ Also it is very desirable if you attach to your question full kernel log from target since it's booted. +If you experience kernel crash, hang, etc., you should follow +REPORTING-BUGS file from your kernel source tree. + Vladislav Bolkhovitin <vs...@vl...>, http://scst.sourceforge.net Modified: trunk/scst/README =================================================================== --- trunk/scst/README 2008-06-26 11:52:09 UTC (rev 421) +++ trunk/scst/README 2008-06-26 16:35:10 UTC (rev 422) @@ -95,6 +95,9 @@ are seen remotely. There must be LUN 0 in each security group, i.e. LUs numeration must not start from, e.g., 1. +It is highly recommended to use scstadmin utility for configuring +devices and security groups. + If you experience problems during modules load or running, check your kernel logs (or run dmesg command for the few most recent messages). @@ -343,19 +346,23 @@ ------------------------------------------------------ Access and devices visibility management allows for an initiator or -group of initiators to have different limited set of LUs/LUNs (security -group) each with appropriate access permissions. Initiator is -represented as a SCST session. Session is bound to security group on its -registration time by character "name" parameter of the registration -function, which provided by target driver, based on its internal -authentication. For example, for FC "name" could be WWN or just loop ID. -For iSCSI this could be iSCSI login credentials or iSCSI initiator name. -Each security group has set of names assigned to it by system -administrator. Session is bound to security group with provided name. If -no such groups found, the session bound to either "Default_target_name", -or "Default" group, depending from either "Default_target_name" exists -or not. In "Default_target_name" target name means name of the target. +group of initiators to have different views of LUs/LUNs (security groups) +each with appropriate access permissions. It is highly recommended to +use scstadmin utility for that purpose instead of described in this +section low level interface. +Initiator is represented as an SCST session. The session is bound to +security group on its registration time by character "name" parameter of +the registration function, which provided by target driver, based on its +internal authentication. For example, for FC "name" could be WWN or just +loop ID. For iSCSI this could be iSCSI login credentials or iSCSI +initiator name. Each security group has set of names assigned to it by +system administrator. Session is bound to security group with provided +name. If no such groups found, the session bound to either +"Default_target_name", or "Default" group, depending from either +"Default_target_name" exists or not. In "Default_target_name" target +name means name of the target. + In /proc/scsi_tgt each group represented as "groups/GROUP_NAME/" subdirectory. In it there are files "devices" and "names". File "devices" lists all devices and their LUNs in the group, file "names" Modified: trunk/scst/src/scst_main.c =================================================================== --- trunk/scst/src/scst_main.c 2008-06-26 11:52:09 UTC (rev 421) +++ trunk/scst/src/scst_main.c 2008-06-26 16:35:10 UTC (rev 422) @@ -497,15 +497,19 @@ * reference counting? That would mean to switch off from lockless * implementation of scst_translate_lun().. ) */ - PRINT_INFO("Waiting for %d active commands to complete... This might " - "take few minutes for disks or few hours for tapes, if you " - "use long executed commands, like REWIND or FORMAT. In case, " - "if you have a hung user space device (i.e. made using " - "scst_user module) not responding to any commands, if might " - "take virtually forever until the corresponding user space " - "program recovers and starts responding or gets killed.", - atomic_read(&scst_cmd_count)); + if (atomic_read(&scst_cmd_count) != 0) { + PRINT_INFO("Waiting for %d active commands to complete... This " + "might take few minutes for disks or few hours for " + "tapes, if you use long executed commands, like " + "REWIND or FORMAT. In case, if you have a hung user " + "space device (i.e. made using scst_user module) not " + "responding to any commands, if might take virtually " + "forever until the corresponding user space " + "program recovers and starts responding or gets " + "killed.", atomic_read(&scst_cmd_count)); + } + res = scst_susp_wait(interruptible); if (res != 0) goto out_clear; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-06-30 09:58:23
|
Revision: 425 http://scst.svn.sourceforge.net/scst/?rev=425&view=rev Author: vlnb Date: 2008-06-30 02:50:27 -0700 (Mon, 30 Jun 2008) Log Message: ----------- Fixes few harmless issues: 1. The #define on line 228 of iscsi-scst/usr/isns.c triggers a compiler warning on ppc. 2. make iscsi && sudo make iscsi_install triggers the following error message (2.6.22.17 kernel, ppc), but doesn't break installation: ... install: cannot stat `usr/iscsi-scst-adm': No such file or directory ... 3. Unneeded "unlikely" removed Issues 1 and 2 reported by Bart Van Assche <bar...@gm...> Modified Paths: -------------- trunk/iscsi-scst/Makefile trunk/iscsi-scst/usr/isns.c trunk/scst/src/scst_lib.c Modified: trunk/iscsi-scst/Makefile =================================================================== --- trunk/iscsi-scst/Makefile 2008-06-30 09:38:39 UTC (rev 424) +++ trunk/iscsi-scst/Makefile 2008-06-30 09:50:27 UTC (rev 425) @@ -35,7 +35,7 @@ install: all @install -vD usr/iscsi-scstd $(DISTDIR)/usr/local/sbin/iscsi-scstd - -@install -vD usr/iscsi-scst-adm $(DISTDIR)/usr/local/sbin/iscsi-scst-adm +# -@install -vD usr/iscsi-scst-adm $(DISTDIR)/usr/local/sbin/iscsi-scst-adm if [ -f /etc/debian_version ]; then \ install -vD -m 755 etc/initd/initd.debian $(DISTDIR)/etc/init.d/iscsi-scst; \ elif [ -f /etc/redhat-release ]; then \ Modified: trunk/iscsi-scst/usr/isns.c =================================================================== --- trunk/iscsi-scst/usr/isns.c 2008-06-30 09:38:39 UTC (rev 424) +++ trunk/iscsi-scst/usr/isns.c 2008-06-30 09:50:27 UTC (rev 425) @@ -216,7 +216,7 @@ } #if __BYTE_ORDER == __LITTLE_ENDIAN -#define set_scn_flag(x) \ +#define correct_scn_flag_endiannes(x) \ { \ x = (x & 0x55555555) << 1 | (x & 0xaaaaaaaa) >> 1; \ x = (x & 0x33333333) << 2 | (x & 0xcccccccc) >> 2; \ @@ -225,7 +225,7 @@ x = (x & 0x0000ffff) << 16 | (x & 0xffff0000) >> 16; \ } #else -#define set_scn_flag(x) (x) +#define correct_scn_flag_endiannes(x) { } #endif static int isns_scn_register(void) @@ -258,7 +258,7 @@ scn_flags = ISNS_SCN_FLAG_INITIATOR | ISNS_SCN_FLAG_OBJECT_REMOVE | ISNS_SCN_FLAG_OBJECT_ADDED | ISNS_SCN_FLAG_OBJECT_UPDATED; - set_scn_flag(scn_flags); + correct_scn_flag_endiannes(scn_flags); scn_flags = htonl(scn_flags); length += isns_tlv_set(&tlv, ISNS_ATTR_ISCSI_SCN_BITMAP, Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2008-06-30 09:38:39 UTC (rev 424) +++ trunk/scst/src/scst_lib.c 2008-06-30 09:50:27 UTC (rev 425) @@ -1902,7 +1902,7 @@ cmd->op_flags = ptr->flags; res = (*ptr->get_trans_len)(cmd, ptr->off); - if (unlikely(cmd->bufflen == 0)) { + if (cmd->bufflen == 0) { /* * According to SPC bufflen 0 for data transfer commands isn't * an error, so we need to fix the transfer direction. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-07-07 18:00:34
|
Revision: 433 http://scst.svn.sourceforge.net/scst/?rev=433&view=rev Author: vlnb Date: 2008-07-07 11:00:32 -0700 (Mon, 07 Jul 2008) Log Message: ----------- - Version changed to 1.0.0 - Build configuration changed to "Release" - iscsi-scst-howto.txt added - ChangeLog's updated - Minor docs changes - scstadm_install and scstadm_uninstall main Makefile targets added Modified Paths: -------------- trunk/Makefile trunk/iscsi-scst/ChangeLog trunk/iscsi-scst/README trunk/iscsi-scst/kernel/Makefile trunk/qla2x00t/qla2x00-target/ChangeLog trunk/qla2x00t/qla2x00-target/Makefile trunk/qla2x00t/qla2x00-target/README trunk/qla2x00t/qla2x00-target/qla2x00t.c trunk/qla2x00t/qla2x00-target/qla2x00t.h trunk/scst/ChangeLog trunk/scst/README trunk/scst/include/scst.h trunk/scst/include/scst_user.h trunk/scst/src/Makefile trunk/scst/src/dev_handlers/Makefile trunk/usr/fileio/Makefile trunk/usr/fileio/README Added Paths: ----------- trunk/iscsi-scst/doc/iscsi-scst-howto.txt Modified: trunk/Makefile =================================================================== --- trunk/Makefile 2008-07-07 17:54:49 UTC (rev 432) +++ trunk/Makefile 2008-07-07 18:00:32 UTC (rev 433) @@ -20,6 +20,7 @@ #export KDIR=/usr/src/linux-2.6 SCST_DIR=scst +SCSTADM_DIR=scstadmin QLA_INI_DIR=qla2x00t QLA_DIR=qla2x00t/qla2x00-target QLA_ISP_DIR=qla_isp @@ -43,6 +44,9 @@ @echo " scst_install : scst: install" @echo " scst_uninstall : scst: uninstall" @echo "" + @echo " scstadm_install : scstadmin: install" + @echo " scstadm_uninstall : scstadmin: uninstall" + @echo "" @echo " qla : make QLA target driver" @echo " qla_clean : 2.6 qla target: clean " @echo " qla_extraclean : 2.6 qla target: clean + clean dependencies" @@ -149,6 +153,12 @@ scst_extraclean: cd $(SCST_DIR) && $(MAKE) extraclean +scstadm_install: + cd $(SCSTADM_DIR) && $(MAKE) install + +scstadm_uninstall: + cd $(SCSTADM_DIR) && $(MAKE) uninstall + qla: cd $(QLA_DIR) && $(MAKE) @@ -275,5 +285,6 @@ lsi lsi_install lsi_uninstall lsi_clean lsi_extraclean \ iscsi iscsi_install iscsi_uninstall iscsi_clean iscsi_extraclean \ scst scst_install scst_uninstall scst_clean scst_extraclean \ + scstadm_install scstadm_uninstall \ usr usr_install usr_uninstall usr_clean usr_extraclean \ debug2perf, debug2release, perf2debug, release2debug Modified: trunk/iscsi-scst/ChangeLog =================================================================== --- trunk/iscsi-scst/ChangeLog 2008-07-07 17:54:49 UTC (rev 432) +++ trunk/iscsi-scst/ChangeLog 2008-07-07 18:00:32 UTC (rev 433) @@ -34,5 +34,13 @@ were relaced by the proper handling. Hovewer, there is a plenty of work in this area left, IET is known to have a lot of weaknesses here. + - Task management made more robust. Particularly, possible data + corruption scenarios were fixed. + + - Implemented SN based iSCSI IO flow control + + - Response data send timeout implemented: now if initiator doesn't + accept data for too long (30 sec), target closes connection + - A lot of other bugfixes and code cleanups. Modified: trunk/iscsi-scst/README =================================================================== --- trunk/iscsi-scst/README 2008-07-07 17:54:49 UTC (rev 432) +++ trunk/iscsi-scst/README 2008-07-07 18:00:32 UTC (rev 433) @@ -1,8 +1,8 @@ iSCSI SCST target driver ======================== -Version 1.0.0/0.4.16r151, XX June 2008 --------------------------------------- +Version 1.0.0/0.4.16r155, 7 July 2008 +------------------------------------- This driver is a forked with all respects version of iSCSI Enterprise Target (IET) (http://iscsitarget.sourceforge.net/) with updates to work @@ -135,6 +135,25 @@ CAUTION: Working of target and initiator on the same host isn't ======== supported. See SCST README file for details. +Known issues +------------ + +Currently iscsi-scst-adm utility is broken, hence not built. But, in +contrast to IET, in iSCSI-SCST it isn't needed so much, since all +devices/LUNs management is done using SCST's /proc interface, e.g. using +scstadmin utility. What's remained for iscsi-scst-adm is manage of iSCSI +targets and their parameters. In case of changing any negotiable iSCSI +parameters renegotiation in all corresponding sessions is required by +iSCSI standard, i.e. they all must be restarted, which, basically, means +iSCSI-SCST restart. So, for parameters changing as well as for +adding/removing targets, the recommended way is to change +iscsi-scst.conf, then restart iSCSI-SCST. In contrast to IET, this +operation is safe. Also, as a side effect, your iscsi-scst.conf will +always be in sync with the running system. + +But, if you decide to fix iscsi-scst-adm, your patches will be +appreciated. + Compilation options ------------------- @@ -152,19 +171,6 @@ - DEBUG_DIGEST_FAILURES - simulates digest failures in random places. -Known issues ------------- - -Currently some iscsi-scst-adm functionality is broken. But, from one -side, at the moment I don't have time to look at it and, from other -side, in contrast to IET, in iSCSI-SCST this utility doesn't worth much, -since all devices management is done using SCST's /proc interface. -What's remained for iscsi-scst-adm is managing iSCSI targets and their -parameters, but in any case changing of any negotiable iSCSI parameter -needs renegotiation, i.e. the corresponding session restart, i.e. -iSCSI-SCST restart. But, if you decide to fix iscsi-scst-adm, I will -appreciate your patches. - Creating version of put_page_callback patch for your kernel ----------------------------------------------------------- @@ -174,7 +180,7 @@ how it works, you only need to do the following two steps: 1. Apply the closest version of put_page_callback-<kernel-version>.patch -on your kernel. Resolve only failed hanks from include/ and +on your kernel. Resolve only failed hunks from include/ and net/core/utils.c, ignore other failures. 2. Search net/ in your kernel source for "put_page" and "get_page" Added: trunk/iscsi-scst/doc/iscsi-scst-howto.txt =================================================================== --- trunk/iscsi-scst/doc/iscsi-scst-howto.txt (rev 0) +++ trunk/iscsi-scst/doc/iscsi-scst-howto.txt 2008-07-07 18:00:32 UTC (rev 433) @@ -0,0 +1,241 @@ +How to set up iSCSI-SCST using scstadmin. + +1. Download, build and install iSCSI-SCST. + +Download the source code: + +Released version from http://sourceforge.net/project/showfiles.php?group_id=110471 + +or the latest development version by command: + +svn co https://scst.svn.sourceforge.net/svnroot/scst/trunk + +You need to patch the kernel and rebuild it. Only vanilla kernels from +kernel.org are officially supported, but in most cases your favorite +kernel will work fine as well. Select the patch according to your kernel +version (2.6.18.1 in the example below): + +cd /usr/src/kernels/linux-2.6.18.1 +patch -p1 < /home/erezz/work/scst/iscsi-scst/kernel/patches/put_page_callback-2.6.18.1.patch +patch -p1 < /home/erezz/work/scst/scst/kernel/scst_exec_req_fifo-2.6.18.patch +make clean + +Then, build the kernel (i.e. make, make modules_install, make install) +and restart the machine. + +In order to build and install SCST and iSCSI, run + +make scst scst_install iscsi iscsi_install + +ISCSI-SCST includes the following components: + * /etc/init.d/iscsi-scst - service script + * iscsi-scstd - daemon + * iscsi-scst-adm - admin tool (not built in 1.0.0) + * man pages + * Configuration files (located under iscsi-scst/etc/, need to be copied to /etc if you want to use them): + * initiators.allow - used for assigning specific initiators to targets + * initiators.deny - used for assigning specific initiators to targets + * iscsi-scstd.conf - list of targets and their properties + +2. Set up /etc/iscsi/ininitiatorname.iscsi. The most convenient way to +set up this file is to install the open-iscsi package provided by your +Linux distro first and then to run the bash commands shown below. +Verify the contents of the generated file. + /etc/init.d/open-iscsi stop + { echo "InitiatorName=$(/usr/sbin/iscsi-iname)"; echo "InitiatorAlias=$(hostname)"; } >/etc/iscsi/initiatorname.iscsi + /etc/init.d/open-iscsi start + +3. Set up /etc/iscsi-scstd.conf, e.g. by running the following shell commands: + cat <<EOF >/etc/iscsi-scstd.conf + Target $(sed -n 's/InitiatorName=//p' /etc/iscsi/initiatorname.iscsi):storage + EOF + +4. Set up /etc/scst.conf. The bash statements shown below set up a +configuration file for two vdisks. Replace the device names in the +array 'disk' by those that apply to your system: + { + echo "[HANDLER vdisk]" + echo "#DEVICE <vdisk name>,<device path>,<options>,<block size>" + disk=(/dev/md733 /dev/md734) + for ((i=0;i<${#disk[*]};i++)) + do + echo "DEVICE vdisk$i,${disk[$i]},NV_CACHE,512" + done + echo "[ASSIGNMENT Default]" + echo "#DEVICE <device name>,<lun>" + for ((i=0;i<${#disk[*]};i++)) + do + echo "DEVICE vdisk$i,$i" + done + } > /etc/scst.conf + +Note, that you must have LUN 0. That's a SCSI requirement (documented in SCST's README). + +5. Install scstadmin: + cd scstadmin-x.y.z + make install + +6. Edit /etc/init.d/scst: remove the modules you do not need from the +SCST_MODULES variable, e.g. qla2x00tgt. + +6. Create soft links in /etc/init.d such that SCST starts up +automatically. Use either chkconfig or update-rc.d, depending on the +Linux distribution you are using. An example for Debian systems: + update-rc.d scst defaults + update-rc.d iscsi-scst defaults + +7. Restart SCST and iSCSI-SCST such that the new settings become effective: + /etc/init.d/iscsi-scst stop + /etc/init.d/scst stop + /etc/init.d/scst start + /etc/init.d/iscsi-scst start + + +How to install and use iSCSI-SCST without using scstadmin + +First, start scst_disk: modprobe scst_disk + +/etc/init.d/iscsi-scst can be used to start/stop/restart/check status. + +Selecting devices to be used by SCST. + +You can see the list of available devices: + +# cat /proc/scsi_tgt/scsi_tgt +Device (host:ch:id:lun or name) Device handler +0:0:0:0 dev_disk +1:0:0:0 dev_disk +3:0:0:0 dev_disk +3:0:0:1 dev_disk +3:0:0:2 dev_disk +3:0:0:3 dev_disk +3:0:0:4 dev_disk +3:0:0:5 dev_disk +3:0:0:6 dev_disk +3:0:0:7 dev_disk +2:0:0:0 none +4:0:0:0 none +4:0:0:5 dev_disk +4:0:0:6 dev_disk +4:0:0:7 dev_disk +4:0:0:8 dev_disk +4:0:0:9 dev_disk +4:0:1:0 dev_disk +4:0:1:1 dev_disk +4:0:1:2 dev_disk +4:0:1:3 dev_disk +4:0:1:4 dev_disk +5:0:0:0 none +5:0:0:5 dev_disk +5:0:0:6 dev_disk +5:0:0:7 dev_disk +5:0:0:8 dev_disk +5:0:0:9 dev_disk +5:0:1:0 dev_disk +5:0:1:1 dev_disk +5:0:1:2 dev_disk +5:0:1:3 dev_disk +5:0:1:4 dev_disk + +LUN masking. + +SCST defines security groups. For each group, you can add LUNs. + +If you want to have all LUNs available for all targets, just add them to +the "Default" group: + +# echo "add 5:0:0:8 0" >/proc/scsi_tgt/groups/Default/devices +# cat /proc/scsi_tgt/groups/Default/devices +Device (host:ch:id:lun or name) Virtual lun Options +5:0:0:8 0 + +Now, the LUN "5:0:0:8" was added to the "Default" group as LUN #0. + +Note, that you must have LUN 0. That's a SCSI requirement (documented in SCST's README). + +Defining LUN masking + +In order to associate specific LUNs with specific targets, do the following: + + * Create a group for the target: + +echo "add_group Default_iqn.2007-05.com.example:storage.iscsi-scst-1" >/proc/scsi_tgt/scsi_tgt + + * Add LUNs to the group: + +echo "add 4:0:0:8 0" > /proc/scsi_tgt/groups/Default_iqn.2007-05.com.example\:storage.iscsi-scst-1/devices + +This will assign the LUN "4:0:0:8" to the target iqn.2007-05.com.example:storage.iscsi-scst-1. +Again, you must have LUN 0 for each group. + +Deleting a LUN from a group + +Run the following command: + +echo "del 4:0:0:8 0" > /proc/scsi_tgt/groups/Default_iqn.2007-05.com.example\:storage.iscsi-scst-1/devices + +This will remove the LUN "4:0:0:8" from the target iqn.2007-05.com.example:storage.iscsi-scst-1. + +Deleting a group. + +Run the following command: + +echo "del_group Default_iqn.2007-05.com.example:storage.iscsi-scst-1" >/proc/scsi_tgt/scsi_tgt + +For more information about LUN masking, refer to SCST README, section +"Access and devices visibility management (LUN masking)". + +Creating targets using iscsi-scstd.conf. + +The easiest way to create targets is to define them in +/etc/iscsi-scstd.conf. An example can be found in etc/iscsi-scstd.conf. +You need to have this file under /etc/ before starting iSCSI-SCST. + +Assigning targets to specific initiators + +In order to assign targets to specific initiators, you need to have +/etc/initiators.allow and /etc/initiators.deny. You can find +example files in etc/initiators.allow and etc/initiators.deny. + +Note that all targets are allowed to all initiators by default, so if +you want to use /etc/initiators.allow, you will need to have +/etc/initiators.deny that looks like this: + +ALL ALL + +This will deny all initiators expect for those defined in /etc/initiators.allow. + +Useful examples of iscsi-scst-adm: + +Show a specific target: + +# iscsi-scst-adm --op show --tid=1 +QueuedCommands=0 + +Show the configured parameters for a specific target: + +# iscsi-scst-adm --op show --tid=1 --sid=0 +InitialR2T=No +ImmediateData= +MaxConnections=0 +MaxRecvDataSegmentLength=4269849632 +MaxXmitDataSegmentLength=10933 +MaxBurstLength=4294967295 +FirstBurstLength=32767 +DefaultTime2Wait=4203042 +DefaultTime2Retain=5 +MaxOutstandingR2T=0 +DataPDUInOrder=No +DataSequenceInOrder=Yes +ErrorRecoveryLevel=0 +HeaderDigest= +DataDigest=CRC32C +OFMarker= +IFMarker=No +OFMarkInt=Reject +IFMarkInt=Reject + + +Bart Van Assche +Erez Zilber +Vladislav Bolkhovitin Modified: trunk/iscsi-scst/kernel/Makefile =================================================================== --- trunk/iscsi-scst/kernel/Makefile 2008-07-07 17:54:49 UTC (rev 432) +++ trunk/iscsi-scst/kernel/Makefile 2008-07-07 18:00:32 UTC (rev 433) @@ -26,9 +26,9 @@ EXTRA_CFLAGS += -I$(src)/../include -I$(SCST_INC_DIR) # -Wextra -Wno-unused-parameter -EXTRA_CFLAGS += -DEXTRACHECKS -#EXTRA_CFLAGS += -DTRACING -EXTRA_CFLAGS += -DDEBUG -g +#EXTRA_CFLAGS += -DEXTRACHECKS +EXTRA_CFLAGS += -DTRACING +#EXTRA_CFLAGS += -DDEBUG -g #EXTRA_CFLAGS += -DDEBUG_DIGEST_FAILURES Modified: trunk/qla2x00t/qla2x00-target/ChangeLog =================================================================== --- trunk/qla2x00t/qla2x00-target/ChangeLog 2008-07-07 17:54:49 UTC (rev 432) +++ trunk/qla2x00t/qla2x00-target/ChangeLog 2008-07-07 18:00:32 UTC (rev 433) @@ -1,10 +1,31 @@ -Summary of changes between versions 0.9.5 and 0.9.6 +Summary of changes between versions 0.9.5 and 1.0.0 --------------------------------------------------- + - Fixed sg_tablesize in qla2x00t to be per target card, not global + + - Updated to work on 2.6.25.x + + - Updated to work on 2.6.24.x + + - Fixed possible crash if tgt module rmmod'ed under load + + - Fixed incorrect residual on internal BUSY replies + + - Updated to work on 2.6.23.x + + - Fixes a race, when an event comes on the driver unload, so DPC thread + will try to use already half destroyed data. + + - Fixed problem with SNS, not advertising target mode. + - Support for per-target default security groups added. - Updated to work on 2.6.22.x kernels. + - Updated to work on 2.6.21.x kernels. + + - Updated to work on 2.6.20.x kernels. + - Updated to work with SCST 0.9.6. - /proc support routines changed to work with seq_file interface. Modified: trunk/qla2x00t/qla2x00-target/Makefile =================================================================== --- trunk/qla2x00t/qla2x00-target/Makefile 2008-07-07 17:54:49 UTC (rev 432) +++ trunk/qla2x00t/qla2x00-target/Makefile 2008-07-07 18:00:32 UTC (rev 433) @@ -35,9 +35,9 @@ INSTALL_DIR := /lib/modules/$(shell uname -r)/extra -EXTRA_CFLAGS += -DEXTRACHECKS -#EXTRA_CFLAGS += -DTRACING -EXTRA_CFLAGS += -DDEBUG_TGT -g +#EXTRA_CFLAGS += -DEXTRACHECKS +EXTRA_CFLAGS += -DTRACING +#EXTRA_CFLAGS += -DDEBUG_TGT -g #EXTRA_CFLAGS += -DDEBUG_WORK_IN_THREAD ifeq ($(KVER),) Modified: trunk/qla2x00t/qla2x00-target/README =================================================================== --- trunk/qla2x00t/qla2x00-target/README 2008-07-07 17:54:49 UTC (rev 432) +++ trunk/qla2x00t/qla2x00-target/README 2008-07-07 18:00:32 UTC (rev 433) @@ -1,8 +1,8 @@ Target driver for Qlogic 2200/2300 Fibre Channel cards ====================================================== -Version 1.0.0, XX June 2008 ---------------------------- +Version 1.0.0, 7 July 2008 +-------------------------- This driver has all required features and looks to be quite stable (for beta) and useful. It consists from two parts: the target mode driver Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c =================================================================== --- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2008-07-07 17:54:49 UTC (rev 432) +++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2008-07-07 18:00:32 UTC (rev 433) @@ -5,7 +5,7 @@ * Copyright (C) 2004 - 2005 Leonid Stoljar * Copyright (C) 2006 Nathaniel Clark <na...@mi...> * - * Qlogic 2x00 SCSI target driver. + * QLogic 2x00 SCSI target driver. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.h =================================================================== --- trunk/qla2x00t/qla2x00-target/qla2x00t.h 2008-07-07 17:54:49 UTC (rev 432) +++ trunk/qla2x00t/qla2x00-target/qla2x00t.h 2008-07-07 18:00:32 UTC (rev 433) @@ -5,7 +5,7 @@ * Copyright (C) 2004 - 2005 Leonid Stoljar * Copyright (C) 2006 Nathaniel Clark <na...@mi...> * - * Qlogic 2x00 SCSI target driver. + * QLogic 2x00 SCSI target driver. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -37,8 +37,8 @@ /* Version numbers, the same as for the kernel */ #define Q2T_VERSION(a,b,c,d) (((a) << 030) + ((b) << 020) + (c) << 010 + (d)) -#define Q2T_VERSION_CODE Q2T_VERSION(0,9,6,0) -#define Q2T_VERSION_STRING "1.0.0-rc1" +#define Q2T_VERSION_CODE Q2T_VERSION(1,0,0,0) +#define Q2T_VERSION_STRING "1.0.0" #define Q2T_MAX_CDB_LEN 16 #define Q2T_TIMEOUT 10 /* in seconds */ Modified: trunk/scst/ChangeLog =================================================================== --- trunk/scst/ChangeLog 2008-07-07 17:54:49 UTC (rev 432) +++ trunk/scst/ChangeLog 2008-07-07 18:00:32 UTC (rev 433) @@ -1,6 +1,61 @@ -Summary of changes between versions 0.9.5 and 0.9.6 +Summary of changes between versions 0.9.5 and 1.0.0 --------------------------------------------------- + - Added per-device memory limit and new scst.ko module parameter scst_max_dev_cmd_mem + + - Sending REQUEST SENSE fixed + + - Fixed possible incorrect command's retry if double RESET UA is detected. + + - Fixed __exit misuse, when such functions called from __init functions. + + - "RECEIVE DIAGNOSTIC RESULTS" command handling fixed + + - Obtaining device queue parameters in scst_obtain_device_parameters() + changed to handle NOT READY sense + + - Added possibility to create virtual removable devices + + - Updated to work on 2.6.25.x + + - Fixed READ POSITION command handling + + - TM processing made independant from other TM commands (before it was serialized) + + - Sense buffer made dynamic + + - Clustering statistic added + + - Updated to work on 2.6.24.x + + - Version protection added + + - Processing latency measurement facility added + + - Sessions registration/unregistration made independant from other activities + + - Major performance improvements + + - Major task management handling improvements + + - Updated to work on 2.6.23.x + + - Switching between debug<->performance<->release builds added + + - scsi_tgt renamed to scst, scsi_tgt.h renamed to scst.h + + - Updated to work on 2.6.22.x + + - Semaphores converted to mutexes + + - 64-bit platform cleanups + + - Added limit on maximum queued on a device commands + + - Threads made per-device + + - User space device handler added + - New SGV cache low memory management backend with memory flow control facility was implemented, thanks to Krzysztof Blaszkowski. @@ -31,7 +86,7 @@ - Support for CPU cache flushing before doing DMA to target devices added. - - Various cleanups, bug fixes and improvements. + - A lot of cleanups, bug fixes and improvements. Summary of changes between versions 0.9.4 and 0.9.5 --------------------------------------------------- Modified: trunk/scst/README =================================================================== --- trunk/scst/README 2008-07-07 17:54:49 UTC (rev 432) +++ trunk/scst/README 2008-07-07 18:00:32 UTC (rev 433) @@ -1,8 +1,8 @@ Generic SCSI target mid-level for Linux (SCST) ============================================== -Version 1.0.0, XX June 2008 ---------------------------- +Version 1.0.0, 7 July 2008 +-------------------------- SCST is designed to provide unified, consistent interface between SCSI target drivers and Linux kernel and simplify target drivers development Modified: trunk/scst/include/scst.h =================================================================== --- trunk/scst/include/scst.h 2008-07-07 17:54:49 UTC (rev 432) +++ trunk/scst/include/scst.h 2008-07-07 18:00:32 UTC (rev 433) @@ -48,9 +48,9 @@ #endif /* Version numbers, the same as for the kernel */ -#define SCST_VERSION_CODE 0x00090601 +#define SCST_VERSION_CODE 0x01000000 #define SCST_VERSION(a, b, c, d) (((a) << 24) + ((b) << 16) + ((c) << 8) + d) -#define SCST_VERSION_STRING "1.0.0-rc2" +#define SCST_VERSION_STRING "1.0.0" #define SCST_INTERFACE_VERSION SCST_VERSION_STRING "$Revision$" SCST_CONST_VERSION /************************************************************* Modified: trunk/scst/include/scst_user.h =================================================================== --- trunk/scst/include/scst_user.h 2008-07-07 17:54:49 UTC (rev 432) +++ trunk/scst/include/scst_user.h 2008-07-07 18:00:32 UTC (rev 433) @@ -26,7 +26,7 @@ #define DEV_USER_NAME "scst_user" #define DEV_USER_PATH "/dev/" -#define DEV_USER_VERSION_NAME "1.0.0-rc2" +#define DEV_USER_VERSION_NAME "1.0.0" #define DEV_USER_VERSION DEV_USER_VERSION_NAME "$Revision$" SCST_CONST_VERSION /* Modified: trunk/scst/src/Makefile =================================================================== --- trunk/scst/src/Makefile 2008-07-07 17:54:49 UTC (rev 432) +++ trunk/scst/src/Makefile 2008-07-07 18:00:32 UTC (rev 433) @@ -115,7 +115,7 @@ #EXTRA_CFLAGS += -DSTRICT_SERIALIZING -EXTRA_CFLAGS += -DEXTRACHECKS +#EXTRA_CFLAGS += -DEXTRACHECKS #EXTRA_CFLAGS += -DUSE_EXPECTED_VALUES #EXTRA_CFLAGS += -DALLOW_PASSTHROUGH_IO_SUBMIT_IN_SIRQ @@ -123,9 +123,9 @@ #EXTRA_CFLAGS += -fno-inline -#EXTRA_CFLAGS += -DTRACING +EXTRA_CFLAGS += -DTRACING -EXTRA_CFLAGS += -DDEBUG -g +#EXTRA_CFLAGS += -DDEBUG -g #EXTRA_CFLAGS += -DDEBUG_TM -DTM_DBG_GO_OFFLINE=0 #EXTRA_CFLAGS += -DDEBUG_RETRY #EXTRA_CFLAGS += -DDEBUG_OOM Modified: trunk/scst/src/dev_handlers/Makefile =================================================================== --- trunk/scst/src/dev_handlers/Makefile 2008-07-07 17:54:49 UTC (rev 432) +++ trunk/scst/src/dev_handlers/Makefile 2008-07-07 18:00:32 UTC (rev 433) @@ -69,10 +69,10 @@ EXTRA_CFLAGS += -I$(SUBDIRS) -I$(SCST_INC_DIR) -Wextra -Wno-unused-parameter -EXTRA_CFLAGS += -DEXTRACHECKS +#EXTRA_CFLAGS += -DEXTRACHECKS -#EXTRA_CFLAGS += -DTRACING -EXTRA_CFLAGS += -DDEBUG -g +EXTRA_CFLAGS += -DTRACING +#EXTRA_CFLAGS += -DDEBUG -g clean: rm -f *.o *.ko .*.cmd *.mod.c .*.d .depend Modules.symvers \ Modified: trunk/usr/fileio/Makefile =================================================================== --- trunk/usr/fileio/Makefile 2008-07-07 17:54:49 UTC (rev 432) +++ trunk/usr/fileio/Makefile 2008-07-07 18:00:32 UTC (rev 433) @@ -29,9 +29,9 @@ PROGS = fileio_tgt LIBS = -lpthread -CFLAGS += -DEXTRACHECKS -#CFLAGS += -DTRACING -CFLAGS += -DDEBUG -g +#CFLAGS += -DEXTRACHECKS +CFLAGS += -DTRACING +#CFLAGS += -DDEBUG -g #CFLAGS += -DDEBUG_NOMEM #CFLAGS += -DDEBUG_SENSE Modified: trunk/usr/fileio/README =================================================================== --- trunk/usr/fileio/README 2008-07-07 17:54:49 UTC (rev 432) +++ trunk/usr/fileio/README 2008-07-07 18:00:32 UTC (rev 433) @@ -1,8 +1,8 @@ User space FILEIO handler ========================= -Version 1.0.0, XX June 2008 ---------------------------- +Version 1.0.0, 7 July 2008 +-------------------------- User space program fileio_tgt uses interface of SCST's scst_user dev handler as well as allows to see how it works in various modes. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-07-09 16:58:58
|
Revision: 443 http://scst.svn.sourceforge.net/scst/?rev=443&view=rev Author: vlnb Date: 2008-07-09 09:58:56 -0700 (Wed, 09 Jul 2008) Log Message: ----------- - Forgotten piece of changes for returning to the release mode - QLA_ISP targets in the main Makefile temporary disabled, since they don't support building with specified kernel version Modified Paths: -------------- trunk/Makefile trunk/iscsi-scst/Makefile trunk/qla2x00t/qla2x00-target/Makefile trunk/usr/fileio/Makefile Modified: trunk/Makefile =================================================================== --- trunk/Makefile 2008-07-09 16:44:01 UTC (rev 442) +++ trunk/Makefile 2008-07-09 16:58:56 UTC (rev 443) @@ -94,7 +94,7 @@ all: cd $(SCST_DIR) && $(MAKE) $@ @if [ -d $(QLA_DIR) ]; then cd $(QLA_DIR) && $(MAKE) $@; fi - @if [ -d $(QLA_ISP_DIR) ]; then cd $(QLA_ISP_DIR) && $(MAKE) $@; fi +# @if [ -d $(QLA_ISP_DIR) ]; then cd $(QLA_ISP_DIR) && $(MAKE) $@; fi # @if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi @if [ -d $(SRP_DIR) ]; then cd $(SRP_DIR) && $(MAKE) $@; fi @if [ -d $(ISCSI_DIR) ]; then cd $(ISCSI_DIR) && $(MAKE) $@; fi @@ -103,7 +103,7 @@ install: cd $(SCST_DIR) && $(MAKE) $@ @if [ -d $(QLA_DIR) ]; then cd $(QLA_DIR) && $(MAKE) $@; fi - @if [ -d $(QLA_ISP_DIR) ]; then cd $(QLA_ISP_DIR) && $(MAKE) $@; fi +# @if [ -d $(QLA_ISP_DIR) ]; then cd $(QLA_ISP_DIR) && $(MAKE) $@; fi # @if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi @if [ -d $(SRP_DIR) ]; then cd $(SRP_DIR) && $(MAKE) $@; fi @if [ -d $(ISCSI_DIR) ]; then cd $(ISCSI_DIR) && $(MAKE) DISTDIR=$(ISCSI_DISTDIR) $@; fi @@ -112,7 +112,7 @@ uninstall: cd $(SCST_DIR) && $(MAKE) $@ @if [ -d $(QLA_DIR) ]; then cd $(QLA_DIR) && $(MAKE) $@; fi - @if [ -d $(QLA_ISP_DIR) ]; then cd $(QLA_ISP_DIR) && $(MAKE) $@; fi +# @if [ -d $(QLA_ISP_DIR) ]; then cd $(QLA_ISP_DIR) && $(MAKE) $@; fi # @if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi @if [ -d $(SRP_DIR) ]; then cd $(SRP_DIR) && $(MAKE) $@; fi @if [ -d $(ISCSI_DIR) ]; then cd $(ISCSI_DIR) && $(MAKE) $@; fi @@ -122,7 +122,7 @@ cd $(SCST_DIR) && $(MAKE) $@ @if [ -d $(QLA_INI_DIR) ]; then cd $(QLA_INI_DIR) && $(MAKE) $@; fi @if [ -d $(QLA_DIR) ]; then cd $(QLA_DIR) && $(MAKE) $@; fi - @if [ -d $(QLA_ISP_DIR) ]; then cd $(QLA_ISP_DIR) && $(MAKE) $@; fi +# @if [ -d $(QLA_ISP_DIR) ]; then cd $(QLA_ISP_DIR) && $(MAKE) $@; fi # @if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi @if [ -d $(SRP_DIR) ]; then cd $(SRP_DIR) && $(MAKE) $@; fi @if [ -d $(ISCSI_DIR) ]; then cd $(ISCSI_DIR) && $(MAKE) $@; fi @@ -132,7 +132,7 @@ cd $(SCST_DIR) && $(MAKE) $@ @if [ -d $(QLA_INI_DIR) ]; then cd $(QLA_INI_DIR) && $(MAKE) $@; fi @if [ -d $(QLA_DIR) ]; then cd $(QLA_DIR) && $(MAKE) $@; fi - @if [ -d $(QLA_ISP_DIR) ]; then cd $(QLA_ISP_DIR) && $(MAKE) $@; fi +# @if [ -d $(QLA_ISP_DIR) ]; then cd $(QLA_ISP_DIR) && $(MAKE) $@; fi # @if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi @if [ -d $(SRP_DIR) ]; then cd $(SRP_DIR) && $(MAKE) $@; fi @if [ -d $(ISCSI_DIR) ]; then cd $(ISCSI_DIR) && $(MAKE) $@; fi Modified: trunk/iscsi-scst/Makefile =================================================================== --- trunk/iscsi-scst/Makefile 2008-07-09 16:44:01 UTC (rev 442) +++ trunk/iscsi-scst/Makefile 2008-07-09 16:58:56 UTC (rev 443) @@ -5,13 +5,13 @@ # removes any old dependencies. DON'T put your own dependencies here # unless it's something special (not a .c file). -SCST_INC_DIR := /usr/local/include/scst -#SCST_INC_DIR := $(SUBDIRS)/../../scst/include -SCST_DIR := $(SCST_INC_DIR) -#SCST_DIR := $(shell pwd)/../scst/src - SUBDIRS := $(shell pwd) +#SCST_INC_DIR := /usr/local/include/scst +SCST_INC_DIR := $(SUBDIRS)/../scst/include +#SCST_DIR := $(SCST_INC_DIR) +SCST_DIR := $(shell pwd)/../scst/src + ifeq ($(KVER),) ifeq ($(KDIR),) KVER = $(shell uname -r) Modified: trunk/qla2x00t/qla2x00-target/Makefile =================================================================== --- trunk/qla2x00t/qla2x00-target/Makefile 2008-07-09 16:44:01 UTC (rev 442) +++ trunk/qla2x00t/qla2x00-target/Makefile 2008-07-09 16:58:56 UTC (rev 443) @@ -26,10 +26,10 @@ # - install and uninstall must be made as root # -SCST_INC_DIR := /usr/local/include/scst -SCST_DIR := $(SCST_INC_DIR) -#SCST_INC_DIR := $(SUBDIRS)/../../scst/include -#SCST_DIR := $(shell pwd)/../../scst/src +#SCST_INC_DIR := /usr/local/include/scst +#SCST_DIR := $(SCST_INC_DIR) +SCST_INC_DIR := $(SUBDIRS)/../../scst/include +SCST_DIR := $(shell pwd)/../../scst/src EXTRA_CFLAGS += -I$(SCST_INC_DIR) -DFC_TARGET_SUPPORT Modified: trunk/usr/fileio/Makefile =================================================================== --- trunk/usr/fileio/Makefile 2008-07-09 16:44:01 UTC (rev 442) +++ trunk/usr/fileio/Makefile 2008-07-09 16:58:56 UTC (rev 443) @@ -20,8 +20,8 @@ #SRCS_C = #OBJS_C = $(SRCS_C:.c=.o) -#SCST_INC_DIR := ../../scst/include -SCST_INC_DIR := /usr/local/include/scst +SCST_INC_DIR := ../../scst/include +#SCST_INC_DIR := /usr/local/include/scst INSTALL_DIR := /usr/local/bin/scst CFLAGS += -O2 -Wall -Wextra -Wno-unused-parameter -Wstrict-prototypes \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-07-10 11:05:19
|
Revision: 454 http://scst.svn.sourceforge.net/scst/?rev=454&view=rev Author: vlnb Date: 2008-07-10 04:05:16 -0700 (Thu, 10 Jul 2008) Log Message: ----------- Fixed not clearly applied xxx2yyy Modified Paths: -------------- trunk/scst-full_perf.patch trunk/scst-release.patch Modified: trunk/scst-full_perf.patch =================================================================== --- trunk/scst-full_perf.patch 2008-07-10 10:49:06 UTC (rev 453) +++ trunk/scst-full_perf.patch 2008-07-10 11:05:16 UTC (rev 454) @@ -11,7 +11,7 @@ #EXTRA_CFLAGS += -DCONFIG_SCST_USE_EXPECTED_VALUES #EXTRA_CFLAGS += -DALLOW_PASSTHROUGH_IO_SUBMIT_IN_SIRQ -@@ -124,7 +124,7 @@ EXTRA_CFLAGS += -DCONFIG_SCST_EXTRACHECKS +@@ -125,7 +125,7 @@ EXTRA_CFLAGS += -DCONFIG_SCST_EXTRACHECKS #EXTRA_CFLAGS += -DCONFIG_SCST_TRACING Modified: trunk/scst-release.patch =================================================================== --- trunk/scst-release.patch 2008-07-10 10:49:06 UTC (rev 453) +++ trunk/scst-release.patch 2008-07-10 11:05:16 UTC (rev 454) @@ -11,7 +11,7 @@ #EXTRA_CFLAGS += -DCONFIG_SCST_USE_EXPECTED_VALUES #EXTRA_CFLAGS += -DALLOW_PASSTHROUGH_IO_SUBMIT_IN_SIRQ -@@ -122,9 +122,9 @@ EXTRA_CFLAGS += -DCONFIG_SCST_EXTRACHECKS +@@ -123,9 +123,9 @@ EXTRA_CFLAGS += -DCONFIG_SCST_EXTRACHECKS #EXTRA_CFLAGS += -fno-inline This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |