Message ID | 20220712021345.8530-10-faithilikerun@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add support for zoned device | expand |
On 7/12/22 11:13, Sam Li wrote: > --- > block/file-posix.c | 8 +++++++- > qapi/block-core.json | 7 +++++-- > 2 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/block/file-posix.c b/block/file-posix.c > index e9ad1d8e1e..4e0aa02acf 100644 > --- a/block/file-posix.c > +++ b/block/file-posix.c > @@ -3737,6 +3737,12 @@ static void hdev_parse_filename(const char *filename, QDict *options, > bdrv_parse_filename_strip_prefix(filename, "host_device:", options); > } > > +static void zoned_host_device_parse_filename(const char *filename, QDict *options, > + Error **errp) > +{ > + bdrv_parse_filename_strip_prefix(filename, "zoned_host_device:", options); > +} > + > static bool hdev_is_sg(BlockDriverState *bs) > { > > @@ -3975,7 +3981,7 @@ static BlockDriver bdrv_zoned_host_device = { > .is_zoned = true, > .bdrv_needs_filename = true, > .bdrv_probe_device = hdev_probe_device, > - .bdrv_parse_filename = hdev_parse_filename, > + .bdrv_parse_filename = zoned_host_device_parse_filename, > .bdrv_file_open = hdev_open, > .bdrv_close = raw_close, > .bdrv_reopen_prepare = raw_reopen_prepare, > diff --git a/qapi/block-core.json b/qapi/block-core.json > index 2173e7734a..ab05c2ef99 100644 > --- a/qapi/block-core.json > +++ b/qapi/block-core.json > @@ -2955,7 +2955,8 @@ > 'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels', > 'preallocate', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd', > { 'name': 'replication', 'if': 'CONFIG_REPLICATION' }, > - 'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] } > + 'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', > + { 'name': 'zoned_host_device', 'if': 'HAVE_HOST_BLOCK_DEVICE' } ] } This needs to be something like: { 'name': 'zoned_host_device', 'if': 'CONFIG_BLKZONED' } ] } And we need to make sure CONFIG_BLKZONED is defined if and only if we also have HAVE_HOST_BLOCK_DEVICE. > > ## > # @BlockdevOptionsFile: > @@ -4329,7 +4330,9 @@ > 'vhdx': 'BlockdevOptionsGenericFormat', > 'vmdk': 'BlockdevOptionsGenericCOWFormat', > 'vpc': 'BlockdevOptionsGenericFormat', > - 'vvfat': 'BlockdevOptionsVVFAT' > + 'vvfat': 'BlockdevOptionsVVFAT', > + 'zoned_host_device': { 'type': 'BlockdevOptionsFile', > + 'if': 'HAVE_HOST_BLOCK_DEVICE' } Same here I think. > } } > > ##
On Mon, 11 Jul 2022 at 22:31, Sam Li <faithilikerun@gmail.com> wrote: > > --- > block/file-posix.c | 8 +++++++- > qapi/block-core.json | 7 +++++-- > 2 files changed, 12 insertions(+), 3 deletions(-) Please squash this into the patch that adds zoned_host_device. Stefan
diff --git a/block/file-posix.c b/block/file-posix.c index e9ad1d8e1e..4e0aa02acf 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -3737,6 +3737,12 @@ static void hdev_parse_filename(const char *filename, QDict *options, bdrv_parse_filename_strip_prefix(filename, "host_device:", options); } +static void zoned_host_device_parse_filename(const char *filename, QDict *options, + Error **errp) +{ + bdrv_parse_filename_strip_prefix(filename, "zoned_host_device:", options); +} + static bool hdev_is_sg(BlockDriverState *bs) { @@ -3975,7 +3981,7 @@ static BlockDriver bdrv_zoned_host_device = { .is_zoned = true, .bdrv_needs_filename = true, .bdrv_probe_device = hdev_probe_device, - .bdrv_parse_filename = hdev_parse_filename, + .bdrv_parse_filename = zoned_host_device_parse_filename, .bdrv_file_open = hdev_open, .bdrv_close = raw_close, .bdrv_reopen_prepare = raw_reopen_prepare, diff --git a/qapi/block-core.json b/qapi/block-core.json index 2173e7734a..ab05c2ef99 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2955,7 +2955,8 @@ 'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels', 'preallocate', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd', { 'name': 'replication', 'if': 'CONFIG_REPLICATION' }, - 'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] } + 'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', + { 'name': 'zoned_host_device', 'if': 'HAVE_HOST_BLOCK_DEVICE' } ] } ## # @BlockdevOptionsFile: @@ -4329,7 +4330,9 @@ 'vhdx': 'BlockdevOptionsGenericFormat', 'vmdk': 'BlockdevOptionsGenericCOWFormat', 'vpc': 'BlockdevOptionsGenericFormat', - 'vvfat': 'BlockdevOptionsVVFAT' + 'vvfat': 'BlockdevOptionsVVFAT', + 'zoned_host_device': { 'type': 'BlockdevOptionsFile', + 'if': 'HAVE_HOST_BLOCK_DEVICE' } } } ##