History log of /drivers/scsi/scsi_debug.c
Revision Date Author Comments
48a968763dba039972623caea2355fc573b559ba 14-Oct-2014 Rasmus Villemoes <linux@rasmusvillemoes.dk> scsi: replace strnicmp with strncasecmp

The kernel used to contain two functions for length-delimited,
case-insensitive string comparison, strnicmp with correct semantics and
a slightly buggy strncasecmp. The latter is the POSIX name, so strnicmp
was renamed to strncasecmp, and strnicmp made into a wrapper for the new
strncasecmp to avoid breaking existing users.

To allow the compat wrapper strnicmp to be removed at some point in the
future, and to avoid the extra indirection cost, do
s/strnicmp/strncasecmp/g.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
db525fce95f0ee39102f06f8599ced3f3f3af128 01-Sep-2014 Douglas Gilbert <dgilbert@interlog.com> scsi_debug: deadlock between completions and surprise module removal

A deadlock has been reported when the completion
of SCSI commands (simulated by a timer) was surprised
by a module removal. This patch removes one half of
the offending locks around timer deletions. This fix
is applied both to stop_all_queued() which is were
the deadlock was discovered and stop_queued_cmnd()
which has very similar logic.

This patch should be applied both to the lk 3.17 tree
and Christoph's drivers-for-3.18 tree.

Tested-and-reported-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
e46b0344be9b50e8254ddd74e3c5b439d5fca3ce 05-Aug-2014 Douglas Gilbert <dgilbert@interlog.com> scsi_debug: bump inquiry version to SPC-4, update version descriptors

Since a lot of functionality from SPC-4 is supported by this
driver (e.g. LBP and PI) then bump the default INQUIRY version
from SPC-3 to SPC-4. Also update the INQUIRY version
descriptors.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
cd62b7dae245dd3bb3a21eaadcf01d93ec4fcc7c 05-Aug-2014 Douglas Gilbert <dgilbert@interlog.com> scsi_debug: give unit attention and other errors precedence over TSF

Give existing errors priority over the generation of Task
Set Full (TSF) errors. So that max_queue is not exceeded,
existing errors may be sent back in the invocation thread.
This is done so errors like Unit Attentions are not hidden
and lost by either max_queue exceeded or real/injected
TSFs.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
01123ef4c3fc9b9ff3062df2e10dee9b139b46b4 05-Aug-2014 Douglas Gilbert <dgilbert@interlog.com> scsi_debug: scsi_cmnd->cmnd check and casts unnecessary

This patch removes a NULL check for the scsi_cmnd::cmnd pointer
since many other instances in this driver and elsewhere assume
it is valid. Also redundant casts to 'unsigned char *' are removed
as the pointer has that type.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
cbf67842c3d9e7af8ccc031332b79e88d9cca592 26-Jul-2014 Douglas Gilbert <dgilbert@interlog.com> scsi_debug: support scsi-mq, queues and locks

- add host_lock option whose default value is 0 which removes the
host_lock around all queued commands
- accept delay=-1 (_hi_) or -2 which use a tasklet to invoke
the scsi_done callback into the mid-layer. The default
is still delay=1 which uses a timer to delay 1 jiffy
- wire .change_queue_depth and .change_queue_type
functions to better simulate queueing in a modern LLD
- add SCSI_DEBUG_OPT_Q_NOISE (0x200) mask to only produce
debug output associated with queue full, plus from
.change_queue_depth and .change_queue_type functions
- add SCSI_DEBUG_OPT_ALL_TSF (0x400) mask which reports
all queued_arr fulls at TASK_SET_FULL, otherwise
SCSI_MLQUEUE_HOST_BUSY is returned
- add SCSI_DEBUG_OPT_RARE_TSF (0x800) mask which works
together with the every_nth option (> 0) to count
occurrences of num_in_q==queue_depth. When every_nth
is reached the victim (a command) yields TASK SET FULL
- clean up many debug messages.
- add ndelay=<nanosecs> option that uses high resolution
timers; active if > 0 and then overrides delay= option
- expand Unit Attention handling: POR, BUS_RESET and
MODE PARAMETERS CHANGED
- support .eh_target_reset_handler and drop .bios_param
- add OPT_N_WCE mask so caching page yields WCE=0
- add OPT_RESET_NOISE mask to log aborts and resets
- add OPT_NO_CDB_NOISE mask to not log each cdb
- MODE SELECT support for changing caching page's WCE
- name common ioctls in log
- when fake_rw=1, do not vmalloc fake store; make
UNMAP and WRITE SAME obey fake_rw
- more logging and code improvements including better
sense buffer handling

With fio and four (pseudo) devices I have observed 1.2 M IOPS
on my equipment. Rob Elliott who has done much testing and made
numerous suggestions, has better IOPS results than mine.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Robert Elliott <elliott@hp.com>
Tested-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9cb78c16f5dadefd8dc5ba0ae5a2f26cd59419b3 25-Jun-2014 Hannes Reinecke <hare@suse.de> scsi: use 64-bit LUNs

The SCSI standard defines 64-bit values for LUNs, and large arrays
employing large or hierarchical LUN numbers become more and more
common.

So update the linux SCSI stack to use 64-bit LUN numbers.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@infradead.org>
Reviewed-by: Ewan Milne <emilne@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
6bb5e6e772f5f71413e290eb9c6a475e9a6d39e2 02-Jun-2014 Akinobu Mita <akinobu.mita@gmail.com> scsi_debug: allow huge transfer length for read/write commands

This change enables to test read/write commands with huge transfer
length such as 1GB. For example:

# modprobe scsi_debug dev_size_mb=1024 clustering=1 opts=1
# cat /sys/block/$DEV/queue/max_hw_sectors_kb > \
/sys/block/$DEV/queue/max_sectors_kb
# fio --name=test --rw=write --bs=1g --size=1g --filename=/dev/$DEV \
--mem=mmaphuge --direct=1

The data type of max_sectors in scsi_host_template has been extended
to unsigned int by the previous change. So we can increase it from
0xffff to 0xffffffff to allow such huge transfer length.

Also, this increases sg_tablesize and max_segment_size, otherwise the
maximum transfer length is limited to 64MB.
(sg_tablesize * max_segment_size = 256 * 256KB)

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
b57d7c015dd0a77589030e18fca887b624ae9013 01-May-2014 Christoph Hellwig <hch@lst.de> scsi_debug: simple short transfer injection

Add an option to only transfer half the data for every n-th command.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Nicholas Bellinger <nab@linux-iscsi.org>
0759c666a39f16ab3a42d37b1e8fb0f246f97f52 26-Feb-2014 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: add ability to enable clustering

This adds a module parameter to enable clustering.

