Commit 915270db authored by Jim Harris's avatar Jim Harris
Browse files

bdev: make bdevs array for get_bdevs_iostat RPC



Fixes issue #775.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I5e07084599c2363b64619f38bd826fe100217020

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452477


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarSeth Howell <seth.howell5141@gmail.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent e13da83e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -14,6 +14,12 @@ The function `spdk_notify_get_types()` and `spdk_notify_get_events()` were
renamed to `spdk_notify_foreach_type()` and `spdk_notify_foreach_event()`,
respectively. And update type name of callback accordingly.

### bdev

The format of the data returned by the get_bdevs_iostat RPC has changed to
make it easier to parse.  It now returns an object with a "ticks" object
and "bdevs" array with the per-bdev statistics.

## v19.04:

### nvme
+21 −21
Original line number Diff line number Diff line
@@ -623,10 +623,9 @@ Example response:
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "tick_rate": 2200000000
    },
  "result": {
    "tick_rate": 2200000000,
    "bdevs" : [
      {
        "name": "Nvme0n1",
        "bytes_read": 36864,
@@ -645,6 +644,7 @@ Example response:
      }
    ]
  }
}
~~~

## enable_bdev_histogram {#rpc_enable_bdev_histogram}
+4 −2
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ done:
	free(stat);
	if (--ctx->bdev_count == 0) {
		spdk_json_write_array_end(ctx->w);
		spdk_json_write_object_end(w);
		spdk_jsonrpc_end_result(ctx->request, ctx->w);
		free(ctx);
	}
@@ -171,11 +172,11 @@ spdk_rpc_get_bdevs_iostat(struct spdk_jsonrpc_request *request,
	ctx->request = request;
	ctx->w = w;

	spdk_json_write_array_begin(w);

	spdk_json_write_object_begin(w);
	spdk_json_write_named_uint64(w, "tick_rate", spdk_get_ticks_hz());
	spdk_json_write_object_end(w);

	spdk_json_write_named_array_begin(w, "bdevs");

	if (bdev != NULL) {
		stat = calloc(1, sizeof(struct spdk_bdev_io_stat));
@@ -199,6 +200,7 @@ spdk_rpc_get_bdevs_iostat(struct spdk_jsonrpc_request *request,

	if (--ctx->bdev_count == 0) {
		spdk_json_write_array_end(w);
		spdk_json_write_object_end(w);
		spdk_jsonrpc_end_result(request, w);
		free(ctx);
	}
+4 −4
Original line number Diff line number Diff line
@@ -20,17 +20,17 @@ function check_qos_works_well() {
	fi

	if [ $LIMIT_TYPE = IOPS ]; then
		start_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.[1].num_read_ops')
		start_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.bdevs[0].num_read_ops')
	else
		start_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.[1].bytes_read')
		start_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.bdevs[0].bytes_read')
	fi

	$fio_py iscsi 1024 128 randread 5 1

	if [ $LIMIT_TYPE = IOPS ]; then
		end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.[1].num_read_ops')
		end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.bdevs[0].num_read_ops')
	else
		end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.[1].bytes_read')
		end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.bdevs[0].bytes_read')
	fi

	read_result=$(((end_io_count-start_io_count)/5))
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ function waitforio() {
	local ret=1
	local i
	for (( i = 10; i != 0; i-- )); do
		read_io_count=$($rpc_py -s $1 get_bdevs_iostat -b $2 | jq -r '.[1].num_read_ops')
		read_io_count=$($rpc_py -s $1 get_bdevs_iostat -b $2 | jq -r '.bdevs[0].num_read_ops')
		# A few I/O will happen during initial examine.  So wait until at least 100 I/O
		#  have completed to know that bdevperf is really generating the I/O.
		if [ $read_io_count -ge 100 ]; then