[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 32/60] qed: refuse unaligned zero writes with a bac
From: |
Michael Tokarev |
Subject: |
[Qemu-stable] [PATCH 32/60] qed: refuse unaligned zero writes with a backing file |
Date: |
Mon, 4 Feb 2013 14:40:42 +0400 |
From: Stefan Hajnoczi <address@hidden>
Zero writes have cluster granularity in QED. Therefore they can only be
used to zero entire clusters.
If the zero write request leaves sectors untouched, zeroing the entire
cluster would obscure the backing file. Instead return -ENOTSUP, which
is handled by block.c:bdrv_co_do_write_zeroes() and falls back to a
regular write.
The qemu-iotests 034 test cases covers this scenario.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
(cherry picked from commit ef72f76e58107bd4096018c3db2912d28249308e)
Signed-off-by: Michael Tokarev <address@hidden>
---
block/qed.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/block/qed.c b/block/qed.c
index 30a31f9..49ac93e 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -1370,10 +1370,21 @@ static int coroutine_fn
bdrv_qed_co_write_zeroes(BlockDriverState *bs,
int nb_sectors)
{
BlockDriverAIOCB *blockacb;
+ BDRVQEDState *s = bs->opaque;
QEDWriteZeroesCB cb = { .done = false };
QEMUIOVector qiov;
struct iovec iov;
+ /* Refuse if there are untouched backing file sectors */
+ if (bs->backing_hd) {
+ if (qed_offset_into_cluster(s, sector_num * BDRV_SECTOR_SIZE) != 0) {
+ return -ENOTSUP;
+ }
+ if (qed_offset_into_cluster(s, nb_sectors * BDRV_SECTOR_SIZE) != 0) {
+ return -ENOTSUP;
+ }
+ }
+
/* Zero writes start without an I/O buffer. If a buffer becomes necessary
* then it will be allocated during request processing.
*/
--
1.7.10.4
- [Qemu-stable] [PATCH 54/60] hw/arm_boot.c: Consistently use ram_size from arm_boot_info struct, (continued)
- [Qemu-stable] [PATCH 22/60] uhci: Raise interrupt when requested even for non active tds, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 35/60] s390x: fix -initrd in virtio machine, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 16/60] blockdev: preserve readonly and snapshot states across media changes, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 32/60] qed: refuse unaligned zero writes with a backing file,
Michael Tokarev <=
- [Qemu-stable] [PATCH 15/60] i386: kvm: bit 10 of CPUID[8000_0001].EDX is reserved, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 47/60] kvm: fix incorrect length in a loop over kvm dirty pages map, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 45/60] e1000: Discard packets that are too long if !SBP and !LPE, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 46/60] e1000: Discard oversized packets based on SBP|LPE, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 38/60] xhci: fix usb name in caps, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 33/60] e1000: drop check_rxov, always treat RX ring with RDH == RDT as empty, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 20/60] ui/vnc: Only report/use TIGHT_PNG encoding if enabled., Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 21/60] vnc: fix "info vnc" with "-vnc ..., reverse=on", Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 56/60] target-xtensa: fix search_pc for the last TB opcode, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 07/60] cpu_physical_memory_write_rom() needs to do TB invalidates, Michael Tokarev, 2013/02/04