On Mon, Jun 26, 2017 at 03:30:55PM +0100, Stefan Hajnoczi wrote:
+static BlockDriver bdrv_throttle = {
+    .format_name                        =   "throttle",
+    .protocol_name                      =   "throttle",
+    .instance_size                      =   sizeof(ThrottleGroupMember),
+
+    .bdrv_file_open                     =   throttle_open,
+    .bdrv_close                         =   throttle_close,
+    .bdrv_co_flush                      =   throttle_co_flush,
+
+    .bdrv_child_perm                    =   bdrv_filter_default_perms,
+
+    .bdrv_getlength                     =   throttle_getlength,
+
+    .bdrv_co_preadv                     =   throttle_co_preadv,
+    .bdrv_co_pwritev                    =   throttle_co_pwritev,
+
+    .bdrv_co_pwrite_zeroes              =   throttle_co_pwrite_zeroes,
+    .bdrv_co_pdiscard                   =   throttle_co_pdiscard,
+
+    .bdrv_recurse_is_first_non_filter   =   bdrv_recurse_is_first_non_filter,
+
+    .bdrv_attach_aio_context            =   throttle_attach_aio_context,
+    .bdrv_detach_aio_context            =   throttle_detach_aio_context,
+
+    .bdrv_reopen_prepare                =   throttle_reopen_prepare,
+    .bdrv_reopen_commit                 =   throttle_reopen_commit,
+    .bdrv_reopen_abort                  =   throttle_reopen_abort,
+
+    .is_filter                          =   true,
+};

Missing:
bdrv_co_get_block_status()
bdrv_truncate()
bdrv_get_info()
bdrv_probe_blocksizes()
bdrv_probe_geometry()
bdrv_media_changed()
bdrv_eject()
bdrv_lock_medium()
bdrv_co_ioctl()

See block/raw-format.c.

I think most of these could be modified in block.c or block/io.c to
automatically call bs->file's function if drv doesn't implement them.
This way all block drivers would transparently pass them through by
default and block/raw-format.c code could be eliminated.

Are these truly necessary? Because other filter drivers (ie quorum, blkverify) don't implement them.

Attachment: signature.asc
Description: PGP signature

Reply via email to