[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v10 6/9] file-posix: support BDRV_REQ_ALLOCATE
From: |
Anton Nefedov |
Subject: |
[Qemu-block] [PATCH v10 6/9] file-posix: support BDRV_REQ_ALLOCATE |
Date: |
Mon, 3 Dec 2018 10:14:58 +0000 |
Current write_zeroes implementation is good enough to satisfy this flag too
Signed-off-by: Anton Nefedov <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 07bbdab953..b0b7ab0159 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -603,6 +603,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))) {
@@ -646,10 +647,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)) {
@@ -1520,6 +1522,10 @@ static ssize_t handle_aiocb_write_zeroes(RawPosixAIOData
*aiocb)
}
s->has_fallocate = false;
}
+
+ if (!s->has_fallocate) {
+ aiocb->bs->supported_zero_flags &= ~BDRV_REQ_ALLOCATE;
+ }
#endif
return -ENOTSUP;
--
2.17.1
- Re: [Qemu-block] [PATCH v10 1/9] mirror: inherit supported write/zero flags, (continued)
- [Qemu-block] [PATCH v10 6/9] file-posix: support BDRV_REQ_ALLOCATE,
Anton Nefedov <=
Re: [Qemu-block] [PATCH v10 6/9] file-posix: support BDRV_REQ_ALLOCATE, Alberto Garcia, 2018/12/07
[Qemu-block] [PATCH v10 9/9] iotest 134: test cluster-misaligned encrypted write, Anton Nefedov, 2018/12/03
[Qemu-block] [PATCH v10 5/9] block: treat BDRV_REQ_ALLOCATE as serialising, Anton Nefedov, 2018/12/03