blob: Add a separate config parameter for channel ops

Separate the maximum metadata operations from the
maximum channel operations.

Change-Id: I1bbd440ab094a2a2e19c9a5b71724ac91ba88e42
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ben Walker 2017-05-15 14:35:03 -07:00
parent bea2e2308f
commit 4a3182b891
3 changed files with 9 additions and 3 deletions

View File

@ -139,6 +139,7 @@ struct spdk_bs_opts {
uint32_t cluster_sz; /* In bytes. Must be multiple of page size. */
uint32_t num_md_pages; /* Count of the number of pages reserved for metadata */
uint32_t max_md_ops; /* Maximum simultaneous metadata operations */
uint32_t max_channel_ops; /* Maximum simultaneous operations per channel */
};
/* Initialize an spdk_bs_opts structure to the default blobstore option values. */

View File

@ -1057,7 +1057,8 @@ _spdk_bs_channel_create(void *io_device, uint32_t priority, void *ctx_buf, void
struct spdk_bs_channel *channel = ctx_buf;
uint32_t i;
channel->req_mem = calloc(bs->max_md_ops, sizeof(struct spdk_bs_request_set));
channel->req_mem = calloc(spdk_max(bs->max_channel_ops, bs->max_md_ops),
sizeof(struct spdk_bs_request_set));
if (!channel->req_mem) {
free(channel);
return -1;
@ -1065,7 +1066,7 @@ _spdk_bs_channel_create(void *io_device, uint32_t priority, void *ctx_buf, void
TAILQ_INIT(&channel->reqs);
for (i = 0; i < bs->max_md_ops; i++) {
for (i = 0; i < spdk_max(bs->max_channel_ops, bs->max_md_ops); i++) {
TAILQ_INSERT_TAIL(&channel->reqs, &channel->req_mem[i], link);
}
@ -1111,6 +1112,7 @@ spdk_bs_opts_init(struct spdk_bs_opts *opts)
opts->cluster_sz = SPDK_BLOB_OPTS_CLUSTER_SZ;
opts->num_md_pages = SPDK_BLOB_OPTS_NUM_MD_PAGES;
opts->max_md_ops = SPDK_BLOB_OPTS_MAX_MD_OPS;
opts->max_channel_ops = SPDK_BLOB_OPTS_MAX_CHANNEL_OPS;
}
static struct spdk_blob_store *
@ -1141,6 +1143,7 @@ _spdk_bs_alloc(struct spdk_bs_dev *dev, struct spdk_bs_opts *opts)
}
bs->max_md_ops = opts->max_md_ops;
bs->max_channel_ops = opts->max_channel_ops;
bs->super_blob = SPDK_BLOBID_INVALID;
/* The metadata is assumed to be at least 1 page */

View File

@ -46,7 +46,8 @@
#define SPDK_BLOB_OPTS_CLUSTER_SZ (1024 * 1024)
#define SPDK_BLOB_OPTS_NUM_MD_PAGES UINT32_MAX
#define SPDK_BLOB_OPTS_MAX_MD_OPS 512
#define SPDK_BLOB_OPTS_MAX_MD_OPS 32
#define SPDK_BLOB_OPTS_MAX_CHANNEL_OPS 512
struct spdk_xattr {
/* TODO: reorder for best packing */
@ -145,6 +146,7 @@ struct spdk_blob_store {
uint32_t pages_per_cluster;
uint32_t max_md_ops;
uint32_t max_channel_ops;
spdk_blob_id super_blob;