[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v3 03/13] file-posix: support BDRV_REQ_ALLOCATE
From: |
Anton Nefedov |
Subject: |
[Qemu-block] [PATCH v3 03/13] file-posix: support BDRV_REQ_ALLOCATE |
Date: |
Mon, 31 Jul 2017 19:21:55 +0300 |
Current write_zeroes implementation is good enough to satisfy this flag too
Signed-off-by: Anton Nefedov <address@hidden>
---
block/file-posix.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/block/file-posix.c b/block/file-posix.c
index cfbb236..bd52b31 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -527,7 +527,6 @@ static int raw_open_common(BlockDriverState *bs, QDict
*options,
s->has_discard = true;
s->has_write_zeroes = true;
- bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP;
if ((bs->open_flags & BDRV_O_NOCACHE) != 0) {
s->needs_alignment = true;
}
@@ -577,6 +576,11 @@ static int raw_open_common(BlockDriverState *bs, QDict
*options,
}
#endif
+ bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP;
+ if (s->has_write_zeroes || s->has_fallocate) {
+ bs->supported_zero_flags |= BDRV_REQ_ALLOCATE;
+ }
+
ret = 0;
fail:
if (filename && (bdrv_flags & BDRV_O_TEMPORARY)) {
@@ -1390,6 +1394,9 @@ static ssize_t handle_aiocb_write_zeroes(RawPosixAIOData
*aiocb)
}
#endif
+ if (!s->has_fallocate) {
+ aiocb->bs->supported_zero_flags &= ~BDRV_REQ_ALLOCATE;
+ }
return -ENOTSUP;
}
--
2.7.4
- [Qemu-block] [PATCH v3 00/13] qcow2: space preallocation and COW improvements, Anton Nefedov, 2017/07/31
- [Qemu-block] [PATCH v3 02/13] block: treat BDRV_REQ_ALLOCATE as serialising, Anton Nefedov, 2017/07/31
- [Qemu-block] [PATCH v3 04/13] block: support BDRV_REQ_ALLOCATE in passthrough drivers, Anton Nefedov, 2017/07/31
- [Qemu-block] [PATCH v3 05/13] qcow2: preallocation at image expand, Anton Nefedov, 2017/07/31
- [Qemu-block] [PATCH v3 03/13] file-posix: support BDRV_REQ_ALLOCATE,
Anton Nefedov <=
- [Qemu-block] [PATCH v3 06/13] qcow2: set inactive flag, Anton Nefedov, 2017/07/31
- [Qemu-block] [PATCH v3 01/13] block: introduce BDRV_REQ_ALLOCATE flag, Anton Nefedov, 2017/07/31
- [Qemu-block] [PATCH v3 07/13] qcow2: truncate preallocated space, Anton Nefedov, 2017/07/31
- [Qemu-block] [PATCH v3 10/13] qcow2: skip writing zero buffers to empty COW areas, Anton Nefedov, 2017/07/31
- [Qemu-block] [PATCH v3 09/13] qcow2: move is_zero_sectors() up, Anton Nefedov, 2017/07/31
- [Qemu-block] [PATCH v3 13/13] iotest 134: test cluster-misaligned encrypted write, Anton Nefedov, 2017/07/31
- [Qemu-block] [PATCH v3 11/13] qcow2: allocate image space by-cluster, Anton Nefedov, 2017/07/31
- [Qemu-block] [PATCH v3 08/13] qcow2: check space leak at the end of the image, Anton Nefedov, 2017/07/31
- [Qemu-block] [PATCH v3 12/13] iotest 190: test BDRV_REQ_ALLOCATE, Anton Nefedov, 2017/07/31