diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-11-22 13:39:57 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2013-12-03 15:26:49 +0100 |
commit | 97a2ae34537882df34810d538ab1f51085499d2c (patch) | |
tree | 0e38e7b3f86fc7565dae03a6e98fd606a492560f /block/raw-aio.h | |
parent | d0b4503ed2d8713791c38839341b023f78d1a3d9 (diff) | |
download | qemu-97a2ae34537882df34810d538ab1f51085499d2c.zip qemu-97a2ae34537882df34810d538ab1f51085499d2c.tar.gz qemu-97a2ae34537882df34810d538ab1f51085499d2c.tar.bz2 |
raw-posix: add support for write_zeroes on XFS and block devices
The code is similar to the implementation of discard and write_zeroes
with UNMAP. However, failure must be propagated up to block.c.
The stale page cache problem can be reproduced as follows:
# modprobe scsi-debug lbpws=1 lbprz=1
# ./qemu-io /dev/sdXX
qemu-io> write -P 0xcc 0 2M
qemu-io> write -z 0 1M
qemu-io> read -P 0x00 0 512
Pattern verification failed at offset 0, 512 bytes
qemu-io> read -v 0 512
00000000: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc ................
...
# ./qemu-io --cache=none /dev/sdXX
qemu-io> write -P 0xcc 0 2M
qemu-io> write -z 0 1M
qemu-io> read -P 0x00 0 512
qemu-io> read -v 0 512
00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
...
And similarly with discard instead of "write -z".
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/raw-aio.h')
-rw-r--r-- | block/raw-aio.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/block/raw-aio.h b/block/raw-aio.h index c61f159..7ad0a8a 100644 --- a/block/raw-aio.h +++ b/block/raw-aio.h @@ -21,9 +21,10 @@ #define QEMU_AIO_IOCTL 0x0004 #define QEMU_AIO_FLUSH 0x0008 #define QEMU_AIO_DISCARD 0x0010 +#define QEMU_AIO_WRITE_ZEROES 0x0020 #define QEMU_AIO_TYPE_MASK \ (QEMU_AIO_READ|QEMU_AIO_WRITE|QEMU_AIO_IOCTL|QEMU_AIO_FLUSH| \ - QEMU_AIO_DISCARD) + QEMU_AIO_DISCARD|QEMU_AIO_WRITE_ZEROES) /* AIO flags */ #define QEMU_AIO_MISALIGNED 0x1000 |