bdev: add API to get optimal I/O boundary
Allow passing the NVMe namespace optimal I/O boundary through the bdev layer. Change-Id: I27a2d5498df56775d3330e40c31bd7c23bbc77a5 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/374532 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:
parent
e5f6a99b61
commit
45d4b1973a
@ -219,6 +219,15 @@ uint64_t spdk_bdev_get_num_blocks(const struct spdk_bdev *bdev);
|
||||
*/
|
||||
size_t spdk_bdev_get_buf_align(const struct spdk_bdev *bdev);
|
||||
|
||||
/**
|
||||
* Get optimal I/O boundary for a bdev.
|
||||
*
|
||||
* \param bdev Block device to query.
|
||||
* \return Optimal I/O boundary in blocks that should not be crossed for best performance, or 0 if
|
||||
* no optimal boundary is reported.
|
||||
*/
|
||||
uint32_t spdk_bdev_get_optimal_io_boundary(const struct spdk_bdev *bdev);
|
||||
|
||||
/**
|
||||
* Query whether block device has an enabled write cache.
|
||||
*
|
||||
|
@ -192,6 +192,11 @@ struct spdk_bdev {
|
||||
*/
|
||||
int need_aligned_buffer;
|
||||
|
||||
/**
|
||||
* Optimal I/O boundary in blocks, or 0 for no value reported.
|
||||
*/
|
||||
uint32_t optimal_io_boundary;
|
||||
|
||||
/**
|
||||
* Pointer to the bdev module that registered this bdev.
|
||||
*/
|
||||
|
@ -740,6 +740,12 @@ spdk_bdev_get_buf_align(const struct spdk_bdev *bdev)
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
spdk_bdev_get_optimal_io_boundary(const struct spdk_bdev *bdev)
|
||||
{
|
||||
return bdev->optimal_io_boundary;
|
||||
}
|
||||
|
||||
bool
|
||||
spdk_bdev_has_write_cache(const struct spdk_bdev *bdev)
|
||||
{
|
||||
|
@ -1138,6 +1138,7 @@ nvme_ctrlr_create_bdevs(struct nvme_ctrlr *nvme_ctrlr)
|
||||
}
|
||||
bdev->disk.blocklen = spdk_nvme_ns_get_sector_size(ns);
|
||||
bdev->disk.blockcnt = spdk_nvme_ns_get_num_sectors(ns);
|
||||
bdev->disk.optimal_io_boundary = spdk_nvme_ns_get_optimal_io_boundary(ns);
|
||||
bdev->disk.ctxt = bdev;
|
||||
bdev->disk.fn_table = &nvmelib_fn_table;
|
||||
bdev->disk.module = SPDK_GET_BDEV_MODULE(nvme);
|
||||
|
Loading…
Reference in New Issue
Block a user