diff mbox series

[2/6] preallocate: do not enable filter inside preallocate_co_getlength()

Message ID 20241128183911.837699-3-den@openvz.org (mailing list archive)
State New
Headers show
Series block/preallocate: fix image truncation logic | expand

Commit Message

Denis V. Lunev" via Nov. 28, 2024, 6:25 p.m. UTC
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 mbox series

Patch

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