Without enabling clustering support, the transfer length for read and
write scsi commands is limited upto 8MB when page size is 4KB and
sg_tablesize is 2048 (= SCSI_MAX_SG_CHAIN_SEGMENTS). I would like to
test commands with more than that transfer length.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
6c78cc06583344244628bf29aa5b5fe43ff5d04e 26-Feb-2014 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: protect device access with atomic_rw lock

This change ensures that concurrent device access including ramdisk
storage, protection info, and provisioning map by read, write, and
unmap commands are protected with atomic_rw spinlock.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
be4e11be99dbb36308760595ee848ef51713b4b0 26-Feb-2014 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: prepare to enable clustering

Currently, clustering support for scsi_debug is disabled. This is
because there are for_each_sg() loops which assume that each sg list
element is consisted with a single page. But enabling clustering
support, each sg list element for scsi commands can be consisted with
multiple pages.

This replaces these for_each_sg() loops with sg mapping iterator which
is capable of handling each sg list element is consisted with multiple
pages.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
c5af0db96b7c219245f4985314e11c7e716e82ae 26-Feb-2014 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: fix resp_xdwriteread() return value when running out of memory

When resp_xdwriteread() can't allocate temporary buffer, it returns -1.
But the return value is used as scsi status code and -1 is not
interpreted as correct code.

target_core_mod has similar xdwriteread emulation code. So this mimics
what target_core_mod does for xdwriteread when running out of memory.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
c613d061ce01be1f4e195f4666d4a99e5284cb5d 26-Feb-2014 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: fix duplicate dif_errors increment

It is unnecessary to increase dif_errors in dif_verify(), because the
caller will increment it when dif_verify() detects failure.

