]> git.baikalelectronics.ru Git - kernel.git/commit
sd: Make discard granularity match logical block size when LBPRZ=1
authorMartin K. Petersen <martin.petersen@oracle.com>
Fri, 13 Nov 2015 21:46:47 +0000 (16:46 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 26 Nov 2015 02:38:34 +0000 (21:38 -0500)
commit4260678ca13925f65cf54538d301bc43415c1ac3
treecce407c1cc11362e59bc1389ad30fe4d1de2cbea
parentf4d8cd3c0a9465275a39bd42cd2f3b454d647b18
sd: Make discard granularity match logical block size when LBPRZ=1

A device may report an OPTIMAL UNMAP GRANULARITY and UNMAP GRANULARITY
ALIGNMENT in the Block Limits VPD. These parameters describe the
device's internal provisioning allocation units. By default the block
layer will round and align any discard requests based on these limits.

If a device reports LBPRZ=1 to guarantee zeroes after discard, however,
it is imperative that the block layer does not leave out any parts of
the requested block range. Otherwise the device can not do the required
zeroing of any partial allocation units and this can lead to data
corruption.

Since the dm thinp personality relies on the block layer's current
behavior and is unable to deal with partial discard blocks we work
around the problem by setting the granularity to match the logical block
size when LBPRZ is enabled.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sd.c