Commit db3869d1 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

bdev/rpc: Factor out start RPC response of bdev_get_iostat



This is a preparation for the next patch to fix the race condition of
per channel mode.

Signed-off-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I9eaefc527ccf82011af39b8261f5b3cc12983bda
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16365


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 69d4ec07
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -175,15 +175,21 @@ struct bdev_get_iostat_ctx {
};

static void
rpc_get_iostat_started(struct rpc_get_iostat_ctx *rpc_ctx, struct spdk_bdev_desc *desc)
_rpc_get_iostat_started(struct rpc_get_iostat_ctx *rpc_ctx)
{
	struct spdk_bdev *bdev;

	rpc_ctx->w = spdk_jsonrpc_begin_result(rpc_ctx->request);

	spdk_json_write_object_begin(rpc_ctx->w);
	spdk_json_write_named_uint64(rpc_ctx->w, "tick_rate", spdk_get_ticks_hz());
	spdk_json_write_named_uint64(rpc_ctx->w, "ticks", spdk_get_ticks());
}

static void
rpc_get_iostat_started(struct rpc_get_iostat_ctx *rpc_ctx, struct spdk_bdev_desc *desc)
{
	struct spdk_bdev *bdev;

	_rpc_get_iostat_started(rpc_ctx);

	if (rpc_ctx->per_channel == false) {
		spdk_json_write_named_array_begin(rpc_ctx->w, "bdevs");