mirror of
https://github.com/mii443/qemu.git
synced 2025-08-30 10:59:53 +00:00
block: bdrv_has_zero_init
This fixes the problem that qemu-img's use of no_zero_init only considered the no_zero_init flag of the format driver, but not of the underlying protocols. Between the raw/file split and this fix, converting to host devices is broken. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
13
block.c
13
block.c
@ -1282,6 +1282,19 @@ void bdrv_flush_all(void)
|
||||
}
|
||||
}
|
||||
|
||||
int bdrv_has_zero_init(BlockDriverState *bs)
|
||||
{
|
||||
assert(bs->drv);
|
||||
|
||||
if (bs->drv->no_zero_init) {
|
||||
return 0;
|
||||
} else if (bs->file) {
|
||||
return bdrv_has_zero_init(bs->file);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true iff the specified sector is present in the disk image. Drivers
|
||||
* not implementing the functionality are assumed to not support backing files,
|
||||
|
Reference in New Issue
Block a user