Blob Storage System. More...
Data Structures | |
struct | spdk_bs_dev_cb_args |
struct | spdk_blob_ext_io_opts |
Structure with optional IO request parameters The content of this structure must be valid until the IO request is completed. More... | |
struct | spdk_bs_dev |
struct | spdk_bs_type |
struct | spdk_bs_opts |
struct | spdk_blob_xattr_opts |
struct | spdk_blob_opts |
struct | spdk_blob_open_opts |
Macros | |
#define | SPDK_BLOBID_INVALID (uint64_t)-1 |
#define | SPDK_BLOBID_EXTERNAL_SNAPSHOT (uint64_t)-2 |
#define | SPDK_BLOBSTORE_TYPE_LENGTH 16 |
Typedefs | |
typedef uint64_t | spdk_blob_id |
typedef void(* | spdk_bs_op_complete) (void *cb_arg, int bserrno) |
Blobstore operation completion callback. | |
typedef void(* | spdk_bs_op_with_handle_complete) (void *cb_arg, struct spdk_blob_store *bs, int bserrno) |
Blobstore operation completion callback with handle. | |
typedef void(* | spdk_blob_op_complete) (void *cb_arg, int bserrno) |
Blob operation completion callback. | |
typedef void(* | spdk_blob_op_with_id_complete) (void *cb_arg, spdk_blob_id blobid, int bserrno) |
Blob operation completion callback with blob ID. | |
typedef void(* | spdk_blob_op_with_handle_complete) (void *cb_arg, struct spdk_blob *blb, int bserrno) |
Blob operation completion callback with handle. | |
typedef void(* | spdk_bs_dev_cpl) (struct spdk_io_channel *channel, void *cb_arg, int bserrno) |
Blobstore device completion callback. | |
typedef void(* | spdk_blob_op_with_bs_dev) (void *cb_arg, struct spdk_bs_dev *bs_dev, int bserrno) |
Blob device open completion callback with blobstore device. | |
typedef int(* | spdk_bs_esnap_dev_create) (void *bs_ctx, void *blob_ctx, struct spdk_blob *blob, const void *esnap_id, uint32_t id_size, struct spdk_bs_dev **bs_dev) |
External snapshot device open callback. | |
typedef void(* | spdk_blob_shallow_copy_status) (uint64_t copied_clusters, void *cb_arg) |
Blob shallow copy status callback. | |
typedef void(* | spdk_bs_dump_print_xattr) (FILE *fp, const char *bstype, const char *name, const void *value, size_t value_length) |
Functions | |
SPDK_STATIC_ASSERT (sizeof(struct spdk_blob_ext_io_opts)==32, "Incorrect size") | |
SPDK_STATIC_ASSERT (sizeof(struct spdk_bs_opts)==88, "Incorrect size") | |
void | spdk_bs_opts_init (struct spdk_bs_opts *opts, size_t opts_size) |
Initialize a spdk_bs_opts structure to the default blobstore option values. | |
void | spdk_bs_load (struct spdk_bs_dev *dev, struct spdk_bs_opts *opts, spdk_bs_op_with_handle_complete cb_fn, void *cb_arg) |
Load a blobstore from the given device. | |
void | spdk_bs_grow (struct spdk_bs_dev *dev, struct spdk_bs_opts *opts, spdk_bs_op_with_handle_complete cb_fn, void *cb_arg) |
Grow a blobstore to fill the underlying device Cannot be used on loaded blobstore. | |
void | spdk_bs_grow_live (struct spdk_blob_store *bs, spdk_bs_op_complete cb_fn, void *cb_arg) |
Grow a blobstore to fill the underlying device. | |
void | spdk_bs_init (struct spdk_bs_dev *dev, struct spdk_bs_opts *opts, spdk_bs_op_with_handle_complete cb_fn, void *cb_arg) |
Initialize a blobstore on the given device. | |
void | spdk_bs_dump (struct spdk_bs_dev *dev, FILE *fp, spdk_bs_dump_print_xattr print_xattr_fn, spdk_bs_op_complete cb_fn, void *cb_arg) |
Dump a blobstore's metadata to a given FILE in human-readable format. | |
void | spdk_bs_destroy (struct spdk_blob_store *bs, spdk_bs_op_complete cb_fn, void *cb_arg) |
Destroy the blobstore. | |
void | spdk_bs_unload (struct spdk_blob_store *bs, spdk_bs_op_complete cb_fn, void *cb_arg) |
Unload the blobstore. | |
void | spdk_bs_set_super (struct spdk_blob_store *bs, spdk_blob_id blobid, spdk_bs_op_complete cb_fn, void *cb_arg) |
Set a super blob on the given blobstore. | |
void | spdk_bs_get_super (struct spdk_blob_store *bs, spdk_blob_op_with_id_complete cb_fn, void *cb_arg) |
Get the super blob. | |
uint64_t | spdk_bs_get_cluster_size (struct spdk_blob_store *bs) |
Get the cluster size in bytes. | |
uint64_t | spdk_bs_get_page_size (struct spdk_blob_store *bs) |
Get the metadata page size in bytes. | |
uint64_t | spdk_bs_get_io_unit_size (struct spdk_blob_store *bs) |
Get the io unit size in bytes. | |
uint64_t | spdk_bs_free_cluster_count (struct spdk_blob_store *bs) |
Get the number of free clusters. | |
uint64_t | spdk_bs_total_data_cluster_count (struct spdk_blob_store *bs) |
Get the total number of clusters accessible by user. | |
spdk_blob_id | spdk_blob_get_id (struct spdk_blob *blob) |
Get the blob id. | |
uint64_t | spdk_blob_get_num_io_units (struct spdk_blob *blob) |
Get the number of io_units allocated to the blob. | |
uint64_t | spdk_blob_get_num_clusters (struct spdk_blob *blob) |
Get the number of clusters in the blob. | |
uint64_t | spdk_blob_get_num_allocated_clusters (struct spdk_blob *blob) |
Get the number of allocated clusters to the blob. | |
uint64_t | spdk_blob_get_next_allocated_io_unit (struct spdk_blob *blob, uint64_t offset) |
Get next allocated io_unit. | |
uint64_t | spdk_blob_get_next_unallocated_io_unit (struct spdk_blob *blob, uint64_t offset) |
Get next unallocated io_unit. | |
SPDK_STATIC_ASSERT (sizeof(struct spdk_blob_opts)==80, "Incorrect size") | |
void | spdk_blob_opts_init (struct spdk_blob_opts *opts, size_t opts_size) |
Initialize a spdk_blob_opts structure to the default blob option values. | |
void | spdk_bs_create_blob_ext (struct spdk_blob_store *bs, const struct spdk_blob_opts *opts, spdk_blob_op_with_id_complete cb_fn, void *cb_arg) |
Create a new blob with options on the given blobstore. | |
void | spdk_bs_create_blob (struct spdk_blob_store *bs, spdk_blob_op_with_id_complete cb_fn, void *cb_arg) |
Create a new blob with default option values on the given blobstore. | |
void | spdk_bs_create_snapshot (struct spdk_blob_store *bs, spdk_blob_id blobid, const struct spdk_blob_xattr_opts *snapshot_xattrs, spdk_blob_op_with_id_complete cb_fn, void *cb_arg) |
Create a read-only snapshot of specified blob with provided options. | |
void | spdk_bs_create_clone (struct spdk_blob_store *bs, spdk_blob_id blobid, const struct spdk_blob_xattr_opts *clone_xattrs, spdk_blob_op_with_id_complete cb_fn, void *cb_arg) |
Create a clone of specified read-only blob. | |
int | spdk_blob_get_clones (struct spdk_blob_store *bs, spdk_blob_id blobid, spdk_blob_id *ids, size_t *count) |
Provide table with blob id's of clones are dependent on specified snapshot. | |
spdk_blob_id | spdk_blob_get_parent_snapshot (struct spdk_blob_store *bs, spdk_blob_id blobid) |
Get the blob id for the parent snapshot of this blob. | |
int | spdk_blob_get_esnap_id (struct spdk_blob *blob, const void **id, size_t *len) |
Get the id used to access the esnap clone's parent. | |
bool | spdk_blob_is_read_only (struct spdk_blob *blob) |
Check if blob is read only. | |
bool | spdk_blob_is_snapshot (struct spdk_blob *blob) |
Check if blob is a snapshot. | |
bool | spdk_blob_is_clone (struct spdk_blob *blob) |
Check if blob is a clone of a blob. | |
bool | spdk_blob_is_thin_provisioned (struct spdk_blob *blob) |
Check if blob is thin-provisioned. | |
bool | spdk_blob_is_esnap_clone (const struct spdk_blob *blob) |
Check if blob is a clone of an external snapshot. | |
void | spdk_bs_delete_blob (struct spdk_blob_store *bs, spdk_blob_id blobid, spdk_blob_op_complete cb_fn, void *cb_arg) |
Delete an existing blob from the given blobstore. | |
void | spdk_bs_inflate_blob (struct spdk_blob_store *bs, struct spdk_io_channel *channel, spdk_blob_id blobid, spdk_blob_op_complete cb_fn, void *cb_arg) |
Allocate all clusters in this blob. | |
void | spdk_bs_blob_decouple_parent (struct spdk_blob_store *bs, struct spdk_io_channel *channel, spdk_blob_id blobid, spdk_blob_op_complete cb_fn, void *cb_arg) |
Remove dependency on parent blob. | |
int | spdk_bs_blob_shallow_copy (struct spdk_blob_store *bs, struct spdk_io_channel *channel, spdk_blob_id blobid, struct spdk_bs_dev *ext_dev, spdk_blob_shallow_copy_status status_cb_fn, void *status_cb_arg, spdk_blob_op_complete cb_fn, void *cb_arg) |
Perform a shallow copy of a blob to a blobstore device. | |
void | spdk_bs_blob_set_parent (struct spdk_blob_store *bs, spdk_blob_id blob_id, spdk_blob_id snapshot_id, spdk_blob_op_complete cb_fn, void *cb_arg) |
Set a snapshot as the parent of a blob. | |
void | spdk_bs_blob_set_external_parent (struct spdk_blob_store *bs, spdk_blob_id blob_id, struct spdk_bs_dev *esnap_bs_dev, const void *esnap_id, uint32_t esnap_id_len, spdk_blob_op_complete cb_fn, void *cb_arg) |
Set an external snapshot as the parent of a blob. | |
SPDK_STATIC_ASSERT (sizeof(struct spdk_blob_open_opts)==24, "Incorrect size") | |
void | spdk_blob_open_opts_init (struct spdk_blob_open_opts *opts, size_t opts_size) |
Initialize a spdk_blob_open_opts structure to the default blob option values. | |
void | spdk_bs_open_blob (struct spdk_blob_store *bs, spdk_blob_id blobid, spdk_blob_op_with_handle_complete cb_fn, void *cb_arg) |
Open a blob from the given blobstore. | |
void | spdk_bs_open_blob_ext (struct spdk_blob_store *bs, spdk_blob_id blobid, struct spdk_blob_open_opts *opts, spdk_blob_op_with_handle_complete cb_fn, void *cb_arg) |
Open a blob from the given blobstore with additional options. | |
void | spdk_blob_resize (struct spdk_blob *blob, uint64_t sz, spdk_blob_op_complete cb_fn, void *cb_arg) |
Resize a blob to 'sz' clusters. | |
int | spdk_blob_set_read_only (struct spdk_blob *blob) |
Set blob as read only. | |
void | spdk_blob_sync_md (struct spdk_blob *blob, spdk_blob_op_complete cb_fn, void *cb_arg) |
Sync a blob. | |
void | spdk_blob_close (struct spdk_blob *blob, spdk_blob_op_complete cb_fn, void *cb_arg) |
Close a blob. | |
struct spdk_io_channel * | spdk_bs_alloc_io_channel (struct spdk_blob_store *bs) |
Allocate an I/O channel for the given blobstore. | |
void | spdk_bs_free_io_channel (struct spdk_io_channel *channel) |
Free the I/O channel. | |
void | spdk_blob_io_write (struct spdk_blob *blob, struct spdk_io_channel *channel, void *payload, uint64_t offset, uint64_t length, spdk_blob_op_complete cb_fn, void *cb_arg) |
Write data to a blob. | |
void | spdk_blob_io_read (struct spdk_blob *blob, struct spdk_io_channel *channel, void *payload, uint64_t offset, uint64_t length, spdk_blob_op_complete cb_fn, void *cb_arg) |
Read data from a blob. | |
void | spdk_blob_io_writev (struct spdk_blob *blob, struct spdk_io_channel *channel, struct iovec *iov, int iovcnt, uint64_t offset, uint64_t length, spdk_blob_op_complete cb_fn, void *cb_arg) |
Write the data described by 'iov' to 'length' io_units beginning at 'offset' io_units into the blob. | |
void | spdk_blob_io_readv (struct spdk_blob *blob, struct spdk_io_channel *channel, struct iovec *iov, int iovcnt, uint64_t offset, uint64_t length, spdk_blob_op_complete cb_fn, void *cb_arg) |
Read 'length' io_units starting at 'offset' io_units into the blob into the memory described by 'iov'. | |
void | spdk_blob_io_writev_ext (struct spdk_blob *blob, struct spdk_io_channel *channel, struct iovec *iov, int iovcnt, uint64_t offset, uint64_t length, spdk_blob_op_complete cb_fn, void *cb_arg, struct spdk_blob_ext_io_opts *io_opts) |
Write the data described by 'iov' to 'length' io_units beginning at 'offset' io_units into the blob. | |
void | spdk_blob_io_readv_ext (struct spdk_blob *blob, struct spdk_io_channel *channel, struct iovec *iov, int iovcnt, uint64_t offset, uint64_t length, spdk_blob_op_complete cb_fn, void *cb_arg, struct spdk_blob_ext_io_opts *io_opts) |
Read 'length' io_units starting at 'offset' io_units into the blob into the memory described by 'iov'. | |
void | spdk_blob_io_unmap (struct spdk_blob *blob, struct spdk_io_channel *channel, uint64_t offset, uint64_t length, spdk_blob_op_complete cb_fn, void *cb_arg) |
Unmap 'length' io_units beginning at 'offset' io_units on the blob as unused. | |
void | spdk_blob_io_write_zeroes (struct spdk_blob *blob, struct spdk_io_channel *channel, uint64_t offset, uint64_t length, spdk_blob_op_complete cb_fn, void *cb_arg) |
Write zeros into area of a blob. | |
void | spdk_bs_iter_first (struct spdk_blob_store *bs, spdk_blob_op_with_handle_complete cb_fn, void *cb_arg) |
Get the first blob of the blobstore. | |
void | spdk_bs_iter_next (struct spdk_blob_store *bs, struct spdk_blob *blob, spdk_blob_op_with_handle_complete cb_fn, void *cb_arg) |
Get the next blob by using the current blob. | |
int | spdk_blob_set_xattr (struct spdk_blob *blob, const char *name, const void *value, uint16_t value_len) |
Set an extended attribute for the given blob. | |
int | spdk_blob_remove_xattr (struct spdk_blob *blob, const char *name) |
Remove the extended attribute from the given blob. | |
int | spdk_blob_get_xattr_value (struct spdk_blob *blob, const char *name, const void **value, size_t *value_len) |
Get the value of the specified extended attribute. | |
int | spdk_blob_get_xattr_names (struct spdk_blob *blob, struct spdk_xattr_names **names) |
Iterate through all extended attributes of the blob. | |
uint32_t | spdk_xattr_names_get_count (struct spdk_xattr_names *names) |
Get the number of extended attributes. | |
const char * | spdk_xattr_names_get_name (struct spdk_xattr_names *names, uint32_t index) |
Get the attribute name specified by the index. | |
void | spdk_xattr_names_free (struct spdk_xattr_names *names) |
Free the attribute names. | |
struct spdk_bs_type | spdk_bs_get_bstype (struct spdk_blob_store *bs) |
Get blobstore type of the given device. | |
void | spdk_bs_set_bstype (struct spdk_blob_store *bs, struct spdk_bs_type bstype) |
Set blobstore type to the given device. | |
void | spdk_blob_set_esnap_bs_dev (struct spdk_blob *blob, struct spdk_bs_dev *back_bs_dev, spdk_blob_op_complete cb_fn, void *cb_arg) |
Replace the existing external snapshot device. | |
struct spdk_bs_dev * | spdk_blob_get_esnap_bs_dev (const struct spdk_blob *blob) |
Get the existing external snapshot device. | |
bool | spdk_blob_is_degraded (const struct spdk_blob *blob) |
Determine if the blob is degraded. | |
Blob Storage System.
The blob storage system, or the blobstore for short, is a low level library for placing opaque blobs of data onto a storage device such that scattered physical blocks on the storage device appear as a single, contiguous storage region. These blobs are also persistent, which means they are rediscoverable after reboot or power loss.
The blobstore is designed to be very high performance, and thus has a few general rules regarding thread safety to avoid taking locks in the I/O path. This is primarily done by only allowing most functions to be called on the metadata thread. The metadata thread is the thread which called spdk_bs_init() or spdk_bs_load().
Functions starting with the prefix "spdk_blob_io" are passed a channel as an argument, and channels may only be used from the thread they were created on. See spdk_bs_alloc_io_channel. These are the only functions that may be called from a thread other than the metadata thread.
The blobstore returns errors using negated POSIX errno values, either returned in the callback or as a return value. An errno value of 0 means success.
typedef void(* spdk_blob_op_complete) (void *cb_arg, int bserrno) |
Blob operation completion callback.
cb_arg | Callback argument. |
bserrno | 0 if it completed successfully, or negative errno if it failed. |
typedef void(* spdk_blob_op_with_bs_dev) (void *cb_arg, struct spdk_bs_dev *bs_dev, int bserrno) |
Blob device open completion callback with blobstore device.
cb_arg | Callback argument. |
bs_dev | Blobstore device. |
bserrno | 0 if it completed successfully, or negative errno if it failed. |
typedef void(* spdk_blob_op_with_handle_complete) (void *cb_arg, struct spdk_blob *blb, int bserrno) |
Blob operation completion callback with handle.
cb_arg | Callback argument. |
blb | Handle to a blob. |
bserrno | 0 if it completed successfully, or negative errno if it failed. |
typedef void(* spdk_blob_op_with_id_complete) (void *cb_arg, spdk_blob_id blobid, int bserrno) |
Blob operation completion callback with blob ID.
cb_arg | Callback argument. |
blobid | Blob ID. |
bserrno | 0 if it completed successfully, or negative errno if it failed. |
typedef void(* spdk_blob_shallow_copy_status) (uint64_t copied_clusters, void *cb_arg) |
Blob shallow copy status callback.
copied_clusters | Actual number of copied clusters by the shallow copy operation |
cb_arg | Callback argument. |
typedef void(* spdk_bs_dev_cpl) (struct spdk_io_channel *channel, void *cb_arg, int bserrno) |
Blobstore device completion callback.
channel | I/O channel the operation was initiated on. |
cb_arg | Callback argument. |
bserrno | 0 if it completed successfully, or negative errno if it failed. |
typedef int(* spdk_bs_esnap_dev_create) (void *bs_ctx, void *blob_ctx, struct spdk_blob *blob, const void *esnap_id, uint32_t id_size, struct spdk_bs_dev **bs_dev) |
External snapshot device open callback.
As an esnap clone blob is loading, it uses this callback registered with the blobstore to create the external snapshot device. The blobstore consumer must set this while loading the blobstore if it intends to support external snapshots.
If the blobstore consumer does not wish to load an external snapshot, it should set *bs_dev to NULL and return 0.
bs_ctx | Context provided by the blobstore consumer via esnap_ctx member of struct spdk_bs_opts. |
blob_ctx | Context provided to spdk_bs_open_ext() via esnap_ctx member of struct spdk_bs_open_opts. |
blob | The blob that needs its external snapshot device. |
esnap_id | A copy of the esnap_id passed via blob_opts when creating the esnap clone. |
id_size | The size in bytes of the data referenced by esnap_id. |
bs_dev | When 0 is returned, the newly created blobstore device is returned by reference. |
typedef void(* spdk_bs_op_complete) (void *cb_arg, int bserrno) |
Blobstore operation completion callback.
cb_arg | Callback argument. |
bserrno | 0 if it completed successfully, or negative errno if it failed. |
typedef void(* spdk_bs_op_with_handle_complete) (void *cb_arg, struct spdk_blob_store *bs, int bserrno) |
Blobstore operation completion callback with handle.
cb_arg | Callback argument. |
bs | Handle to a blobstore. |
bserrno | 0 if it completed successfully, or negative errno if it failed. |
void spdk_blob_close | ( | struct spdk_blob * | blob, |
spdk_blob_op_complete | cb_fn, | ||
void * | cb_arg ) |
Close a blob.
This will automatically sync.
blob | Blob to close. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
int spdk_blob_get_clones | ( | struct spdk_blob_store * | bs, |
spdk_blob_id | blobid, | ||
spdk_blob_id * | ids, | ||
size_t * | count ) |
Provide table with blob id's of clones are dependent on specified snapshot.
Ids array should be allocated and the count parameter set to the number of id's it can store, before calling this function.
If ids is NULL or count parameter is not sufficient to handle ids of all clones, -ENOMEM error is returned and count parameter is updated to the total number of clones.
bs | blobstore. |
blobid | Snapshots blob id. |
ids | Array of the clone ids or NULL to get required size in count. |
count | Size of ids. After call it is updated to the number of clones. |
struct spdk_bs_dev * spdk_blob_get_esnap_bs_dev | ( | const struct spdk_blob * | blob | ) |
Get the existing external snapshot device.
blob | A blob that is an esnap clone |
int spdk_blob_get_esnap_id | ( | struct spdk_blob * | blob, |
const void ** | id, | ||
size_t * | len ) |
Get the id used to access the esnap clone's parent.
blob | The clone's blob. |
id | On successful return, *id will reference memory that has the same life as blob. |
len | On successful return *len will be the size of id in bytes. |
spdk_blob_id spdk_blob_get_id | ( | struct spdk_blob * | blob | ) |
Get the blob id.
blob | Blob struct to query. |
uint64_t spdk_blob_get_next_allocated_io_unit | ( | struct spdk_blob * | blob, |
uint64_t | offset ) |
Get next allocated io_unit.
Starting at 'offset' io_units into the blob, returns the offset of the first allocated io unit found. If 'offset' points to an allocated io_unit, same offset is returned.
blob | Blob struct to query. |
offset | Offset is in io units from the beginning of the blob. |
uint64_t spdk_blob_get_next_unallocated_io_unit | ( | struct spdk_blob * | blob, |
uint64_t | offset ) |
Get next unallocated io_unit.
Starting at 'offset' io_units into the blob, returns the offset of the first unallocated io unit found. If 'offset' points to an unallocated io_unit, same offset is returned.
blob | Blob struct to query. |
offset | Offset is in io units from the beginning of the blob. |
uint64_t spdk_blob_get_num_allocated_clusters | ( | struct spdk_blob * | blob | ) |
Get the number of allocated clusters to the blob.
In case of a thin-provisioned blob, this value is less than or equal to the number of clusters in the blob, otherwise they are equal.
blob | Blob struct to query. |
uint64_t spdk_blob_get_num_clusters | ( | struct spdk_blob * | blob | ) |
Get the number of clusters in the blob.
This value represents the size of the blob in number of clusters.
blob | Blob struct to query. |
uint64_t spdk_blob_get_num_io_units | ( | struct spdk_blob * | blob | ) |
Get the number of io_units allocated to the blob.
blob | Blob struct to query. |
spdk_blob_id spdk_blob_get_parent_snapshot | ( | struct spdk_blob_store * | bs, |
spdk_blob_id | blobid ) |
Get the blob id for the parent snapshot of this blob.
bs | blobstore. |
blobid | Blob id. |
int spdk_blob_get_xattr_names | ( | struct spdk_blob * | blob, |
struct spdk_xattr_names ** | names ) |
Iterate through all extended attributes of the blob.
Get the names of all extended attributes that will be stored in names.
blob | Blob to query. |
names | Parameter as output. |
int spdk_blob_get_xattr_value | ( | struct spdk_blob * | blob, |
const char * | name, | ||
const void ** | value, | ||
size_t * | value_len ) |
Get the value of the specified extended attribute.
The obtained value and its size will be stored in value and value_len.
blob | Blob to query. |
name | Name of the extended attribute. |
value | Parameter as output. |
value_len | Parameter as output. |
void spdk_blob_io_read | ( | struct spdk_blob * | blob, |
struct spdk_io_channel * | channel, | ||
void * | payload, | ||
uint64_t | offset, | ||
uint64_t | length, | ||
spdk_blob_op_complete | cb_fn, | ||
void * | cb_arg ) |
Read data from a blob.
blob | Blob to read. |
channel | The I/O channel used to submit requests. |
payload | The specified buffer which will store the obtained data. |
offset | Offset is in io units from the beginning of the blob. |
length | Size of data in io units. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_blob_io_readv | ( | struct spdk_blob * | blob, |
struct spdk_io_channel * | channel, | ||
struct iovec * | iov, | ||
int | iovcnt, | ||
uint64_t | offset, | ||
uint64_t | length, | ||
spdk_blob_op_complete | cb_fn, | ||
void * | cb_arg ) |
Read 'length' io_units starting at 'offset' io_units into the blob into the memory described by 'iov'.
blob | Blob to read. |
channel | I/O channel used to submit requests. |
iov | The pointer points to an array of iovec structures. |
iovcnt | The number of buffers. |
offset | Offset is in io units from the beginning of the blob. |
length | Size of data in io units. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_blob_io_readv_ext | ( | struct spdk_blob * | blob, |
struct spdk_io_channel * | channel, | ||
struct iovec * | iov, | ||
int | iovcnt, | ||
uint64_t | offset, | ||
uint64_t | length, | ||
spdk_blob_op_complete | cb_fn, | ||
void * | cb_arg, | ||
struct spdk_blob_ext_io_opts * | io_opts ) |
Read 'length' io_units starting at 'offset' io_units into the blob into the memory described by 'iov'.
Accepts extended IO request options
blob | Blob to read. |
channel | I/O channel used to submit requests. |
iov | The pointer points to an array of iovec structures. |
iovcnt | The number of buffers. |
offset | Offset is in io units from the beginning of the blob. |
length | Size of data in io units. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
io_opts | Optional extended IO request options |
void spdk_blob_io_unmap | ( | struct spdk_blob * | blob, |
struct spdk_io_channel * | channel, | ||
uint64_t | offset, | ||
uint64_t | length, | ||
spdk_blob_op_complete | cb_fn, | ||
void * | cb_arg ) |
Unmap 'length' io_units beginning at 'offset' io_units on the blob as unused.
Unmapped io_units may allow the underlying storage media to behave more efficiently.
blob | Blob to unmap. |
channel | I/O channel used to submit requests. |
offset | Offset is in io units from the beginning of the blob. |
length | Size of unmap area in io_units. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_blob_io_write | ( | struct spdk_blob * | blob, |
struct spdk_io_channel * | channel, | ||
void * | payload, | ||
uint64_t | offset, | ||
uint64_t | length, | ||
spdk_blob_op_complete | cb_fn, | ||
void * | cb_arg ) |
Write data to a blob.
blob | Blob to write. |
channel | The I/O channel used to submit requests. |
payload | The specified buffer which should contain the data to be written. |
offset | Offset is in io units from the beginning of the blob. |
length | Size of data in io units. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_blob_io_write_zeroes | ( | struct spdk_blob * | blob, |
struct spdk_io_channel * | channel, | ||
uint64_t | offset, | ||
uint64_t | length, | ||
spdk_blob_op_complete | cb_fn, | ||
void * | cb_arg ) |
Write zeros into area of a blob.
blob | Blob to write. |
channel | I/O channel used to submit requests. |
offset | Offset is in io units from the beginning of the blob. |
length | Size of data in io units. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_blob_io_writev | ( | struct spdk_blob * | blob, |
struct spdk_io_channel * | channel, | ||
struct iovec * | iov, | ||
int | iovcnt, | ||
uint64_t | offset, | ||
uint64_t | length, | ||
spdk_blob_op_complete | cb_fn, | ||
void * | cb_arg ) |
Write the data described by 'iov' to 'length' io_units beginning at 'offset' io_units into the blob.
blob | Blob to write. |
channel | I/O channel used to submit requests. |
iov | The pointer points to an array of iovec structures. |
iovcnt | The number of buffers. |
offset | Offset is in io units from the beginning of the blob. |
length | Size of data in io units. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_blob_io_writev_ext | ( | struct spdk_blob * | blob, |
struct spdk_io_channel * | channel, | ||
struct iovec * | iov, | ||
int | iovcnt, | ||
uint64_t | offset, | ||
uint64_t | length, | ||
spdk_blob_op_complete | cb_fn, | ||
void * | cb_arg, | ||
struct spdk_blob_ext_io_opts * | io_opts ) |
Write the data described by 'iov' to 'length' io_units beginning at 'offset' io_units into the blob.
Accepts extended IO request options
blob | Blob to write. |
channel | I/O channel used to submit requests. |
iov | The pointer points to an array of iovec structures. |
iovcnt | The number of buffers. |
offset | Offset is in io units from the beginning of the blob. |
length | Size of data in io units. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
io_opts | Optional extended IO request options |
bool spdk_blob_is_clone | ( | struct spdk_blob * | blob | ) |
Check if blob is a clone of a blob.
Clones of external snapshots will return false. See spdk_blob_is_esnap_clone.
blob | Blob. |
bool spdk_blob_is_degraded | ( | const struct spdk_blob * | blob | ) |
Determine if the blob is degraded.
A degraded blob cannot perform IO.
blob | A blob |
bool spdk_blob_is_esnap_clone | ( | const struct spdk_blob * | blob | ) |
Check if blob is a clone of an external snapshot.
blob | Blob. |
bool spdk_blob_is_read_only | ( | struct spdk_blob * | blob | ) |
Check if blob is read only.
blob | Blob. |
bool spdk_blob_is_snapshot | ( | struct spdk_blob * | blob | ) |
Check if blob is a snapshot.
blob | Blob. |
bool spdk_blob_is_thin_provisioned | ( | struct spdk_blob * | blob | ) |
Check if blob is thin-provisioned.
blob | Blob. |
void spdk_blob_open_opts_init | ( | struct spdk_blob_open_opts * | opts, |
size_t | opts_size ) |
Initialize a spdk_blob_open_opts structure to the default blob option values.
opts | spdk_blob_open_opts structure to initialize. |
opts_size | It mus be the size of struct spdk_blob_open_opts. |
void spdk_blob_opts_init | ( | struct spdk_blob_opts * | opts, |
size_t | opts_size ) |
Initialize a spdk_blob_opts structure to the default blob option values.
opts | spdk_blob_opts structure to initialize. |
opts_size | It must be the size of spdk_blob_opts structure. |
int spdk_blob_remove_xattr | ( | struct spdk_blob * | blob, |
const char * | name ) |
Remove the extended attribute from the given blob.
blob | Blob to remove attribute. |
name | Name of the extended attribute. |
void spdk_blob_resize | ( | struct spdk_blob * | blob, |
uint64_t | sz, | ||
spdk_blob_op_complete | cb_fn, | ||
void * | cb_arg ) |
Resize a blob to 'sz' clusters.
These changes are not persisted to disk until spdk_bs_md_sync_blob() is called. If called before previous resize finish, it will fail with errno -EBUSY
blob | Blob to resize. |
sz | The new number of clusters. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_blob_set_esnap_bs_dev | ( | struct spdk_blob * | blob, |
struct spdk_bs_dev * | back_bs_dev, | ||
spdk_blob_op_complete | cb_fn, | ||
void * | cb_arg ) |
Replace the existing external snapshot device.
blob | The blob that is getting a new external snapshot device. |
back_bs_dev | The new blobstore device to use as an external snapshot. |
cb_fn | Callback to be called when complete. |
cb_arg | Callback argument used with cb_fn. |
int spdk_blob_set_read_only | ( | struct spdk_blob * | blob | ) |
Set blob as read only.
These changes do not take effect until spdk_blob_sync_md() is called.
blob | Blob to set. |
int spdk_blob_set_xattr | ( | struct spdk_blob * | blob, |
const char * | name, | ||
const void * | value, | ||
uint16_t | value_len ) |
Set an extended attribute for the given blob.
blob | Blob to set attribute. |
name | Name of the extended attribute. |
value | Value of the extended attribute. |
value_len | Length of the value. |
void spdk_blob_sync_md | ( | struct spdk_blob * | blob, |
spdk_blob_op_complete | cb_fn, | ||
void * | cb_arg ) |
Sync a blob.
Make a blob persistent. This applies to open, resize, set xattr, and remove xattr. These operations will not be persistent until the blob has been synced.
blob | Blob to sync. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
struct spdk_io_channel * spdk_bs_alloc_io_channel | ( | struct spdk_blob_store * | bs | ) |
Allocate an I/O channel for the given blobstore.
bs | blobstore. |
void spdk_bs_blob_decouple_parent | ( | struct spdk_blob_store * | bs, |
struct spdk_io_channel * | channel, | ||
spdk_blob_id | blobid, | ||
spdk_blob_op_complete | cb_fn, | ||
void * | cb_arg ) |
Remove dependency on parent blob.
This call allocates and copies data for any clusters that are allocated in the parent blob, and decouples parent updating dependencies of blob to its ancestor.
If blob have no parent -EINVAL error is reported.
bs | blobstore. |
channel | IO channel used to inflate blob. |
blobid | The id of the blob. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_blob_set_external_parent | ( | struct spdk_blob_store * | bs, |
spdk_blob_id | blob_id, | ||
struct spdk_bs_dev * | esnap_bs_dev, | ||
const void * | esnap_id, | ||
uint32_t | esnap_id_len, | ||
spdk_blob_op_complete | cb_fn, | ||
void * | cb_arg ) |
Set an external snapshot as the parent of a blob.
This call set an external snapshot as the parent of a blob, making the blob a clone of this external snapshot. The previous parent of the blob, if any, can be another external snapshot or a snapshot; if the blob is not a clone, it must be thin-provisioned.
bs | blobstore. |
blob_id | The id of the blob. |
esnap_bs_dev | The new blobstore device to use as an external snapshot. |
esnap_id | The identifier of the external snapshot. |
esnap_id_len | The length of esnap_id, in bytes. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_blob_set_parent | ( | struct spdk_blob_store * | bs, |
spdk_blob_id | blob_id, | ||
spdk_blob_id | snapshot_id, | ||
spdk_blob_op_complete | cb_fn, | ||
void * | cb_arg ) |
Set a snapshot as the parent of a blob.
This call set a snapshot as the parent of a blob, making the blob a clone of this snapshot. The previous parent of the blob, if any, can be another snapshot or an external snapshot; if the blob is not a clone, it must be thin-provisioned. Blob and parent snapshot must have the same size.
bs | blobstore. |
blob_id | The id of the blob. |
snapshot_id | The id of the parent snapshot. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
int spdk_bs_blob_shallow_copy | ( | struct spdk_blob_store * | bs, |
struct spdk_io_channel * | channel, | ||
spdk_blob_id | blobid, | ||
struct spdk_bs_dev * | ext_dev, | ||
spdk_blob_shallow_copy_status | status_cb_fn, | ||
void * | status_cb_arg, | ||
spdk_blob_op_complete | cb_fn, | ||
void * | cb_arg ) |
Perform a shallow copy of a blob to a blobstore device.
This makes a shallow copy from a blob to a blobstore device. Only clusters allocated to the blob will be written on the device. Blob must be read only and blob size must be less or equal than device size. Blobstore block size must be a multiple of device block size.
bs | Blobstore |
channel | IO channel used to copy the blob. |
blobid | The id of the blob. |
ext_dev | The device to copy on |
status_cb_fn | Called repeatedly during operation with status updates |
status_cb_arg | Argument passed to function status_cb_fn. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_create_blob | ( | struct spdk_blob_store * | bs, |
spdk_blob_op_with_id_complete | cb_fn, | ||
void * | cb_arg ) |
Create a new blob with default option values on the given blobstore.
The new blob id will be passed to the callback function.
bs | blobstore. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_create_blob_ext | ( | struct spdk_blob_store * | bs, |
const struct spdk_blob_opts * | opts, | ||
spdk_blob_op_with_id_complete | cb_fn, | ||
void * | cb_arg ) |
Create a new blob with options on the given blobstore.
The new blob id will be passed to the callback function.
bs | blobstore. |
opts | The structure which contains the option values for the new blob. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_create_clone | ( | struct spdk_blob_store * | bs, |
spdk_blob_id | blobid, | ||
const struct spdk_blob_xattr_opts * | clone_xattrs, | ||
spdk_blob_op_with_id_complete | cb_fn, | ||
void * | cb_arg ) |
Create a clone of specified read-only blob.
Structure clone_xattrs as well as anything it references (like e.g. names array) must be valid until the completion is called.
bs | blobstore. |
blobid | Id of the read only blob used as a snapshot for new clone. |
clone_xattrs | xattrs specified for clone. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_create_snapshot | ( | struct spdk_blob_store * | bs, |
spdk_blob_id | blobid, | ||
const struct spdk_blob_xattr_opts * | snapshot_xattrs, | ||
spdk_blob_op_with_id_complete | cb_fn, | ||
void * | cb_arg ) |
Create a read-only snapshot of specified blob with provided options.
This will automatically sync specified blob.
When operation is done, original blob is converted to the thin-provisioned blob with a newly created read-only snapshot set as a backing blob. Structure snapshot_xattrs as well as anything it references (like e.g. names array) must be valid until the completion is called.
bs | blobstore. |
blobid | Id of the source blob used to create a snapshot. |
snapshot_xattrs | xattrs specified for snapshot. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_delete_blob | ( | struct spdk_blob_store * | bs, |
spdk_blob_id | blobid, | ||
spdk_blob_op_complete | cb_fn, | ||
void * | cb_arg ) |
Delete an existing blob from the given blobstore.
bs | blobstore. |
blobid | The id of the blob to delete. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_destroy | ( | struct spdk_blob_store * | bs, |
spdk_bs_op_complete | cb_fn, | ||
void * | cb_arg ) |
Destroy the blobstore.
It will destroy the blobstore by zeroing the super block.
bs | blobstore to destroy. |
cb_fn | Called when the destruction is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_dump | ( | struct spdk_bs_dev * | dev, |
FILE * | fp, | ||
spdk_bs_dump_print_xattr | print_xattr_fn, | ||
spdk_bs_op_complete | cb_fn, | ||
void * | cb_arg ) |
Dump a blobstore's metadata to a given FILE in human-readable format.
dev | Blobstore block device. |
fp | FILE pointer to dump the metadata contents. |
print_xattr_fn | Callback function to interpret external xattrs. |
cb_fn | Called when the dump is complete. |
cb_arg | Argument passed to function cb_fn. |
uint64_t spdk_bs_free_cluster_count | ( | struct spdk_blob_store * | bs | ) |
Get the number of free clusters.
bs | blobstore to query. |
void spdk_bs_free_io_channel | ( | struct spdk_io_channel * | channel | ) |
Free the I/O channel.
channel | I/O channel to free. |
struct spdk_bs_type spdk_bs_get_bstype | ( | struct spdk_blob_store * | bs | ) |
Get blobstore type of the given device.
bs | blobstore to query. |
uint64_t spdk_bs_get_cluster_size | ( | struct spdk_blob_store * | bs | ) |
Get the cluster size in bytes.
bs | blobstore to query. |
uint64_t spdk_bs_get_io_unit_size | ( | struct spdk_blob_store * | bs | ) |
Get the io unit size in bytes.
bs | blobstore to query. |
uint64_t spdk_bs_get_page_size | ( | struct spdk_blob_store * | bs | ) |
Get the metadata page size in bytes.
bs | blobstore to query. |
void spdk_bs_get_super | ( | struct spdk_blob_store * | bs, |
spdk_blob_op_with_id_complete | cb_fn, | ||
void * | cb_arg ) |
Get the super blob.
The obtained blob id will be passed to the callback function.
bs | blobstore. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_grow | ( | struct spdk_bs_dev * | dev, |
struct spdk_bs_opts * | opts, | ||
spdk_bs_op_with_handle_complete | cb_fn, | ||
void * | cb_arg ) |
Grow a blobstore to fill the underlying device Cannot be used on loaded blobstore.
dev | Blobstore block device. |
opts | The structure which contains the option values for the blobstore. |
cb_fn | Called when the loading is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_grow_live | ( | struct spdk_blob_store * | bs, |
spdk_bs_op_complete | cb_fn, | ||
void * | cb_arg ) |
Grow a blobstore to fill the underlying device.
Can be used on loaded blobstore, even with opened blobs.
bs | blobstore to grow. |
cb_fn | Called when the growing is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_inflate_blob | ( | struct spdk_blob_store * | bs, |
struct spdk_io_channel * | channel, | ||
spdk_blob_id | blobid, | ||
spdk_blob_op_complete | cb_fn, | ||
void * | cb_arg ) |
Allocate all clusters in this blob.
Data for allocated clusters is copied from backing blob(s) if they exist.
This call removes all dependencies on any backing blobs.
bs | blobstore. |
channel | IO channel used to inflate blob. |
blobid | The id of the blob to inflate. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_init | ( | struct spdk_bs_dev * | dev, |
struct spdk_bs_opts * | opts, | ||
spdk_bs_op_with_handle_complete | cb_fn, | ||
void * | cb_arg ) |
Initialize a blobstore on the given device.
dev | Blobstore block device. |
opts | The structure which contains the option values for the blobstore. |
cb_fn | Called when the initialization is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_iter_first | ( | struct spdk_blob_store * | bs, |
spdk_blob_op_with_handle_complete | cb_fn, | ||
void * | cb_arg ) |
Get the first blob of the blobstore.
The obtained blob will be passed to the callback function.
The user's cb_fn will be called with rc == -ENOENT when the iteration is complete.
When the user's cb_fn is called with rc == 0, the associated blob is open. This means that the cb_fn may not attempt to unload the blobstore. It must complete the iteration before attempting to unload.
bs | blobstore to traverse. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_iter_next | ( | struct spdk_blob_store * | bs, |
struct spdk_blob * | blob, | ||
spdk_blob_op_with_handle_complete | cb_fn, | ||
void * | cb_arg ) |
Get the next blob by using the current blob.
The obtained blob will be passed to the callback function.
The user's cb_fn will be called with rc == -ENOENT when the iteration is complete.
When the user's cb_fn is called with rc == 0, the associated blob is open. This means that the cb_fn may not attempt to unload the blobstore. It must complete the iteration before attempting to unload.
bs | blobstore to traverse. |
blob | The current blob. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_load | ( | struct spdk_bs_dev * | dev, |
struct spdk_bs_opts * | opts, | ||
spdk_bs_op_with_handle_complete | cb_fn, | ||
void * | cb_arg ) |
Load a blobstore from the given device.
dev | Blobstore block device. |
opts | The structure which contains the option values for the blobstore. |
cb_fn | Called when the loading is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_open_blob | ( | struct spdk_blob_store * | bs, |
spdk_blob_id | blobid, | ||
spdk_blob_op_with_handle_complete | cb_fn, | ||
void * | cb_arg ) |
Open a blob from the given blobstore.
bs | blobstore. |
blobid | The id of the blob to open. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_open_blob_ext | ( | struct spdk_blob_store * | bs, |
spdk_blob_id | blobid, | ||
struct spdk_blob_open_opts * | opts, | ||
spdk_blob_op_with_handle_complete | cb_fn, | ||
void * | cb_arg ) |
Open a blob from the given blobstore with additional options.
bs | blobstore. |
blobid | The id of the blob to open. |
opts | The structure which contains the option values for the blob. |
cb_fn | Called when the operation is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bs_opts_init | ( | struct spdk_bs_opts * | opts, |
size_t | opts_size ) |
Initialize a spdk_bs_opts structure to the default blobstore option values.
opts | The spdk_bs_opts structure to be initialized. |
opts_size | The opts_size must be the size of spdk_bs_opts structure. |
void spdk_bs_set_bstype | ( | struct spdk_blob_store * | bs, |
struct spdk_bs_type | bstype ) |
Set blobstore type to the given device.
bs | blobstore to set to. |
bstype | Type label to set. |
void spdk_bs_set_super | ( | struct spdk_blob_store * | bs, |
spdk_blob_id | blobid, | ||
spdk_bs_op_complete | cb_fn, | ||
void * | cb_arg ) |
Set a super blob on the given blobstore.
This will be retrievable immediately after spdk_bs_load() on the next initialization.
bs | blobstore. |
blobid | The id of the blob which will be set as the super blob. |
cb_fn | Called when the setting is complete. |
cb_arg | Argument passed to function cb_fn. |
uint64_t spdk_bs_total_data_cluster_count | ( | struct spdk_blob_store * | bs | ) |
Get the total number of clusters accessible by user.
bs | blobstore to query. |
void spdk_bs_unload | ( | struct spdk_blob_store * | bs, |
spdk_bs_op_complete | cb_fn, | ||
void * | cb_arg ) |
Unload the blobstore.
It will flush all volatile data to disk.
bs | blobstore to unload. |
cb_fn | Called when the unloading is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_xattr_names_free | ( | struct spdk_xattr_names * | names | ) |
Free the attribute names.
names | Names of total extended attributes of the blob. |
uint32_t spdk_xattr_names_get_count | ( | struct spdk_xattr_names * | names | ) |
Get the number of extended attributes.
names | Names of total extended attributes of the blob. |
const char * spdk_xattr_names_get_name | ( | struct spdk_xattr_names * | names, |
uint32_t | index ) |
Get the attribute name specified by the index.
names | Names of total extended attributes of the blob. |
index | Index position of the specified attribute. |