From 5a612c009ee538a3b32c896f9a6c5562a50efe9d Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Thu, 13 Jul 2017 18:30:25 +0300 Subject: block: pass bdrv_* methods to bs->file by default in block filters The following functions fail if bs->drv is a filter and does not implement them: bdrv_probe_blocksizes bdrv_probe_geometry bdrv_truncate bdrv_has_zero_init bdrv_get_info Instead, the call should be passed to bs->file if it exists, to allow filter drivers to support those methods without implementing them. This commit makes `drv->is_filter = true` imply that these callbacks will be forwarded to bs->file by default, so disabling support for these functions must be done explicitly. Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Signed-off-by: Manos Pitsidianakis Signed-off-by: Kevin Wolf --- include/block/block_int.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/block/block_int.h b/include/block/block_int.h index 7571c0aaaf..71183cc76e 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -87,7 +87,11 @@ struct BlockDriver { const char *format_name; int instance_size; - /* set to true if the BlockDriver is a block filter */ + /* set to true if the BlockDriver is a block filter. Block filters pass + * certain callbacks that refer to data (see block.c) to their bs->file if + * the driver doesn't implement them. Drivers that do not wish to forward + * must implement them and return -ENOTSUP. + */ bool is_filter; /* for snapshots block filter like Quorum can implement the * following recursive callback. -- cgit v1.2.3-55-g7522