blobstore: Introduce io_unit size to blobstore.

This patch just adds the call, but doesn't change behaviour of blobstore.
io unit size remains same as page size.

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: Idcd1b7d5126fc7cacf12c996188bd41e2c9a744d

Reviewed-on: https://review.gerrithub.io/425355
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: 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:
Piotr Pelplinski 2018-09-12 09:48:30 +02:00 committed by Jim Harris
parent cf5448a910
commit c9b8909a02
3 changed files with 48 additions and 11 deletions

View File

@ -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.
*/

View File

@ -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);

View File

@ -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)
{