bdev/uring: add JSON config dump

Signed-off-by: Yao Liu <yotta.liu@ucloud.cn>
Change-Id: Ic060a62f20c97dcc0c52ad761f848074efaade3d
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474180
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Yao Liu 2019-11-13 19:11:47 +08:00 committed by Tomasz Zawadzki
parent bc7b39a5f0
commit c8ef5793e3

View File

@ -381,12 +381,31 @@ bdev_uring_dump_info_json(void *ctx, struct spdk_json_write_ctx *w)
return 0; return 0;
} }
static void
bdev_uring_write_json_config(struct spdk_bdev *bdev, struct spdk_json_write_ctx *w)
{
struct bdev_uring *uring = bdev->ctxt;
spdk_json_write_object_begin(w);
spdk_json_write_named_string(w, "method", "bdev_uring_create");
spdk_json_write_named_object_begin(w, "params");
spdk_json_write_named_string(w, "name", bdev->name);
spdk_json_write_named_uint32(w, "block_size", bdev->blocklen);
spdk_json_write_named_string(w, "filename", uring->filename);
spdk_json_write_object_end(w);
spdk_json_write_object_end(w);
}
static const struct spdk_bdev_fn_table uring_fn_table = { static const struct spdk_bdev_fn_table uring_fn_table = {
.destruct = bdev_uring_destruct, .destruct = bdev_uring_destruct,
.submit_request = bdev_uring_submit_request, .submit_request = bdev_uring_submit_request,
.io_type_supported = bdev_uring_io_type_supported, .io_type_supported = bdev_uring_io_type_supported,
.get_io_channel = bdev_uring_get_io_channel, .get_io_channel = bdev_uring_get_io_channel,
.dump_info_json = bdev_uring_dump_info_json, .dump_info_json = bdev_uring_dump_info_json,
.write_config_json = bdev_uring_write_json_config,
}; };
static void uring_free_bdev(struct bdev_uring *uring) static void uring_free_bdev(struct bdev_uring *uring)