scsi-disk: correctly implement WRITE SAME
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 22 Nov 2013 12:40:01 +0000 (13:40 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Tue, 3 Dec 2013 14:26:49 +0000 (15:26 +0100)
commit84f94a9a82487639bc87d5f09f938c9f6a61f79a
treeb8f6e8df50785865b68f8c6e68d54f25ebed8ba1
parent823bd7391c96ba675f20fd6d952d1cb6e1ffb851
scsi-disk: correctly implement WRITE SAME

Fetch the data to be written from the input buffer.  If it is all zeroes,
we can use the write_zeroes call (possibly with the new MAY_UNMAP flag).
Otherwise, do as many write cycles as needed, writing 512k at a time.

Strictly speaking, this is still incorrect because a zero cluster should
only be written if the MAY_UNMAP flag is set.  But this is a bug in qcow2
and the other formats, not in the SCSI code.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
hw/scsi/scsi-disk.c