lib/ftl: Fix size of write buffer submission queue
SPDK ring size used for write buffer submission queue must be increased if required number of batches is a power of two. Change-Id: I9b9f885064cf6f0f5fe94b0ed4f9d49a4e5c0cd0 Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com> Reviewed-on: https://review.gerrithub.io/c/445721 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
a427139e15
commit
1442b5f28a
@ -178,7 +178,7 @@ ftl_rwb_init(const struct spdk_ftl_conf *conf, size_t xfer_size, size_t md_size)
|
|||||||
{
|
{
|
||||||
struct ftl_rwb *rwb;
|
struct ftl_rwb *rwb;
|
||||||
struct ftl_rwb_batch *batch;
|
struct ftl_rwb_batch *batch;
|
||||||
size_t ring_size, i;
|
size_t i;
|
||||||
|
|
||||||
rwb = calloc(1, sizeof(*rwb));
|
rwb = calloc(1, sizeof(*rwb));
|
||||||
if (!rwb) {
|
if (!rwb) {
|
||||||
@ -191,14 +191,13 @@ ftl_rwb_init(const struct spdk_ftl_conf *conf, size_t xfer_size, size_t md_size)
|
|||||||
rwb->md_size = md_size;
|
rwb->md_size = md_size;
|
||||||
rwb->num_batches = conf->rwb_size / (FTL_BLOCK_SIZE * xfer_size);
|
rwb->num_batches = conf->rwb_size / (FTL_BLOCK_SIZE * xfer_size);
|
||||||
|
|
||||||
ring_size = spdk_align32pow2(rwb->num_batches);
|
|
||||||
|
|
||||||
rwb->batches = calloc(rwb->num_batches, sizeof(*rwb->batches));
|
rwb->batches = calloc(rwb->num_batches, sizeof(*rwb->batches));
|
||||||
if (!rwb->batches) {
|
if (!rwb->batches) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
rwb->submit_queue = spdk_ring_create(SPDK_RING_TYPE_MP_SC, ring_size,
|
rwb->submit_queue = spdk_ring_create(SPDK_RING_TYPE_MP_SC,
|
||||||
|
spdk_align32pow2(rwb->num_batches + 1),
|
||||||
SPDK_ENV_SOCKET_ID_ANY);
|
SPDK_ENV_SOCKET_ID_ANY);
|
||||||
if (!rwb->submit_queue) {
|
if (!rwb->submit_queue) {
|
||||||
SPDK_ERRLOG("Failed to create submission queue\n");
|
SPDK_ERRLOG("Failed to create submission queue\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user