sd: tweak discard heuristics to work around QEMU SCSI issue
7985090a 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: NMing Lei <ming.lei@canonical.com> Tested-by: NMing Lei <ming.lei@canonical.com> Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com> Acked-by: NPaolo Bonzini <pbonzini@redhat.com> Signed-off-by: NChristoph Hellwig <hch@lst.de>
Showing
想要评论请 注册 或 登录