qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/6] preallocate: do not enable filter inside preallocate_co_getl


From: Denis V. Lunev
Subject: [PATCH 2/6] preallocate: do not enable filter inside preallocate_co_getlength()
Date: Thu, 28 Nov 2024 19:25:49 +0100

Let us auto-enable it inside handle_write() and truncate(), i.e. on the
actual write operation. This just makes things more relaxing.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
CC: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Hanna Reitz <hreitz@redhat.com>
---
 block/preallocate.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/block/preallocate.c b/block/preallocate.c
index c14e6a530d..d0ed56eecb 100644
--- a/block/preallocate.c
+++ b/block/preallocate.c
@@ -494,20 +494,13 @@ static int coroutine_fn GRAPH_RDLOCK 
preallocate_co_flush(BlockDriverState *bs)
 static int64_t coroutine_fn GRAPH_RDLOCK
 preallocate_co_getlength(BlockDriverState *bs)
 {
-    int64_t ret;
     BDRVPreallocateState *s = bs->opaque;
 
     if (s->data_end >= 0) {
         return s->data_end;
     }
 
-    ret = bdrv_co_getlength(bs->file->bs);
-
-    if (has_prealloc_perms(bs)) {
-        s->file_end = s->zero_start = s->data_end = ret;
-    }
-
-    return ret;
+    return bdrv_co_getlength(bs->file->bs);
 }
 
 static int GRAPH_RDLOCK
-- 
2.45.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]