bdev: make bdevs array for get_bdevs_iostat RPC
Fixes issue #775. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I5e07084599c2363b64619f38bd826fe100217020 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452477 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Seth Howell <seth.howell5141@gmail.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
e13da83e4a
commit
915270db68
@ -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()`,
|
renamed to `spdk_notify_foreach_type()` and `spdk_notify_foreach_event()`,
|
||||||
respectively. And update type name of callback accordingly.
|
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:
|
## v19.04:
|
||||||
|
|
||||||
### nvme
|
### nvme
|
||||||
|
@ -623,10 +623,9 @@ Example response:
|
|||||||
{
|
{
|
||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"result": [
|
"result": {
|
||||||
{
|
"tick_rate": 2200000000,
|
||||||
"tick_rate": 2200000000
|
"bdevs" : [
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "Nvme0n1",
|
"name": "Nvme0n1",
|
||||||
"bytes_read": 36864,
|
"bytes_read": 36864,
|
||||||
@ -644,6 +643,7 @@ Example response:
|
|||||||
"weighted_io_time": 0
|
"weighted_io_time": 0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@ done:
|
|||||||
free(stat);
|
free(stat);
|
||||||
if (--ctx->bdev_count == 0) {
|
if (--ctx->bdev_count == 0) {
|
||||||
spdk_json_write_array_end(ctx->w);
|
spdk_json_write_array_end(ctx->w);
|
||||||
|
spdk_json_write_object_end(w);
|
||||||
spdk_jsonrpc_end_result(ctx->request, ctx->w);
|
spdk_jsonrpc_end_result(ctx->request, ctx->w);
|
||||||
free(ctx);
|
free(ctx);
|
||||||
}
|
}
|
||||||
@ -171,11 +172,11 @@ spdk_rpc_get_bdevs_iostat(struct spdk_jsonrpc_request *request,
|
|||||||
ctx->request = request;
|
ctx->request = request;
|
||||||
ctx->w = w;
|
ctx->w = w;
|
||||||
|
|
||||||
spdk_json_write_array_begin(w);
|
|
||||||
|
|
||||||
spdk_json_write_object_begin(w);
|
spdk_json_write_object_begin(w);
|
||||||
spdk_json_write_named_uint64(w, "tick_rate", spdk_get_ticks_hz());
|
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) {
|
if (bdev != NULL) {
|
||||||
stat = calloc(1, sizeof(struct spdk_bdev_io_stat));
|
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) {
|
if (--ctx->bdev_count == 0) {
|
||||||
spdk_json_write_array_end(w);
|
spdk_json_write_array_end(w);
|
||||||
|
spdk_json_write_object_end(w);
|
||||||
spdk_jsonrpc_end_result(request, w);
|
spdk_jsonrpc_end_result(request, w);
|
||||||
free(ctx);
|
free(ctx);
|
||||||
}
|
}
|
||||||
|
@ -20,17 +20,17 @@ function check_qos_works_well() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $LIMIT_TYPE = IOPS ]; then
|
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
|
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
|
fi
|
||||||
|
|
||||||
$fio_py iscsi 1024 128 randread 5 1
|
$fio_py iscsi 1024 128 randread 5 1
|
||||||
|
|
||||||
if [ $LIMIT_TYPE = IOPS ]; then
|
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
|
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
|
fi
|
||||||
|
|
||||||
read_result=$(((end_io_count-start_io_count)/5))
|
read_result=$(((end_io_count-start_io_count)/5))
|
||||||
|
@ -35,7 +35,7 @@ function waitforio() {
|
|||||||
local ret=1
|
local ret=1
|
||||||
local i
|
local i
|
||||||
for (( i = 10; i != 0; i-- )); do
|
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
|
# 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.
|
# have completed to know that bdevperf is really generating the I/O.
|
||||||
if [ $read_io_count -ge 100 ]; then
|
if [ $read_io_count -ge 100 ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user