diff --git a/include/spdk/blob.h b/include/spdk/blob.h index 4c97c2b61..5a895fef7 100644 --- a/include/spdk/blob.h +++ b/include/spdk/blob.h @@ -316,6 +316,15 @@ uint64_t spdk_bs_get_cluster_size(struct spdk_blob_store *bs); */ uint64_t spdk_bs_get_page_size(struct spdk_blob_store *bs); +/** + * Get the io unit size in bytes. + * + * \param bs blobstore to query. + * + * \return io unit size. + */ +uint64_t spdk_bs_get_io_unit_size(struct spdk_blob_store *bs); + /** * Get the number of free clusters. * @@ -352,6 +361,15 @@ spdk_blob_id spdk_blob_get_id(struct spdk_blob *blob); */ uint64_t spdk_blob_get_num_pages(struct spdk_blob *blob); +/** + * Get the number of io_units allocated to the blob. + * + * \param blob Blob struct to query. + * + * \return the number of io_units. + */ +uint64_t spdk_blob_get_num_io_units(struct spdk_blob *blob); + /** * Get the number of clusters allocated to the blob. * @@ -630,8 +648,8 @@ void spdk_bs_free_io_channel(struct spdk_io_channel *channel); * \param blob Blob to write. * \param channel The I/O channel used to submit requests. * \param payload The specified buffer which should contain the data to be written. - * \param offset Offset is in pages from the beginning of the blob. - * \param length Size of data in pages. + * \param offset Offset is in io units from the beginning of the blob. + * \param length Size of data in io units. * \param cb_fn Called when the operation is complete. * \param cb_arg Argument passed to function cb_fn. */ @@ -645,8 +663,8 @@ void spdk_blob_io_write(struct spdk_blob *blob, struct spdk_io_channel *channel, * \param blob Blob to read. * \param channel The I/O channel used to submit requests. * \param payload The specified buffer which will store the obtained data. - * \param offset Offset is in pages from the beginning of the blob. - * \param length Size of data in pages. + * \param offset Offset is in io units from the beginning of the blob. + * \param length Size of data in io units. * \param cb_fn Called when the operation is complete. * \param cb_arg Argument passed to function cb_fn. */ @@ -662,8 +680,8 @@ void spdk_blob_io_read(struct spdk_blob *blob, struct spdk_io_channel *channel, * \param channel I/O channel used to submit requests. * \param iov The pointer points to an array of iovec structures. * \param iovcnt The number of buffers. - * \param offset Offset is in pages from the beginning of the blob. - * \param length Size of data in pages. + * \param offset Offset is in io units from the beginning of the blob. + * \param length Size of data in io units. * \param cb_fn Called when the operation is complete. * \param cb_arg Argument passed to function cb_fn. */ @@ -679,8 +697,8 @@ void spdk_blob_io_writev(struct spdk_blob *blob, struct spdk_io_channel *channel * \param channel I/O channel used to submit requests. * \param iov The pointer points to an array of iovec structures. * \param iovcnt The number of buffers. - * \param offset Offset is in pages from the beginning of the blob. - * \param length Size of data in pages. + * \param offset Offset is in io units from the beginning of the blob. + * \param length Size of data in io units. * \param cb_fn Called when the operation is complete. * \param cb_arg Argument passed to function cb_fn. */ @@ -694,7 +712,7 @@ void spdk_blob_io_readv(struct spdk_blob *blob, struct spdk_io_channel *channel, * * \param blob Blob to unmap. * \param channel I/O channel used to submit requests. - * \param offset Offset is in pages from the beginning of the blob. + * \param offset Offset is in io units from the beginning of the blob. * \param length Size of unmap area in pages. * \param cb_fn Called when the operation is complete. * \param cb_arg Argument passed to function cb_fn. @@ -707,8 +725,8 @@ void spdk_blob_io_unmap(struct spdk_blob *blob, struct spdk_io_channel *channel, * * \param blob Blob to write. * \param channel I/O channel used to submit requests. - * \param offset Offset is in pages from the beginning of the blob. - * \param length Size of data in pages. + * \param offset Offset is in io units from the beginning of the blob. + * \param length Size of data in io units. * \param cb_fn Called when the operation is complete. * \param cb_arg Argument passed to function cb_fn. */ diff --git a/lib/blob/blobstore.c b/lib/blob/blobstore.c index 01546277f..e8cb4a6eb 100644 --- a/lib/blob/blobstore.c +++ b/lib/blob/blobstore.c @@ -3972,6 +3972,12 @@ spdk_bs_get_page_size(struct spdk_blob_store *bs) return SPDK_BS_PAGE_SIZE; } +uint64_t +spdk_bs_get_io_unit_size(struct spdk_blob_store *bs) +{ + return SPDK_BS_PAGE_SIZE; +} + uint64_t spdk_bs_free_cluster_count(struct spdk_blob_store *bs) { @@ -4018,6 +4024,13 @@ uint64_t spdk_blob_get_num_pages(struct spdk_blob *blob) return _spdk_bs_cluster_to_page(blob->bs, blob->active.num_clusters); } +uint64_t spdk_blob_get_num_io_units(struct spdk_blob *blob) +{ + assert(blob != NULL); + + return spdk_blob_get_num_pages(blob); +} + uint64_t spdk_blob_get_num_clusters(struct spdk_blob *blob) { assert(blob != NULL); diff --git a/test/unit/lib/bdev/vbdev_lvol.c/vbdev_lvol_ut.c b/test/unit/lib/bdev/vbdev_lvol.c/vbdev_lvol_ut.c index 5fff6ddef..2500378ba 100644 --- a/test/unit/lib/bdev/vbdev_lvol.c/vbdev_lvol_ut.c +++ b/test/unit/lib/bdev/vbdev_lvol.c/vbdev_lvol_ut.c @@ -279,6 +279,12 @@ spdk_bs_get_page_size(struct spdk_blob_store *bs) return SPDK_BS_PAGE_SIZE; } +uint64_t +spdk_bs_get_io_unit_size(struct spdk_blob_store *bs) +{ + return SPDK_BS_PAGE_SIZE; +} + static void bdev_blob_destroy(struct spdk_bs_dev *bs_dev) {