Am 30.09.2026 um 18:49 hat Denis V. Lunev geschrieben:
> From: Denis V. Lunev <[email protected]>
>
> The preallocate filter only does anything for a write that lands beyond
> the end of its file, and that is what a format driver above it produces.
> qemu-io could not produce it at all: the backend rejects such a request
> with EIO, and the write path asserts without the resize permission, so
> the filter could only be reached by stacking a real format on top and
> letting it choose the offsets.
>
> Take the resize permission and allow writes beyond the end when -g is
> given, which leaves the tool free to address the filter directly.
>
> Signed-off-by: Denis V. Lunev <[email protected]>
> CC: Kevin Wolf <[email protected]>
> CC: Hanna Reitz <[email protected]>
> CC: Vladimir Sementsov-Ogievskiy <[email protected]>
> CC: Andrey Drobyshev <[email protected]>
> @@ -310,6 +330,8 @@ static void usage(const char *name)
> " specify tracing options\n"
> " see qemu-img(1) man page for full description\n"
> " -U, --force-share force shared permissions\n"
> +" -g, --grow let writes extend the image past its end,\n"
> +" as a format driver does to its file\n"
> " -h, --help display this help and exit\n"
> " -V, --version output version information and exit\n"
> "\n"
> @@ -503,7 +525,7 @@ static QemuOptsList file_opts = {
> int main(int argc, char **argv)
> {
> int readonly = 0;
> - const char *sopt = "hVc:d:f:rsnCmki:t:T:U";
> + const char *sopt = "hVc:d:f:grsnCmki:t:T:U";
> const struct option lopt[] = {
> { "help", no_argument, NULL, 'h' },
> { "version", no_argument, NULL, 'V' },
> @@ -522,6 +544,7 @@ int main(int argc, char **argv)
> { "object", required_argument, NULL, OPTION_OBJECT },
> { "image-opts", no_argument, NULL, OPTION_IMAGE_OPTS },
> { "force-share", no_argument, 0, 'U'},
> + { "grow", no_argument, NULL, 'g' },
> { NULL, 0, NULL, 0 }
> };
--growable instead of just --grow would be more consistent with the
terminology we use elsewhere (e.g. block export interfaces).
Kevin