]> git.proxmox.com Git - mirror_ubuntu-kernels.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)
commite461338b6cd4074e39a0d5fdd1dc5582fbca1520
treefa0f9d67f5dc0e39a5bad80e80a18ac1d4eb9a86
parentb7392d2247cfe6771f95d256374f1a8e6a6f48d6
sd: tweak discard heuristics to work around QEMU SCSI issue

7985090aa020 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