From 9d5037275db076db6bbda5f1056bf06d6cf1c777 Mon Sep 17 00:00:00 2001 From: Evgeniy Kochetov Date: Wed, 22 May 2019 22:25:34 +0300 Subject: [PATCH] nvmf: Add BDEV IO pending statistics This patch adds statistics for BDEV IO pending state in NVMf subsytem which may help to detect lack of resources and configure pool size correctly. Signed-off-by: Evgeniy Kochetov Change-Id: I6c60c27efe3efed194b2d2c46a707af7c2808fe9 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/445290 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto Reviewed-by: Darek Stojaczyk --- doc/jsonrpc.md | 3 ++- include/spdk/nvmf.h | 1 + lib/event/subsystems/nvmf/nvmf_rpc.c | 1 + lib/nvmf/ctrlr_bdev.c | 5 +++-- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/jsonrpc.md b/doc/jsonrpc.md index fe380a325..1daa67df4 100644 --- a/doc/jsonrpc.md +++ b/doc/jsonrpc.md @@ -4171,7 +4171,8 @@ Example response: { "name": "app_thread", "admin_qpairs": 1, - "io_qpairs": 4 + "io_qpairs": 4, + "pending_bdev_io": 1721 } ] } diff --git a/include/spdk/nvmf.h b/include/spdk/nvmf.h index f7ae54b9b..db225e0b3 100644 --- a/include/spdk/nvmf.h +++ b/include/spdk/nvmf.h @@ -81,6 +81,7 @@ struct spdk_nvmf_transport_opts { struct spdk_nvmf_poll_group_stat { uint32_t admin_qpairs; uint32_t io_qpairs; + uint64_t pending_bdev_io; }; /** diff --git a/lib/event/subsystems/nvmf/nvmf_rpc.c b/lib/event/subsystems/nvmf/nvmf_rpc.c index 601a126d7..8d260b573 100644 --- a/lib/event/subsystems/nvmf/nvmf_rpc.c +++ b/lib/event/subsystems/nvmf/nvmf_rpc.c @@ -1656,6 +1656,7 @@ rpc_nvmf_get_stats(struct spdk_io_channel_iter *i) spdk_json_write_named_string(ctx->w, "name", spdk_thread_get_name(spdk_get_thread())); spdk_json_write_named_uint32(ctx->w, "admin_qpairs", stat.admin_qpairs); spdk_json_write_named_uint32(ctx->w, "io_qpairs", stat.io_qpairs); + spdk_json_write_named_uint64(ctx->w, "pending_bdev_io", stat.pending_bdev_io); spdk_json_write_object_end(ctx->w); } diff --git a/lib/nvmf/ctrlr_bdev.c b/lib/nvmf/ctrlr_bdev.c index e6c15f057..0b1ba9dcc 100644 --- a/lib/nvmf/ctrlr_bdev.c +++ b/lib/nvmf/ctrlr_bdev.c @@ -1,8 +1,8 @@ /*- * BSD LICENSE * - * Copyright (c) Intel Corporation. - * All rights reserved. + * Copyright (c) Intel Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -213,6 +213,7 @@ nvmf_bdev_ctrl_queue_io(struct spdk_nvmf_request *req, struct spdk_bdev *bdev, if (rc != 0) { assert(false); } + req->qpair->group->stat.pending_bdev_io++; } int