]> git.karo-electronics.de Git - mv-sheeva.git/commit
[SCSI] scsi_debug: Thin provisioning support
authorMartin K. Petersen <martin.petersen@oracle.com>
Thu, 15 Oct 2009 18:45:27 +0000 (14:45 -0400)
committerJames Bottomley <James.Bottomley@suse.de>
Fri, 4 Dec 2009 18:00:16 +0000 (12:00 -0600)
commit44d9269481bb43df445adf464b06ff031e67d7ea
tree7630c57e9416e7939ce6a177aaa2ff60113adccf
parentf57e4502cea471c69782d4790c71d8414ab49a9d
[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>
drivers/scsi/scsi_debug.c