[libvirt] [PATCH] storage_backend: Drop unused code

This has been disabled for years --- src/storage/storage_backend.c | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index e5c9209..0fd4598 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -115,8 +115,6 @@ static virStorageBackendPtr backends[] = { NULL }; -static int track_allocation_progress = 0; - enum { TOOL_QEMU_IMG, TOOL_KVM_IMG, @@ -342,31 +340,11 @@ createRawFile(int fd, virStorageVolDefPtr vol, } if (remain) { - if (track_allocation_progress) { - while (remain) { - /* Allocate in chunks of 512MiB: big-enough chunk - * size and takes approx. 9s on ext3. A progress - * update every 9s is a fair-enough trade-off - */ - unsigned long long bytes = 512 * 1024 * 1024; - - if (bytes > remain) - bytes = remain; - if (safezero(fd, vol->allocation - remain, bytes) < 0) { - ret = -errno; - virReportSystemError(errno, _("cannot fill file '%s'"), - vol->target.path); - goto cleanup; - } - remain -= bytes; - } - } else { /* No progress bars to be shown */ - if (safezero(fd, 0, remain) < 0) { - ret = -errno; - virReportSystemError(errno, _("cannot fill file '%s'"), - vol->target.path); - goto cleanup; - } + if (safezero(fd, 0, remain) < 0) { + ret = -errno; + virReportSystemError(errno, _("cannot fill file '%s'"), + vol->target.path); + goto cleanup; } } -- 1.8.2.1

On 10/06/13 23:17, Cole Robinson wrote:
This has been disabled for years --- src/storage/storage_backend.c | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index e5c9209..0fd4598 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -115,8 +115,6 @@ static virStorageBackendPtr backends[] = { NULL };
-static int track_allocation_progress = 0; - enum { TOOL_QEMU_IMG, TOOL_KVM_IMG, @@ -342,31 +340,11 @@ createRawFile(int fd, virStorageVolDefPtr vol, }
if (remain) { - if (track_allocation_progress) { - while (remain) { - /* Allocate in chunks of 512MiB: big-enough chunk - * size and takes approx. 9s on ext3. A progress - * update every 9s is a fair-enough trade-off - */ - unsigned long long bytes = 512 * 1024 * 1024; - - if (bytes > remain) - bytes = remain; - if (safezero(fd, vol->allocation - remain, bytes) < 0) { - ret = -errno; - virReportSystemError(errno, _("cannot fill file '%s'"), - vol->target.path); - goto cleanup; - } - remain -= bytes; - } - } else { /* No progress bars to be shown */ - if (safezero(fd, 0, remain) < 0) { - ret = -errno; - virReportSystemError(errno, _("cannot fill file '%s'"), - vol->target.path); - goto cleanup; - } + if (safezero(fd, 0, remain) < 0) { + ret = -errno; + virReportSystemError(errno, _("cannot fill file '%s'"), + vol->target.path); + goto cleanup; } }
ACK.

On 06/10/2013 11:38 AM, Osier Yang wrote:
On 10/06/13 23:17, Cole Robinson wrote:
This has been disabled for years --- src/storage/storage_backend.c | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index e5c9209..0fd4598 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -115,8 +115,6 @@ static virStorageBackendPtr backends[] = { NULL }; -static int track_allocation_progress = 0; - enum { TOOL_QEMU_IMG, TOOL_KVM_IMG, @@ -342,31 +340,11 @@ createRawFile(int fd, virStorageVolDefPtr vol, } if (remain) { - if (track_allocation_progress) { - while (remain) { - /* Allocate in chunks of 512MiB: big-enough chunk - * size and takes approx. 9s on ext3. A progress - * update every 9s is a fair-enough trade-off - */ - unsigned long long bytes = 512 * 1024 * 1024; - - if (bytes > remain) - bytes = remain; - if (safezero(fd, vol->allocation - remain, bytes) < 0) { - ret = -errno; - virReportSystemError(errno, _("cannot fill file '%s'"), - vol->target.path); - goto cleanup; - } - remain -= bytes; - } - } else { /* No progress bars to be shown */ - if (safezero(fd, 0, remain) < 0) { - ret = -errno; - virReportSystemError(errno, _("cannot fill file '%s'"), - vol->target.path); - goto cleanup; - } + if (safezero(fd, 0, remain) < 0) { + ret = -errno; + virReportSystemError(errno, _("cannot fill file '%s'"), + vol->target.path); + goto cleanup; } }
Thanks, pushed. - Cole

On 10.06.2013 17:17, Cole Robinson wrote:
This has been disabled for years --- src/storage/storage_backend.c | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-)
This while code will be overwritten while introducing a job control to the storage driver. I think this can go in meanwhile. ACK Michal
participants (3)
-
Cole Robinson
-
Michal Privoznik
-
Osier Yang