]> 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)
commit440929e65f758789db93941d72237029f511a316
treecce407c1cc11362e59bc1389ad30fe4d1de2cbea
parent71e7eff779d731f5fb5e5ea2b416def998f16cc9
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