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

Denis V. Lunev via posted 6 patches 4 weeks ago
[PATCH 2/6] preallocate: do not enable filter inside preallocate_co_getlength()
Posted by Denis V. Lunev via 4 weeks ago
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