bdev/qos: add the QoS information on RPC get_bdevs interface

Change-Id: I515a08ce95ffd6fea4d5f4fab42e6d09bcdd11f7
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/393278
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
GangCao 2017-12-29 16:45:15 -05:00 committed by Daniel Verkamp
parent 83795a1600
commit b8681aa659
3 changed files with 19 additions and 0 deletions

View File

@ -299,6 +299,16 @@ uint32_t spdk_bdev_get_block_size(const struct spdk_bdev *bdev);
*/
uint64_t spdk_bdev_get_num_blocks(const struct spdk_bdev *bdev);
/**
* Get IOs per second of block device for the QoS rate limiting.
*
* \param bdev Block device to query.
* \return IOs per second.
*
* Return 0 for no QoS enforced on the queried block device.
*/
uint64_t spdk_bdev_get_qos_ios_per_sec(const struct spdk_bdev *bdev);
/**
* Get minimum I/O buffer address alignment for a bdev.
*

View File

@ -1363,6 +1363,12 @@ spdk_bdev_get_num_blocks(const struct spdk_bdev *bdev)
return bdev->blockcnt;
}
uint64_t
spdk_bdev_get_qos_ios_per_sec(const struct spdk_bdev *bdev)
{
return bdev->ios_per_sec;
}
size_t
spdk_bdev_get_buf_align(const struct spdk_bdev *bdev)
{

View File

@ -74,6 +74,9 @@ spdk_rpc_dump_bdev_info(struct spdk_json_write_ctx *w,
spdk_json_write_named_string(w, "uuid", uuid_str);
}
spdk_json_write_name(w, "qos_ios_per_sec");
spdk_json_write_uint64(w, spdk_bdev_get_qos_ios_per_sec(bdev));
spdk_json_write_name(w, "claimed");
spdk_json_write_bool(w, (bdev->claim_module != NULL));