]> 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)
commit86dd41f7ab5b5dd01e8b613fab3352309377ab9d
treefa0f9d67f5dc0e39a5bad80e80a18ac1d4eb9a86
parentcf7988a55630fa7f00109ff76ab156cca8acc424
sd: tweak discard heuristics to work around QEMU SCSI issue

54629ca18f35 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