blob: fix bug when specifing cluster size < 4096
Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com> Change-Id: I59cbef4ce1bfe8af113c66c2c9cb9f208440c0aa Reviewed-on: https://review.gerrithub.io/383887 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
957ebeb506
commit
9d17cbdd23
@ -1408,6 +1408,12 @@ _spdk_bs_alloc(struct spdk_bs_dev *dev, struct spdk_bs_opts *opts)
|
||||
opts->cluster_sz);
|
||||
return NULL;
|
||||
}
|
||||
if (opts->cluster_sz < SPDK_BS_PAGE_SIZE) {
|
||||
/* Cluster size cannot be smaller than page size */
|
||||
SPDK_ERRLOG("Cluster size %d is smaller than page size %d\n",
|
||||
opts->cluster_sz, SPDK_BS_PAGE_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
bs = calloc(1, sizeof(struct spdk_blob_store));
|
||||
if (!bs) {
|
||||
return NULL;
|
||||
|
@ -1188,6 +1188,19 @@ bs_cluster_sz(void)
|
||||
CU_ASSERT(g_bserrno == -ENOMEM);
|
||||
SPDK_CU_ASSERT_FATAL(g_bs == NULL);
|
||||
|
||||
/*
|
||||
* Set cluster size to lower than page size,
|
||||
* to work it is required to be at least twice the blobstore page size.
|
||||
*/
|
||||
dev = init_dev();
|
||||
spdk_bs_opts_init(&opts);
|
||||
opts.cluster_sz = SPDK_BS_PAGE_SIZE - 1;
|
||||
|
||||
/* Initialize a new blob store */
|
||||
spdk_bs_init(dev, &opts, bs_op_with_handle_complete, NULL);
|
||||
CU_ASSERT(g_bserrno == -ENOMEM);
|
||||
SPDK_CU_ASSERT_FATAL(g_bs == NULL);
|
||||
|
||||
/* Set cluster size to twice the default */
|
||||
dev = init_dev();
|
||||
spdk_bs_opts_init(&opts);
|
||||
|
Loading…
Reference in New Issue
Block a user