[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v7 08/21] block: introduce preallocate filter
From: |
Max Reitz |
Subject: |
Re: [PATCH v7 08/21] block: introduce preallocate filter |
Date: |
Fri, 13 Nov 2020 15:32:52 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 |
On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:
It's intended to be inserted between format and protocol nodes to
preallocate additional space (expanding protocol file) on writes
crossing EOF. It improves performance for file-systems with slow
allocation.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
docs/system/qemu-block-drivers.rst.inc | 26 ++
qapi/block-core.json | 20 +-
block/preallocate.c | 559 +++++++++++++++++++++++++
block/meson.build | 1 +
4 files changed, 605 insertions(+), 1 deletion(-)
create mode 100644 block/preallocate.c
[...]
+ if (end <= s->file_end) {
+ /* No preallocation needed. */
+ return want_merge_zero && offset >= s->zero_start;
+ }
+
+ /* Now we want new preallocation, as request writes beyond s->data_end. */
True, but isn’t s->file_end more important?
+
+ prealloc_start = want_merge_zero ? MIN(offset, s->file_end) : s->file_end;
+ prealloc_end = QEMU_ALIGN_UP(end + s->opts.prealloc_size,
+ s->opts.prealloc_align);
[...]
+ if (prealloc == PREALLOC_MODE_FALLOC) {
+ /*
+ * If offset <= s->file_end, the task is already done, just
+ * update s->file_end, to move part of "filter preallocation"
s/file_end/data_end/
With those fixed, and with %s/5\.2/6.0/:
Reviewed-by: Max Reitz <mreitz@redhat.com>
+ * to "preallocation requested by user".
+ * Otherwise just proceed to preallocate missing part.
+ */
+ if (offset <= s->file_end) {
+ s->data_end = offset;
+ return 0;
+ }
- Re: [PATCH v7 08/21] block: introduce preallocate filter,
Max Reitz <=