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 <d...@openvz.org> CC: Vladimir Sementsov-Ogievskiy <vsement...@yandex-team.ru> CC: Andrey Drobyshev <andrey.drobys...@virtuozzo.com> CC: Kevin Wolf <kw...@redhat.com> CC: Hanna Reitz <hre...@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