nvmf: return early in nvmf_transport_poll_group_create
When buf_cache_size is 0, just return early. This allows us to un-indent a large section of code. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I167da677fdcd0504c6f2bfdb8b1a818155642f66 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17333 Community-CI: Mellanox Build Bot Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
2597ebbede
commit
280a3abc9c
@ -551,7 +551,11 @@ nvmf_transport_poll_group_create(struct spdk_nvmf_transport *transport,
|
|||||||
STAILQ_INIT(&tgroup->pending_buf_queue);
|
STAILQ_INIT(&tgroup->pending_buf_queue);
|
||||||
STAILQ_INIT(&tgroup->buf_cache);
|
STAILQ_INIT(&tgroup->buf_cache);
|
||||||
|
|
||||||
if (transport->opts.buf_cache_size) {
|
if (transport->opts.buf_cache_size == 0) {
|
||||||
|
/* We aren't going to allocate any buffers for the cache, so just return now. */
|
||||||
|
return tgroup;
|
||||||
|
}
|
||||||
|
|
||||||
tgroup->buf_cache_size = transport->opts.buf_cache_size;
|
tgroup->buf_cache_size = transport->opts.buf_cache_size;
|
||||||
bufs = calloc(tgroup->buf_cache_size, sizeof(struct spdk_nvmf_transport_pg_cache_buf *));
|
bufs = calloc(tgroup->buf_cache_size, sizeof(struct spdk_nvmf_transport_pg_cache_buf *));
|
||||||
|
|
||||||
@ -580,7 +584,6 @@ nvmf_transport_poll_group_create(struct spdk_nvmf_transport *transport,
|
|||||||
tgroup->buf_cache_count = tgroup->buf_cache_size;
|
tgroup->buf_cache_count = tgroup->buf_cache_size;
|
||||||
|
|
||||||
free(bufs);
|
free(bufs);
|
||||||
}
|
|
||||||
|
|
||||||
return tgroup;
|
return tgroup;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user