bdev: add API to get submit tsc of a bdev I/O

Add API spdk_bdev_io_get_submit_tsc to get submit tsc of a bdev I/O,
which can be used in bdev modules to avoid calling expensive
spdk_get_ticks().

Change-Id: Ifbcecb1bc663344997c5e73b72a1dfb5d0422946
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14989
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
Richael Zhuang 2022-10-14 13:09:07 +08:00 committed by Tomasz Zawadzki
parent c273513401
commit cabbb25d5d
4 changed files with 18 additions and 0 deletions

View File

@ -25,6 +25,8 @@ required bdev.
New `spdk_bdev_copy_blocks` and `spdk_bdev_get_max_copy` APIs to support copy commands.
A new API `spdk_bdev_io_get_submit_tsc` was added to get the submit_tsc of the bdev I/O.
## v22.09
### accel

View File

@ -1077,6 +1077,15 @@ struct spdk_thread *spdk_bdev_io_get_thread(struct spdk_bdev_io *bdev_io);
*/
struct spdk_io_channel *spdk_bdev_io_get_io_channel(struct spdk_bdev_io *bdev_io);
/**
* Get the submit_tsc of a bdev I/O.
*
* \param bdev_io The bdev I/O to get the submit_tsc.
*
* \return The submit_tsc of the specified bdev I/O.
*/
uint64_t spdk_bdev_io_get_submit_tsc(struct spdk_bdev_io *bdev_io);
/**
* Resize for a bdev.
*

View File

@ -3095,6 +3095,12 @@ spdk_bdev_io_type_supported(struct spdk_bdev *bdev, enum spdk_bdev_io_type io_ty
return supported;
}
uint64_t
spdk_bdev_io_get_submit_tsc(struct spdk_bdev_io *bdev_io)
{
return bdev_io->internal.submit_tsc;
}
int
spdk_bdev_dump_info_json(struct spdk_bdev *bdev, struct spdk_json_write_ctx *w)
{

View File

@ -134,6 +134,7 @@
spdk_bdev_io_complete_aio_status;
spdk_bdev_io_get_thread;
spdk_bdev_io_get_io_channel;
spdk_bdev_io_get_submit_tsc;
spdk_bdev_notify_blockcnt_change;
spdk_scsi_nvme_translate;
spdk_bdev_module_list_add;