]> git.baikalelectronics.ru Git - kernel.git/commit
sd: tweak discard heuristics to work around QEMU SCSI issue
authorMartin K. Petersen <martin.petersen@oracle.com>
Fri, 5 Dec 2014 13:58:03 +0000 (08:58 -0500)
committerChristoph Hellwig <hch@lst.de>
Tue, 30 Dec 2014 12:30:38 +0000 (13:30 +0100)
commita9bb8a6d3b39fab89b9d70f0b415930804b12b4f
treefa0f9d67f5dc0e39a5bad80e80a18ac1d4eb9a86
parent0af4fb9a18d9b75e32eaca994d8256a288d43a7f
sd: tweak discard heuristics to work around QEMU SCSI issue

90b2e0010d3c changed the discard heuristics to give preference to the
WRITE SAME commands that (unlike UNMAP) guarantee deterministic results.

Ming Lei discovered that QEMU SCSI's WRITE SAME implementation
internally relied on limits that were only communicated for the UNMAP
case. And therefore discard commands backed by WRITE SAME would fail.

Tweak the heuristics so we still pick UNMAP in the LBPRZ=0 case and only
prefer the WRITE SAME variants if the device has the LBPRZ flag set.

Reported-by: Ming Lei <ming.lei@canonical.com>
Tested-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/sd.c