diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 07dba222205e48a147aa4b026a94ed1e67da3456..b94b3f397c6875ad45e259a8cd807393f7c46172 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -2329,8 +2329,7 @@ virStorageBackendVolResizeLocal(virConnectPtr conn ATTRIBUTE_UNUSED, bool pre_allocate = flags & VIR_STORAGE_VOL_RESIZE_ALLOCATE; if (vol->target.format == VIR_STORAGE_FILE_RAW) { - return virStorageFileResize(vol->target.path, capacity, - vol->target.allocation, pre_allocate); + return virStorageFileResize(vol->target.path, capacity, pre_allocate); } else if (vol->target.format == VIR_STORAGE_FILE_PLOOP) { return storagePloopResize(vol, capacity); } else { diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index b3da0a4528c044a121eaa8b6bbd5e8edf3975558..5df1ea0b8d679cf09777a165fe1e6ae3e296f07e 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1315,17 +1315,11 @@ virStorageFileChainGetBroken(virStorageSourcePtr chain, int virStorageFileResize(const char *path, unsigned long long capacity, - unsigned long long orig_capacity, bool pre_allocate) { int fd = -1; int ret = -1; int rc; - off_t offset ATTRIBUTE_UNUSED; - off_t len ATTRIBUTE_UNUSED; - - offset = orig_capacity; - len = capacity - orig_capacity; if ((fd = open(path, O_RDWR)) < 0) { virReportSystemError(errno, _("Unable to open '%s'"), path); @@ -1333,7 +1327,7 @@ virStorageFileResize(const char *path, } if (pre_allocate) { - if ((rc = virFileAllocate(fd, offset, len)) != 0) { + if ((rc = virFileAllocate(fd, 0, capacity)) != 0) { if (rc == -2) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("preallocate is not supported on this platform")); diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index f7e897f25e824cf55aef0b826b049814cd1bc58a..1eb1c6471cd6946f18cfa76f94d088a37d7ecfc5 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -328,7 +328,6 @@ virStorageSourcePtr virStorageFileChainLookup(virStorageSourcePtr chain, int virStorageFileResize(const char *path, unsigned long long capacity, - unsigned long long orig_capacity, bool pre_allocate); int virStorageFileIsClusterFS(const char *path);