This bug was introduced by commit beb40ea42bd6 ("[SCSI] scsi_debug:
reduce duplication between prot_verify_read and prot_verify_write")

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
11ddceca99ae9a3e124b91dfe9c5342ee09f376d 26-Feb-2014 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: make pseudo_primary static

As pseudo_primary is only used in scsi_debug.c, it should be static.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
c45eabec08776d462c34802d3e5bad295bda628e 26-Feb-2014 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: fix false positive logical block reference tag check fail

Reading partially unwritten sectors generates a false positive logical
block reference tag check failure when DIF is enabled.

This bug is caused by missing ei_lba increment in loop of dif_verify()
when unwritten sector is skipped.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
8206937916bce22e79531f1eb2c54947ea3276a1 14-Oct-2013 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: simplify creation and destruction of driver attribute files

Instead of repeatedly calling driver_create_file() to create driver
attribute files, This achieves the same thing by constructing an array
of driver_attribute and setting it to bus_type->drv_groups.

This change simplifies both creation and destruction of the attribute
files, and also removes sparse warning caused by driver_attributes which
are unnecessarily declared as global.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
51d648af5892219cbe97305efb300d3e56746591 18-Sep-2013 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: fix sparse warnings related to data integrity field

Each member in data integrity field tuple is big-endian. But the
endianness of the values being compared with these members are not
annotated. So this fixes these sparse warnings.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
68aee7ba66d390abf48c13791a84f6bce29d6f19 18-Sep-2013 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: fix invalid value check for guard module parameter

In the module initialization, invalid value for guard module parameter
is detected by the following check:

if (scsi_debug_guard > 1) {
printk(KERN_ERR "scsi_debug_init: guard must be 0 or 1\n");
return -EINVAL;
}

But this check isn't enough, because the type of scsi_debug_guard is
'int' and scsi_debug_guard could be a negative value.

This fixes it by changing the type of scsi_debug_guard to 'unsigned int'
instead of adding extra check for a negative value.

Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
65f72f2a2fe89f072d6a88e5cd69a64270b9c436 18-Sep-2013 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: avoid partial copying PI from prot_sglist to dif_storep

If data integrity support is enabled, prot_verify_write() is called in
response to WRITE commands and it verifies protection info from
prot_sglist by comparing against data sglist, and copies protection info
to dif_storep.

When multiple blocks are transfered by a WRITE command, it verifies and
copies these blocks one by one. So if it fails to verify protection
info in the middle of blocks, the actual data transfer to fake_storep
isn't proceeded at all although protection info for some blocks are
already copied to dif_storep. Therefore, it breaks the data integrity
between fake_storep and dif_storep.

This fixes it by ensuring that copying protection info to dif_storep is
done after all blocks are successfully verified. Reusing dif_copy_prot()
with supporting the opposite direction simplifies this fix.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
bb8c063c6afcd930b8da944927144f2982609638 18-Sep-2013 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: factor out copying PI from dif_storep to prot_sglist

If data integrity support is enabled, prot_verify_read() is called in
response to READ commands and it verifies protection info from dif_storep
by comparing against fake_storep, and copies protection info to
prot_sglist.

This factors out the portion of copying protection info into a separate
function. It will also be reused in the next change after supporting
the opposite direction (copying prot_sglist to dif_storep).

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
14faa944b6fa4c77a6f386806c33ce2c3c77b3a4 18-Sep-2013 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: fix buffer overrun when DIF/DIX is enabled and virtual_gb > 0

If the module parameter virtual_gb is greater than 0, the READ command
may request the blocks which exceed actual ramdisk storage (fake_storep).
prot_verify_read() should treat those blocks as wrap around the end of
fake_storep. But it actually causes fake_storep and dif_storep buffer
overruns.

This fixes these buffer overruns. In order to simplify the fix,
this also introduces fake_store() and dif_store() which return
corresponding wrap around addresses.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
a027b5b90eb6b5ec5c5890a5e4e198f458ae94cb 26-Aug-2013 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: fix logical block provisioning support when unmap_alignment != 0

Commit b90ebc3d5c41c9164ae04efd2e4f8204c2a186f1 ("[SCSI] scsi_debug:
fix logical block provisioning support") fixed several issues with
logical block provisioning support, but it still doesn't properly fix
the cases when unmap_alignment > 0.

For example, load scsi_debug module with the following module parameters
and make all blocks mapped by filling the storage with zero.

# modprobe scsi_debug lbpu=1 unmap_alignment=1 unmap_granularity=4
# dd if=/dev/zero of=$DEV

Then, try to unmap the first unmappable blocks at lba=1, but GET LBA STATUS
unexpectedly reports that the last UNMAP has done nothing.

# sg_unmap --lba=1 --num=4 $DEV
# sg_get_lba_status --lba=1 $DEV
descriptor LBA: 0x0000000000000001 blocks: 16383 mapped

The problem is in map_index_to_lba(), which should return the first
LBA which is corresponding to a given index of provisioning map
(map_storep).

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: "Martin K. Petersen" <martin.petersen@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
150c3544b1d317fe32b1f279917c08638dad363f 26-Aug-2013 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: fix endianness bug in sdebug_build_parts()

With module parameter num_parts > 0, partition table is built on the
ramdisk storage when loading the driver. Unfortunately, there is an
endianness bug in sdebug_build_parts(). So the partition table is not
correctly initialized on big-endian systems.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Tested-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
a451751172b39702e94c683882ab01d816b673c7 09-Jul-2013 Akinobu Mita <akinobu.mita@gmail.com> scsi_debug: fix do_device_access() with wrap around range

do_device_access() is a function that abstracts copying SG list from/to
ramdisk storage (fake_storep).

It must deal with the ranges exceeding actual fake_storep size, because
such ranges are valid if virtual_gb is set greater than zero, and they
should be treated as fake_storep is repeatedly mirrored up to virtual
size.

Unfortunately, it can't deal with the range which wraps around the end of
fake_storep. A wrap around range is copied by two
sg_copy_{from,to}_buffer() calls, but sg_copy_{from,to}_buffer() can't
copy from/to in the middle of SG list, therefore the second call can't
copy correctly.

This fixes it by using sg_pcopy_{from,to}_buffer() that can copy from/to
the middle of SG list.

This also simplifies the assignment of sdb->resid in
fill_from_dev_buffer(). Because fill_from_dev_buffer() is now only called
once per command execution cycle. So it is not necessary to take care to
decrease sdb->resid if fill_from_dev_buffer() is called more than once.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: Douglas Gilbert <dgilbert@interlog.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Horia Geanta <horia.geanta@freescale.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
beb40ea42bd65511bc275a7d58d3753835906be5 29-Jun-2013 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: reduce duplication between prot_verify_read and prot_verify_write

In order to reduce code duplication between prot_verify_read() and
prot_verify_write(), this moves common code into the new functions.

[jejb: fix unitialised variable warning]
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Acked-by: "Martin K. Petersen" <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
e18d8bea33077d259cc826c6d3fa76d36af61876 29-Jun-2013 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: simplify offset calculation for dif_storep

dif_storep is declared as pointer to unsigned char type. But it is
actually used to store vmalloced array of struct sd_dif_tuple.

This changes the type of dif_storep to the pointer to struct sd_dif_tuple.
It simplifies offset calculation for dif_storep and enables to remove
hardcoded size of struct sd_dif_tuple.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Acked-by: "Martin K. Petersen" <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
e9926b4376544d5a2dc4d310d4d0006c634b1a93 29-Jun-2013 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: invalidate protection info for unmapped region

When UNMAP command is issued with the data integrity support enabled,
the protection info for the unmapped region is remain unchanged.
So READ command for the region later on causes data integrity failure.

This fixes it by invalidating protection info for the unmapped region
by filling with 0xff pattern.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Acked-by: "Martin K. Petersen" <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
7cb69d0397233546d82191e524235fdb9d1d91aa 29-Jun-2013 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: fix NULL pointer dereference with parameters dif=0 dix=1

The protection info dif_storep is allocated only when parameter dif is
not zero. But it will be accessed when reading or writing to the storage
installed with parameter dix is not zero.

So kernel crashes if scsi_debug module is loaded with parameters dix=1 and
dif=0.

This fixes it by making dif_storep available if parameter dix is not zero
instead of checking if parameter dif is not zero.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Acked-by: "Martin K. Petersen" <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
fc3fc352b6e7a6452596f8a13cedeaa6bcfe9689 29-Jun-2013 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: fix incorrectly nested kmap_atomic()

In the function prot_verify_write(), kmap_atomic()/kunmap_atomic() for
data page and kmap_atomic()/kunmap_atomic() for protection information
page are not nested each other.

It worked perfectly before commit 3e4d3af501cccdc8a8cca41bdbe57d54ad7e7e73
("mm: stack based kmap_atomic()"). Because the kmap_atomic slot KM_IRQ0
was used for data page and the slot KM_IRQ1 was used for protection page.

But KM_types are gone and kmap_atomic() is using stack based implementation.
So two different kmap_atomic() usages must be strictly nested now.

This change ensures kmap_atomic() usage is strictly nested.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Acked-by: "Martin K. Petersen" <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
518d9df87105a078984c90c75cf6e7f67e3c928c 29-Jun-2013 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: fix invalid address passed to kunmap_atomic()

In the function prot_verify_write(), the kmap address 'daddr' is
incremented in the loop for each data page. Finally 'daddr' reaches
the next page boundary in the end of the loop, and the invalid address
is passed to kunmap_atomic().

Fix the issue by not incrementing 'daddr' in the loop and offsetting it
by the loop counter on demand.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Acked-by: "Martin K. Petersen" <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
b90ebc3d5c41c9164ae04efd2e4f8204c2a186f1 16-Apr-2013 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: fix logical block provisioning support

provisioning map (map_storep) is a bitmap accessed by bitops.

So the allocation size should be a multiple of sizeof(unsigned long) and
also the bitmap should be cleared by using bitmap_clear() instead of
memset().

Otherwise it will cause problem on big-endian architecture if the number of
bits is not a multiple of BITS_PER_LONG.

I tried testing the logical block provisioning support in scsi_debug,
but it didn't work as I expected.

For example, load scsi_debug module with UNMAP command supported
and fill the storage with random data.

# modprobe scsi_debug lbpu=1
# dd if=/dev/urandom of=/dev/sdb

Then, try to unmap LBA 0, but Get LBA status reports:

# sg_unmap --lba=0 --num=1 /dev/sdb
# sg_get_lba_status --lba=0 /dev/sdb
descriptor LBA: 0x0000000000000000 blocks: 16384 mapped

This is unexpected result. Because UNMAP command to LBA 0 finished
without any errors, but Get LBA status shows that LBA 0 is still mapped.

This problem is due to the wrong translation between LBA and index of
provisioning map. Fix it by using correct translation functions.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
cc34a8e663b2908b9ab487dab8456d117a1e0b93 16-Apr-2013 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: clear correct memory region when LBPRZ is enabled

The function unmap_region() clears memory region specified as the logical
block address and the number of logical blocks in ramdisk storage
(fake_storep) if lbpu and lbprz module parameters are enabled.

In the while loop of unmap_region(), it advances optimal unmap granularity
in logical blocks. But it only clears one logical block at LBA 'block' per
loop iteration. And furthermore, the 'block' is not pointing to a logical
block address which should be cleared, it is a index of probisioning map
(map_storep).

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
ac17078ae6947254331f56ce4f1db9ea221d43d6 16-Apr-2013 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: prohibit scsi_debug_unmap_granularity == scsi_debug_unmap_alignment

scsi_debug prohibits setting scsi_debug_unmap_alignment to be greater
than scsi_debug_unmap_granularity. But setting them to be the same value
is not prohibited. In this case, the only difference with
scsi_debug_unmap_alignment == 0 is the logical blocks from 0 to
scsi_debug_unmap_alignment - 1 cannot be unmapped. But the difference is
not properly handled in the current code.

So this prohibits such unusual setting.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
9ed8d3dc5b46f86ab9117937bd24427ac10e8de5 16-Apr-2013 Akinobu Mita <akinobu.mita@gmail.com> [SCSI] scsi_debug: call map_region() and unmap_region() only when needed

If the logical block provisioning is not enabled, map_region() and
unmap_region() have no effect and they don't need to be called.

So this makes map_region() and unmap_region() to be called only
when scsi_debug_lbp() returns true, i.e. logical block provisioning is
enabled.

While I'm at it, this also removes meaningless non-zero check for
scsi_debug_unmap_granularity.

Because scsi_debug_unmap_granularity cannot be zero with usual setting:
scsi_debug_unmap_granularity is 1 by default, and it can be changed to
zero with explicit module parameter setting only when the logical block
provisioning is disabled. But it is only meaningful module parameter
when the logical block provisioning is enabled.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
c8ed555aba11236ff973fa937f38d5af87bfb18e 31-Mar-2013 Al Viro <viro@zeniv.linux.org.uk> scsi_debug: switch to ->show_info()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
bc977749e967daa56de1922cf4cb38525631c51c 16-Aug-2012 Lukas Czerner <lczerner@redhat.com> [SCSI] scsi_debug: Fix off-by-one bug when unmapping region

Currently it is possible to unmap one more block than user requested to
due to the off-by-one error in unmap_region(). This is probably due to
the fact that the end variable despite its name actually points to the
last block to unmap + 1. However in the condition it is handled as the
last block of the region to unmap.

The bug was not previously spotted probably due to the fact that the
region was not zeroed, which has changed with commit
be1dd78de5686c062bb3103f9e86d444a10ed783. With that commit we were able
to corrupt the ext4 file system on 256M scsi_debug device with LBPRZ
enabled using fstrim.

Since the 'end' semantic is the same in several functions there this
commit just fixes the condition to use the 'end' variable correctly in
that context.

Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
d986788b2653ef76441c6b6ba1787164546735a6 06-Sep-2012 Martin Pitt <martin.pitt@ubuntu.com> [SCSI] scsi_debug: Add "removable" parameter

Add "removable" module parameter to set the "removable" attribute of any
subsequently created debug block device. It is a writable driver option, so
that you can switch between removable and "fixed" media block devices in
between the add_host calls.

This is useful for being able to test the different behaviour/required
privileges in e. g. the udisks test suite.

Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
3f0bc3b331a371392bb64c5b211b60ec84d5a444 08-Mar-2012 Martin K. Petersen <mkp@mkp.net> [SCSI] scsi_debug: Fix incorrect page length in logical block provisioning VPD

The page length for the 0xb2 VPD page is defined to be 4 bytes when no
provisioning descriptors are provided (DP=0).

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
be1dd78de5686c062bb3103f9e86d444a10ed783 08-Mar-2012 Eric Sandeen <sandeen@redhat.com> [SCSI] scsi_debug: add LBPRZ support

Add LBPRZ support to scsi_debug; i.e. read zeros for
unmapped blocks.

Rather than checking for unmapped blocks at
read time, this just zeroes them on the backing store
at unmap time so it behaves the same way.

This also adds a module parameter to disable it.

lbprz, "unmapped blocks return 0 on read (def=1)"

[jejb: fix whitespace errors]
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
77dfce076cbd76c04e90abff188d058cdbff78dd 25-Nov-2011 Cong Wang <amwang@redhat.com> scsi: remove the second argument of k[un]map_atomic()

Signed-off-by: Cong Wang <amwang@redhat.com>
18a4d0a22ed6c54b67af7718c305cd010f09ddf8 09-Feb-2012 Martin K. Petersen <martin.petersen@oracle.com> [SCSI] Handle disk devices which can not process medium access commands

We have experienced several devices which fail in a fashion we do not
currently handle gracefully in SCSI. After a failure these devices will
respond to the SCSI primary command set (INQUIRY, TEST UNIT READY, etc.)
but any command accessing the storage medium will time out.

The following patch adds an callback that can be used by upper level
drivers to inspect the results of an error handling command. This in
turn has been used to implement additional checking in the SCSI disk
driver.

If a medium access command fails twice but TEST UNIT READY succeeds both
times in the subsequent error handling we will offline the device. The
maximum number of failed commands required to take a device offline can
be tweaked in sysfs.

Also add a new error flag to scsi_debug which allows this scenario to be
easily reproduced.

[jejb: fix up integer parsing to use kstrtouint]
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
de13e9654e308db6bde49c779410512ad9659bc0 20-Jan-2012 Douglas Gilbert <dgilbert@interlog.com> [SCSI] scsi_debug: GET LBA STATUS response length correction

The SCSI GET LBA STATUS command was introduced in SBC-3 revision
20 in September 2009. At that time the Parameter Data Length
field in the response had an associated byte offset of 8.

Then in SBC-3 revision 25 (October 2010) that byte offset was
changed to 4. The sg_get_lba_status utility in sg3_utils version
1.33 (released earlier today) has been changed to calculate
the newer response length. However the implementation of
GET LBA STATUS command in the scsi_debug driver still uses the
original byte offset.

modify the Parameter Data Length field value in the GET LBA STATUS command
response to comply with the change in SBC-3 revision 25

Signed-off-by: James Bottomley <JBottomley@Parallels.com>
25985edcedea6396277003854657b5f3cb31a628 31-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi> Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
32f7ef73585a8773914661e1a8e477e7a0bfa8b4 11-Mar-2011 Douglas Gilbert <dgilbert@interlog.com> [SCSI] scsi_debug: add consecutive medium errors

A useful test case for error recovery is multiple,
consecutive medium errors. When scsi_debug is started
with "opts=2" a MEDIUM ERROR is generated when block
0x1234 (4660) is read. The patch extends that to
10 consecutive blocks from 0x1234 (i.e. blocks 4660 to
4669 inclusive).

[0:0:0:0] disk ATA INTEL SSD 2CV1 /dev/sda /dev/sg0 80.0GB
[10:0:0:0] disk Linux scsi_debug 0004 /dev/sdb /dev/sg1 1.09TB

Output file not specified so no copy, just reading input
>> unrecovered read error at blk=4660, substitute zeros
...
>> unrecovered read error at blk=4669, substitute zeros
4670+10 records in
0+0 records out
10 unrecovered read errors
lowest unrecovered read lba=4660, highest unrecovered lba=4669
time to read data: 0.047943 secs at 49.87 MB/sec

BTW Change /dev/sg1 (bsg device works just as well) to
/dev/sdb to see why, with faulty media, you do not want
to use the block layer interface. Reason: time block
layer takes to do useless retries and collateral damage
to data in its 4 KB blocks (O_DIRECT mitigates the
latter).

ChangeLog:
- extend opts=2 medium error generation at block
0x1234 to 10 consecutive blocks (i.e. blocks
0x1234 to 0x123d).

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
5b94e23292dec213e5bb0240894b597d93744e2a 08-Mar-2011 Martin K. Petersen <martin.petersen@oracle.com> [SCSI] scsi_debug: Logical Block Provisioning (SBC3r26)

Update scsi_debug to support the Logical Block Provisioning commands and
bits as defined in SBC3r26. The old tp* parameters have been
transitioned to the new lbp* scheme found in the draft standard.

The old tpu option to enable UNMAP is now called lbpu. tpws to signal
support for WRITE SAME(16) with the UNMAP bit set is now lbpws. Support
for WRITE SAME(10) with the UNMAP bit set is also available using the
lpuws10 parameter.

Limiting the maximum number of blocks per WRITE SAME command has been
implemented and is available via the write_same_length module parameter.

As part of the renaming process the parameter lists have been sorted
alphabetically (request from Doug).

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
a361cc0025614fdd07f5f69aeeaa8075530870bc 01-Feb-2011 Darrick J. Wong <djwong@us.ibm.com> [SCSI] scsi_debug: Fix 32-bit overflow in do_device_access causing memory corruption

If I create a scsi_debug device that is larger than 4GB, the multiplication of
(block * scsi_debug_sector_size) can produce a 64-bit value. Unfortunately,
the compiler sees two 32-bit quantities and performs a 32-bit multiplication,
thus truncating the bits above 2^32. This causes the wrong memory location to
be read or written. Change block and rest to be unsigned long long.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
a87e3a67d57472f40da2218793ff6d25c4518498 18-Dec-2010 Douglas Gilbert <dgilbert@interlog.com> [SCSI] scsi_debug: set resid to indicate no data-in when medium error

set resid to the requested data-in length when a MEDIUM ERROR is
simulated. This implies no valid data is returned in the data-in
buffer

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
f281233d3eba15fb225d21ae2e228fd4553d824a 16-Nov-2010 Jeff Garzik <jeff@garzik.org> SCSI host lock push-down

Move the mid-layer's ->queuecommand() invocation from being locked
with the host lock to being unlocked to facilitate speeding up the
critical path for drivers who don't need this lock taken anyway.

The patch below presents a simple SCSI host lock push-down as an
equivalent transformation. No locking or other behavior should change
with this patch. All existing bugs and locking orders are preserved.

Additionally, add one parameter to queuecommand,
struct Scsi_Host *
and remove one parameter from queuecommand,
void (*done)(struct scsi_cmnd *)

Scsi_Host* is a convenient pointer that most host drivers need anyway,
and 'done' is redundant to struct scsi_cmnd->scsi_done.

Minimal code disturbance was attempted with this change. Most drivers
needed only two one-line modifications for their host lock push-down.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Acked-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9b906779568f009b53254a15b283b53ae4570b93 07-Sep-2010 Nicholas Bellinger <nab@linux-iscsi.org> [SCSI] scsi_debug: Convert to use root_device_register() and root_device_unregister()

This patch updates the scsi_debug virtual LLD to use
root_device_register() and root_device_unregister() from
include/linux/device.h instead of device_register() and
device_unregister() respectively within scsi_debug_init() and
scsi_debug_exit() This simply involved converting the static struct
device pseudo_primary into a pointer that is setup by the call to
root_device_register().

This patch also contains the correct IS_ERR() conditional check of
root_device_register() from within scsi_debug_init().

Thanks to Richard Sharpe and Dmitry Torokhov for their help with this
item.

Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
6014759c929b4ce8c068810b8d05f31969df5897 19-Aug-2010 Martin K. Petersen <martin.petersen@oracle.com> [SCSI] scsi_debug: Update thin provisioning support

The previous thin provisioning support was not very user friendly
because it depended on all the relevant options being set on the command
line.

Implement support for the Thin Provisioning VPD page from SBC3 r24 and
add module options for TPU (UNMAP) and TPWS (WRITE SAME (16) with UNMAP
bit). This allows us to have sane default and to enable thin
provisioning with a simple tpu=1 or tpws=1 on the command line depending
on whether we want UNMAP or WRITE SAME behavior.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
9ab98f57b3e1d73cd0720d29c21b687ba609cde9 27-Jun-2010 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: fix map_region and unmap_region oops

map_region and unmap_region could access to invalid memory area since
they don't check the size boundary.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
5447ed6c968e7270b656afa273c2b79d15d82edd 25-Apr-2010 Douglas Gilbert <dgilbert@interlog.com> [SCSI] scsi_debug: virtual_gb ignores sector_size

In the scsi_debug driver, the virtual_gb option ignores the
sector_size, implicitly assuming that is 512 bytes. So if
'virtual_gb=1 sector_size=4096' the result is an 8 GB (virtual) disk.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
e308b3d19d1cf6af39024121269bb384b95d3da3 23-Mar-2010 Martin K. Petersen <martin.petersen@oracle.com> [SCSI] scsi_debug: Block Limits VPD page fixes

Add a few clarifying comments in the B0 page function and allow the
optimal transfer length field to be specified on the command line using
opt_blks=N.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
78d4e5a07dca7374dd9db40b3346d727b65eb794 25-Mar-2010 Douglas Gilbert <dgilbert@interlog.com> [SCSI] scsi_debug: add max_queue + no_uld parameters

While testing the midlevel q_at_head and q_at_tail
patch for sg and the block SG_IO ioctl I found it
useful to reduce the queuing within the scsi_debug
driver. The reason is that the midlevel queue only
comes into play when the corresponding LLD queue
is full.

It is also useful when testing to be confident that
your program is the only thing issuing commands
to the (virtual) scsi_debug device. The no_uld=1
parameter will stop a scsi_debug virtual disk
appearing as /dev/sd* .

Changelog:
- add max_queue parameter to reduce the number
of queued commands the driver will accept.
This parameter can be changed after the driver
is loaded.
- add no_uld parameter that restricts scsi_debug's
virtual devices to the sg and bsg drivers
- correct stale url

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
1e49f78505b2c4df193614d774bf46d067cda7d8 29-Oct-2009 Douglas Gilbert <dgilbert@interlog.com> [SCSI] scsi_debug: fix Thin provisioning support

While testing scsi_debug with these patches I found a
problem with the Block Limits VPD page function. The
length returned by the inquiry_evpd_b0() function was
too short. A patch to fix that and a cosmetic change
(that the form factor of scsi_debug is less than 1.8
inches) is attached.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
44d9269481bb43df445adf464b06ff031e67d7ea 15-Oct-2009 Martin K. Petersen <martin.petersen@oracle.com> [SCSI] scsi_debug: Thin provisioning support

This version fixes 64-bit modulo on 32-bit as well as inadvertent map
updates when TP was disabled.

Implement support for thin provisioning in scsi_debug. No actual memory
de-allocation is taking place. The intent is to emulate a thinly
provisioned storage device, not to be one.

There are four new module options:

- unmap_granularity specifies the granularity at which to track mapped
blocks (specified in number of logical blocks). 2048 (1 MB) is a
realistic value for disk arrays although some may have a finer
granularity.

- unmap_alignment specifies the first LBA which is naturally aligned on
an unmap_granularity boundary.

- unmap_max_desc specifies the maximum number of ranges that can be
unmapped using one UNMAP command. If this is 0, only WRITE SAME is
supported and UNMAP will cause a check condition.

- unmap_max_blocks specifies the maximum number of blocks that can be
unmapped using a single UNMAP command. Default is 0xffffffff.

These parameters are reported in the new and extended block limits VPD.

If unmap_granularity is specified the device is tagged as thin
provisioning capable in READ CAPACITY(16). A bitmap is allocated to
track whether blocks are mapped or not. A WRITE request will cause a
block to be mapped. So will WRITE SAME unless the UNMAP bit is set.

Blocks can be unmapped using either WRITE SAME or UNMAP. No accounting
is done to track partial blocks. This means that only whole blocks will
be marked free. This is how the array people tell me their firmwares
work.

GET LBA STATUS is also supported. This command reports whether a block
is mapped or not, and how long the adjoining mapped/unmapped extent is.

The block allocation bitmap can also be viewed from user space via:

/sys/bus/pseudo/drivers/scsi_debug/map

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
395cef030c99349d238563095adc63ea72641192 18-Sep-2009 Martin K. Petersen <martin.petersen@oracle.com> [SCSI] scsi_debug: Implement support for DIF Type 2

Add support for 32-byte READ/WRITE as well as DIF Type 2 protection.

Reject protected 10/12/16 byte READ/WRITE commands when Type 2 is
enabled.

Verify Type 2 reference tag according to Expected Initial LBA in 32-byte
CDB.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
ea61fca58c1373a48c0741798f70364d4498d2af 15-May-2009 Martin K. Petersen <martin.petersen@oracle.com> scsi_debug: Add support for physical block exponent and alignment

This patch adds support for setting the physical block exponent and
lowest aligned LBA in the READ CAPACITY(16) response.

The B0 VPD page is adjusted accordingly.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
73da9c13d4df3c1715029aa45edc78d71b617dfd 23-Apr-2009 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: fix virtual disk larger than 1TB

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
c6a44287417de1625a59f1d4ae52d033c03b9dab 04-Jan-2009 Martin K. Petersen <martin.petersen@oracle.com> [SCSI] scsi_debug: DIF/DIX support

This patch adds support for DIX and DIF in scsi_debug. A separate
buffer is allocated for the protection information.

- The dix parameter indicates whether the controller supports DIX
(protection information DMA)

- The dif parameter indicates whether the simulated storage device
supports DIF

- The guard parameter switches between T10 CRC(0) and IP checksum(1)

- The ato parameter indicates whether the application tag is owned by
the disk(0) or the OS(1)

- DIF and DIX errors can be triggered using the scsi_debug_opts mask

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
71610f55fa4db63dbf5385929a47c9fb2451f332 03-Dec-2008 Kay Sievers <kay.sievers@vrfy.org> [SCSI] struct device - replace bus_id with dev_name(), dev_set_name()

[jejb: limit ioctl to returning 20 characters to avoid overrun
on long device names and add a few more conversions]
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
cadbd4a5e36dde7e6c49b587b2c419103c0b7218 04-Jul-2008 Harvey Harrison <harvey.harrison@gmail.com> [SCSI] replace __FUNCTION__ with __func__

[jejb: fixed up a ton of missed conversions.

All of you are on notice this has happened, driver trees will now
need to be rebased]

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: SCSI List <linux-scsi@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
eac6e8e449647cbb9efee53977c8bfee0aa7d69e 19-Jun-2008 Matthew Wilcox <matthew@wil.cx> [SCSI] scsi_debug: add support for rotation speed

Add support for VPD page b1 to scsi_debug

SCSI VPD page b1 reports the nominal rotation speed of the device.
Since scsi_debug is ram-based, claim to be a non-rotating medium.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
597136ab70a6dccba5c40ee6eed88e881412429b 05-Jun-2008 Martin K. Petersen <martin.petersen@oracle.com> [SCSI] scsi_debug: Runtime-configurable sector size

Make scsi_debug sector size configurable at load time instead of being
a #define. Handy for testing 4KB sectors.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
75ad23bc0fcb4f992a5d06982bf0857ab1738e9e 29-Apr-2008 Nick Piggin <npiggin@suse.de> block: make queue flags non-atomic

We can save some atomic ops in the IO path, if we clearly define
the rules of how to modify the queue flags.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
8dea0d02f8bb7103ec0818bd2e856f30f2d1bcf1 29-Mar-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: remove unnecessary function declarations

This patch removes function declarations with moving some
functions. This cleans up them a bit to silence checkpatch.pl. There
is no functional change.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
5f2578e579ab74b4e3cfd1431bfa976e906594f6 29-Mar-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: support large non-fake virtual disk

Currently, the maximum amount of RAM that scsi_debug can allocate is
4GB. This patch increases it to 2TB; scsi_debug can allocates 2TB
memory and export it as if it were 2TB scsi disk.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
1978910062c38394570c48b3065f37060be31b91 29-Mar-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: remove the duplicated code in resp_read and resp_write

resp_read and resp_write performs READ_* and WRITE_* commands
respectively. This sweeps up the similar code in them.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
28898873b0049d4271c0ff3eb57eb329bbc4d9df 29-Mar-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: sweep up sdebug_capacity calculation

sdebug_capacity is calculated at five different places. This add a
helper function to calculate sdebug_capacity to sweep up the
duplicatated code.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
f58b0efbf49ec54c82b8904c64a6498f829e7544 29-Mar-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: remove unnecessary sdebug_store_size

sdebug_store_size doesn't need to be static global. It's used at
startup only.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
d5cdc9898b5589acc77db91a1e9c0feb9f32abef 25-Mar-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: fix lba and data length calculation bugs

For example, `modprobe scsi_debug virtual_gb=1100` gives:

scsi7 : scsi_debug, version 1.81 [20070104], dev_size_mb=8, opts=0x0
scsi 7:0:0:0: Direct-Access Linux scsi_debug 0004 PQ: 0 ANSI: 5
sd 7:0:0:0: [sdc] 2306867200 512-byte hardware sectors (1181116 MB)
sd 7:0:0:0: [sdc] Write Protect is off
sd 7:0:0:0: [sdc] Mode Sense: 73 00 10 08
sd 7:0:0:0: [sdc] Write cache: enabled, read cache: enabled, supports DPO and FUA
sd 7:0:0:0: [sdc] 2306867200 512-byte hardware sectors (1181116 MB)
sd 7:0:0:0: [sdc] Write Protect is off
sd 7:0:0:0: [sdc] Mode Sense: 73 00 10 08
sd 7:0:0:0: [sdc] Write cache: enabled, read cache: enabled, supports DPO and FUA
sdc: unknown partition table
sd 7:0:0:0: [sdc] Attached SCSI disk
sd 7:0:0:0: Attached scsi generic sg6 type 0
end_request: I/O error, dev sdc, sector 2306867072
Buffer I/O error on device sdc, logical block 288358384
end_request: I/O error, dev sdc, sector 2306867072
Buffer I/O error on device sdc, logical block 288358384
end_request: I/O error, dev sdc, sector 2306867192

(snip)

Note that this converts all the calculations (including the correct
calculations) for unification.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
a34c4e98367965402134f2e66c3cdc4416f109e4 25-Mar-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: use scsi_build_sense_buffer

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
639db475c8bb77f915f79f567ee98ac673d6edf3 20-Mar-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: remove unnecessary function declarations

This patch removes lots of function declarations with moving
scsi_debug_queuecommand. This cleans up scsi_debug_queuecommand a bit
to silence checkpatch.pl

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
8b40228f3f5b1fa926c116ec444476d32bc470f6 20-Mar-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: use list_for_each_entry_safe

This replaces list_for_each_safe and list_entry with
list_for_each_entry_safe.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
a75869d1ff73de74249373c2a1d80fbbc3b6c8fc 20-Mar-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: remove unnecessary condition test in devInfoReg

open_devip is always non NULL.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
5cb2fc06107fe343a9488b32ddf3d9b4596b7090 20-Mar-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: create new scsi_debug devices at a single place

Two functions, sdebug_add_adapter and devInfoReg, creates new
scsi_debug devices. To simplify the code, this patch adds a new helper
function to create new scsi_debug devices (sdebug_device_create) and
converts both functions to use it.

I plan to add more to scsi_debug devices (e.g. using a thread for a
scsi_debug device for scalability testings). This patch enable me to
add such to just the new helper function instead of touching two
functions, sdebug_add_adapter and devInfoReg.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
f3df41cff40992499d3c693251622299e4ce18c3 20-Mar-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: remove temporary hack around sscanf for negative values

sscanf can handle negative values.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
21a6182924d531b41cb8c24e0344213f4c90c335 09-Mar-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: use sg buffer copy helper functions

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
d1e4c9c57c2ed4722795443db22a5d813cd4f0e5 02-Mar-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: use shost_priv macro

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
96ad0dfe8388428acc10c1bd96573f893fc79439 02-Mar-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: remove unnecessary checking

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
9e603ca06a538ba6eae29f9785aa47bc53920a15 02-Mar-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: remove scsi_debug.h

scsi_debug.h just incldues some function declarations. This patch removes it
with moving the scsi_host_template.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
9ff26eefd4f19051ce13bbba6847871626680e91 02-Mar-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: stop including drivers/scsi/scsi.h

This converts scsi_debug to include header files in include/scsi/
instead of drivers/scsi/scsi.h.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
9924a781f3e746ba5aa54cf96ca462b8d0915221 25-Feb-2008 Andi Kleen <andi@firstfloor.org> [SCSI] Remove random noop unchecked_isa_dma users

Lots of drivers set it to 0. Remove that. Patch should be a nop.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
cbccc207128e8bbdb047f6c5fc261acf207749c1 16-Feb-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] scsi_debug: disable clustering

scsi_debug does at several places:

for_each_sg(sdb->table.sgl, sg, sdb->table.nents, k) {
kaddr = (unsigned char *)
kmap_atomic(sg_page(sg), KM_USER0);

We cannot do something like that with the clustering enabled (or we
can use scsi_kmap_atomic_sg).

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
c639d14e2f70d086842d37fb8e4f5ab9bd56af2e 22-Jan-2008 FUJITA Tomonori <tomof@acm.org> [SCSI] scsi_debug: add XDWRITEREAD_10 support

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
072d0bb3ce3507ac6e101ca8ce0b94c5777c62ed 22-Jan-2008 FUJITA Tomonori <tomof@acm.org> [SCSI] scsi_debug: add bidi data transfer support

This enables fill_from_dev_buffer and fetch_to_dev_buffer to handle
bidi commands.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
3de9f944797177e405dcab05f12560a497c019bb 22-Jan-2008 FUJITA Tomonori <tomof@acm.org> [SCSI] scsi_debug: add get_data_transfer_info helper function

This adds get_data_transfer_info helper function that get lha and
sectors for READ_* and WRITE_* commands (and XDWRITEREAD_10 later).

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
c73961e563dde3239e2e5da08b25ab2832b2e840 06-Sep-2007 Boaz Harrosh <bharrosh@panasas.com> [SCSI] scsi_debug: convert to use the data buffer accessors

- remove the unnecessary map_single path.
- convert to use the new accessors for the sg lists and the
parameters.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
45711f1af6eff1a6d010703b4862e0d2b9afd056 22-Oct-2007 Jens Axboe <jens.axboe@oracle.com> [SG] Update drivers to use sg helpers

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
852e034de7727f91dd51995c460a04db2955f1b3 16-Jul-2007 Jens Axboe <jens.axboe@oracle.com> scsi_debug: support sg chaining

Signed-off-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
b02b6bc46571b21a545c9e697df1e226ff22bc81 10-May-2007 Kristian Høgsberg <krh@redhat.com> [SCSI] Make scsi_host_template::proc_name const char * instead of char *.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>

collapsed with fw-sbp2 patch "Drop cast to non-const char * in host
template initialization." from Kristian Høgsberg

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
beb87c33393142200df7bfdc901dde97bd576650 11-Jun-2007 Randy Dunlap <randy.dunlap@oracle.com> [SCSI] scsi_debug: correct parameter default text

Correct the module info text for the default value of
"every_nth" to 0.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
e63340ae6b6205fef26b40a75673d1c9c0c8bb90 08-May-2007 Randy Dunlap <randy.dunlap@oracle.com> header cleaning: don't include smp_lock.h when not used

Remove includes of <linux/smp_lock.h> where it is not used/needed.
Suggested by Al Viro.

Builds cleanly on x86_64, i386, alpha, ia64, powerpc, sparc,
sparc64, and arm (all 59 defconfigs).

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
cd354f1ae75e6466a7e31b727faede57a1f89ca5 14-Feb-2007 Tim Schmielau <tim@physik3.uni-rostock.de> [PATCH] remove many unneeded #includes of sched.h

After Al Viro (finally) succeeded in removing the sched.h #include in module.h
recently, it makes sense again to remove other superfluous sched.h includes.
There are quite a lot of files which include it but don't actually need
anything defined in there. Presumably these includes were once needed for
macros that used to live in sched.h, but moved to other header files in the
course of cleaning it up.

To ease the pain, this time I did not fiddle with any header files and only
removed #includes from .c-files, which tend to cause less trouble.

Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha,
arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig,
allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all
configs in arch/arm/configs on arm. I also checked that no new warnings were
introduced by the patch (actually, some warnings are removed that were emitted
by unnecessarily included header files).

Signed-off-by: Tim Schmielau <tim@physik3.uni-rostock.de>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6f3cbf552e0557a463ad421f07b2e873a608406f 05-Jan-2007 Douglas Gilbert <dougg@torque.net> [SCSI] scsi_debug: error processing

After discussions in the thread titled:
[PATCH] scsi_debug: illegal blocking memory allocation
here is a patch containing the discussed fix and some other
fixes and additions. The patch is against lk 2.6.20-rc3 .
The version is bumped to 1.81 .

ChangeLog:
- Change several GFP_KERNEL allocations to GFP_ATOMIC
as they can be called from queuecommand() context
- check above allocation returns and if out of memory
report DID_REQUEUE in two cases, DID_NO_CONNECT in
another, and fail slave configure() in another
- add support for WRITE BUFFER command
- add aborted_command error injection support
(opts mask 0x10), similar mechanism to
recovered_error injection.

Signed-off-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
5a09e39810ae0465016c380962e12dd115779b87 20-Oct-2006 Hannes Reinecke <hare@suse.de> [SCSI] scsi_debug: support REPORT TARGET PORT GROUPS

This patch adds support for REPORT TARGET PORT GROUPS. This is used
eg for the multipathing priority callout to determine the path
priority.
With this patch multipath-tools can use the existing mpath_prio_alua
callout to exercise the path priority grouping.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
231839102b54512ced7d3ee7fc9b8bcf5e3b583b 17-Sep-2006 Douglas Gilbert <dougg@torque.net> [SCSI] scsi_debug version 1.80

See http://www.torque.net/sg/sdebug26.html for more
information on the scsi_debug driver.

ChangeLog:
- add 'vpd_use_hostno' parameter to allow simulated hosts
to see the same set of targets (and luns). For testing
multipath software.
- add 'fake_rw' parameter to ignore the data in READ and
WRITE commands
- add support for log subpages (new in SPC-4)
- yield appropriate block descriptor for MODE SENSE
commands (only for pdt=0 (i.e. disks))
- REQUEST SENSE response no longer shows the stopped
power condition (SAT changed to agree with SPC-3)

Signed-off-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
6ecaff7fe84eb64796d8dfe667439290b4acfad0 12-Jul-2006 Randy Dunlap <rdunlap@xenotime.net> [SCSI] scsi_debug: must_check fixes

Check all __must_check warnings in scsi_debug.

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
6ab3d5624e172c553004ecc862bfeac16d9d68b7 30-Jun-2006 Jörn Engel <joern@wohnheim.fh-wedel.de> Remove obsolete #include <linux/config.h>

Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
c65b1445d153a66ca91b00c1f10187e495c17918 06-Jun-2006 Douglas Gilbert <dougg@torque.net> [SCSI] scsi_debug version 1.79

- add 'virtual_gb' parameter to simulate large storage
(by wrapping in dev_size_mb megabytes of actual ram)
- add 'no_lun_0' parameter to skip lun 0 on each target
(but still respond as required to INQUIRY + REPORT LUNS)
- add well know lu support
- add MODE SELECT commands support [pages: 0xa and 0x1c]
- add LOG SENSE command support [pages: 0xd and 0x2f]
- add READ CAPACITY (16) support
- increase number of mode pages supported (to read),
mainly transport specific (SAS) mode (sub)pages
- add more VPD pages and extend others, including
ATA information VPD page
- START STOP UNIT now maintains a state machine
- READ (16) and WRITE (16) cope with lbas larger
than 32 bits (needed for the 'virtual_gb' parameter)
- allow single command transfers up to 32 MB
- more precise error (sense data) messages

Signed-off-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
24669f75a3231fa37444977c92d1f4838bec1233 16-Jan-2006 Jes Sorensen <jes@sgi.com> [SCSI] SCSI core kmalloc2kzalloc

Change the core SCSI code to use kzalloc rather than kmalloc+memset
where possible.

Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
bbbe3a41f7ee529f7f4fdcc1bc1157234bac0766 05-Jan-2006 Russell King <rmk@arm.linux.org.uk> [PATCH] Add Pseudo LLD bus_type probe and remove methods

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
d0be4a7d29ad0bd3ce2209dd9e46d410b632db59 31-Oct-2005 Christoph Hellwig <hch@lst.de> [SCSI] remove Scsi_Host_Template typedef

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
733482e445ca4450cf41381b1c95e2b8c7145114 09-Nov-2005 Olaf Hering <olh@suse.de> [PATCH] changing CONFIG_LOCALVERSION rebuilds too much, for no good reason

This patch removes almost all inclusions of linux/version.h. The 3
#defines are unused in most of the touched files.

A few drivers use the simple KERNEL_VERSION(a,b,c) macro, which is
unfortunatly in linux/version.h.

There are also lots of #ifdef for long obsolete kernels, this was not
touched. In a few places, the linux/version.h include was move to where
the LINUX_VERSION_CODE was used.

quilt vi `find * -type f -name "*.[ch]"|xargs grep -El '(UTS_RELEASE|LINUX_VERSION_CODE|KERNEL_VERSION|linux/version.h)'|grep -Ev '(/(boot|coda|drm)/|~$)'`

search pattern:
/UTS_RELEASE\|LINUX_VERSION_CODE\|KERNEL_VERSION\|linux\/\(utsname\|version\).h

Signed-off-by: Olaf Hering <olh@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
422c0d61d591cbfb70f029e13505fb437e169d68 25-Oct-2005 Jeff Garzik <jgarzik@pobox.com> [SCSI] use scmd_id(), scmd_channel() throughout code

Wrap a highly common idiom. Makes the code easier to read, helps pave
the way for sdev->{id,channel} removal, and adds a token that can easily
by grepped-for in the future.

There are a couple sdev_id() and scmd_printk() updates thrown in as well.

Rejections fixed up and
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
3bf743e7c891d8be8295650b7a6a9b5af083b096 25-Oct-2005 Jeff Garzik <jgarzik@pobox.com> [SCSI] use {sdev,scmd,starget,shost}_printk in generic code

rejections fixed and
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
52c1da39534fb382c061de58b65f678ad74b59f5 24-Jun-2005 Adrian Bunk <bunk@stusta.de> [PATCH] make various thing static

Another rollup of patches which give various symbols static scope

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 17-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org> Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!