On 18.03.2016 19:21, Kevin Wolf wrote: > Signed-off-by: Kevin Wolf <[email protected]> > --- > qemu-img.c | 79 > ++++++++++++++++++++++++++++++++++++++------------------------ > 1 file changed, 48 insertions(+), 31 deletions(-) > > diff --git a/qemu-img.c b/qemu-img.c > index 839e05b..96b51d4 100644 > --- a/qemu-img.c > +++ b/qemu-img.c
[...]
> @@ -2862,26 +2874,30 @@ static int img_rebase(int argc, char **argv)
> qemu_progress_print(0, 100);
>
> flags = BDRV_O_RDWR | (unsafe ? BDRV_O_NO_BACKING : 0);
> - ret = bdrv_parse_cache_flags(cache, &flags);
> + ret = bdrv_parse_cache_mode(cache, &flags, &writethrough);
> if (ret < 0) {
> error_report("Invalid cache option: %s", cache);
> goto out;
> }
>
> - src_flags = BDRV_O_CACHE_WB;
> - ret = bdrv_parse_cache_flags(src_cache, &src_flags);
> + src_flags = 0;
> + ret = bdrv_parse_cache_mode(src_cache, &src_flags, &src_writethrough);
> if (ret < 0) {
> error_report("Invalid source cache option: %s", src_cache);
> goto out;
> }
>
> + /* The source files are opened read-only, don't care about WCE */
> + assert((src_writethrough & BDRV_O_RDWR) == 0);
Well, yeah, that is a trivial assertion to make because BDRV_O_RDWR is 2.
I guess you meant s/src_writethrough/src_flags/.
With that fixed:
Reviewed-by: Max Reitz <[email protected]>
> + (void) src_writethrough;
> +
> /*
> * Open the images.
> *
> * Ignore the old backing file for unsafe rebase in case we want to
> correct
> * the reference to a renamed or moved backing file.
> */
> - blk = img_open(image_opts, filename, fmt, flags, true, quiet);
> + blk = img_open(image_opts, filename, fmt, flags, true, writethrough,
> quiet);
> if (!blk) {
> ret = -1;
> goto out;
signature.asc
Description: OpenPGP digital signature
