[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v12 07/10] file-posix: support BDRV_REQ_ALLOCATE
From: |
Anton Nefedov |
Subject: |
[Qemu-devel] [PATCH v12 07/10] file-posix: support BDRV_REQ_ALLOCATE |
Date: |
Mon, 14 Jan 2019 11:18:28 +0000 |
Current write_zeroes implementation is good enough to satisfy this flag too
Signed-off-by: Anton Nefedov <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
---
block/file-posix.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/block/file-posix.c b/block/file-posix.c
index 8d3ec96627..dac218ec7f 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -607,6 +607,7 @@ static int raw_open_common(BlockDriverState *bs, QDict
*options,
} else {
s->discard_zeroes = true;
s->has_fallocate = true;
+ bs->supported_zero_flags = BDRV_REQ_ALLOCATE;
}
} else {
if (!(S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode))) {
@@ -650,10 +651,11 @@ static int raw_open_common(BlockDriverState *bs, QDict
*options,
#ifdef CONFIG_XFS
if (platform_test_xfs_fd(s->fd)) {
s->is_xfs = true;
+ bs->supported_zero_flags = BDRV_REQ_ALLOCATE;
}
#endif
- bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP;
+ bs->supported_zero_flags |= BDRV_REQ_MAY_UNMAP;
ret = 0;
fail:
if (filename && (bdrv_flags & BDRV_O_TEMPORARY)) {
@@ -1552,6 +1554,10 @@ static int handle_aiocb_write_zeroes(void *opaque)
s->has_fallocate = false;
#endif
+ if (!s->has_fallocate) {
+ aiocb->bs->supported_zero_flags &= ~BDRV_REQ_ALLOCATE;
+ }
+
return -ENOTSUP;
}
--
2.17.1
- [Qemu-devel] [PATCH v12 00/10] qcow2: cluster space preallocation, Anton Nefedov, 2019/01/14
- [Qemu-devel] [PATCH v12 09/10] qcow2: skip writing zero buffers to empty COW areas, Anton Nefedov, 2019/01/14
- [Qemu-devel] [PATCH v12 02/10] blkverify: set supported write/zero flags, Anton Nefedov, 2019/01/14
- [Qemu-devel] [PATCH v12 04/10] block: introduce BDRV_REQ_ALLOCATE flag, Anton Nefedov, 2019/01/14
- [Qemu-devel] [PATCH v12 08/10] block: support BDRV_REQ_ALLOCATE in passthrough drivers, Anton Nefedov, 2019/01/14
- [Qemu-devel] [PATCH v12 01/10] mirror: inherit supported write/zero flags, Anton Nefedov, 2019/01/14
- [Qemu-devel] [PATCH v12 07/10] file-posix: support BDRV_REQ_ALLOCATE,
Anton Nefedov <=
- [Qemu-devel] [PATCH v12 03/10] quorum: set supported write flags, Anton Nefedov, 2019/01/14
- [Qemu-devel] [PATCH v12 06/10] file-posix: reset fallocate-related flags without CONFIG_FALLOCATE*, Anton Nefedov, 2019/01/14
- [Qemu-devel] [PATCH v12 10/10] iotest 134: test cluster-misaligned encrypted write, Anton Nefedov, 2019/01/14
- [Qemu-devel] [PATCH v12 05/10] block: treat BDRV_REQ_ALLOCATE as serialising, Anton Nefedov, 2019/01/14