spdk_for_each_bdev() can be applied simply to rpc_bdev_get_bdevs() because the callback function rpc_dump_bdev_info() is synchronous. spdk_for_each_bdev() cannot be applied simply to rpc_bdev_get_iostat(). The factored-out callback function _bdev_get_device_stat() is asynchronous. Add desc pointer to struct spdk_bdev_io_stat and open before and close after executing spdk_bdev_get_device_stat(). Replace spdk_bdev_get_by_name() by spdk_bdev_open_ext() when a bdev name is specified. spdk_bdev_register() checks if the name of each bdev is set and each bdev is opened while collecting its stats now. Hence it is not possible that spdk_bdev_get_name() returns NULL. Simplify rpc_bdev_get_iostat_cb() based on this fact. Furthermore, we want to fail the RPC for all failures. The callback function to spdk_bdev_get_device_stat() is executed after stack unwinding if successful. Defer starting RPC response until it is ensured that all spdk_bdev_get_device_stat() calls will succeed or there is no bdev. Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Change-Id: I7b036d6d707c49d19c8922a159b12b5b5ce7ca41 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12089 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> |
||
---|---|---|
.. | ||
bdev_internal.h | ||
bdev_rpc.c | ||
bdev_zone.c | ||
bdev.c | ||
Makefile | ||
part.c | ||
scsi_nvme.c | ||
spdk_bdev.map | ||
vtune.c |