mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-04 21:47:16 +03:00
Shrink volume even with ALLOCATE flag
Calling fallocate on the new (smaller) capacity ensures that the whole file is allocated, but it does not reduce the file size. Also call ftruncate after fallocate. https://bugzilla.redhat.com/show_bug.cgi?id=1366446
This commit is contained in:
parent
3f702f5ab1
commit
959fe7de1f
@ -1338,13 +1338,13 @@ virStorageFileResize(const char *path,
|
||||
}
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
if (ftruncate(fd, capacity) < 0) {
|
||||
virReportSystemError(errno,
|
||||
_("Failed to truncate file '%s'"), path);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
if (VIR_CLOSE(fd) < 0) {
|
||||
virReportSystemError(errno, _("Unable to save '%s'"), path);
|
||||
|
Loading…
x
Reference in New Issue
Block a user