bdev/compress: Cleanup vbdev_reduce_load_cb() by code reordering
Reorder vbdev_redoce_load_cb() so that normal case comes first, orphaned case comes second, and other error cases come at last. This will simplify the code and improve readability a little. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: Ieb79364f0b3996600e8ff7ec340101877527cac2 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1477 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
99e6fe4102
commit
d5a0220ed1
@ -1754,19 +1754,18 @@ vbdev_reduce_load_cb(void *cb_arg, struct spdk_reduce_vol *vol, int reduce_errno
|
||||
}
|
||||
meta_ctx->base_desc = NULL;
|
||||
|
||||
if (reduce_errno != 0 && reduce_errno != -ENOENT) {
|
||||
/* This error means it is not a compress disk. */
|
||||
if (reduce_errno != -EILSEQ) {
|
||||
SPDK_ERRLOG("for vol %s, error %u\n",
|
||||
spdk_bdev_get_name(meta_ctx->base_bdev), reduce_errno);
|
||||
}
|
||||
if (reduce_errno == 0) {
|
||||
if (_set_pmd(meta_ctx) == false) {
|
||||
SPDK_ERRLOG("could not find required pmd\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* this status means that the vol could not be loaded because
|
||||
* the pmem file can't be found.
|
||||
*/
|
||||
if (reduce_errno == -ENOENT) {
|
||||
/* Update information following volume load. */
|
||||
meta_ctx->vol = vol;
|
||||
memcpy(&meta_ctx->params, spdk_reduce_vol_get_params(vol),
|
||||
sizeof(struct spdk_reduce_vol_params));
|
||||
vbdev_compress_claim(meta_ctx);
|
||||
} else if (reduce_errno == -ENOENT) {
|
||||
if (_set_compbdev_name(meta_ctx)) {
|
||||
goto err;
|
||||
}
|
||||
@ -1798,22 +1797,17 @@ vbdev_reduce_load_cb(void *cb_arg, struct spdk_reduce_vol *vol, int reduce_errno
|
||||
|
||||
meta_ctx->orphaned = true;
|
||||
TAILQ_INSERT_TAIL(&g_vbdev_comp, meta_ctx, link);
|
||||
spdk_bdev_module_examine_done(&compress_if);
|
||||
return;
|
||||
} else {
|
||||
if (reduce_errno != -EILSEQ) {
|
||||
SPDK_ERRLOG("for vol %s, error %u\n",
|
||||
spdk_bdev_get_name(meta_ctx->base_bdev), reduce_errno);
|
||||
}
|
||||
|
||||
if (_set_pmd(meta_ctx) == false) {
|
||||
SPDK_ERRLOG("could not find required pmd\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Update information following volume load. */
|
||||
meta_ctx->vol = vol;
|
||||
memcpy(&meta_ctx->params, spdk_reduce_vol_get_params(vol),
|
||||
sizeof(struct spdk_reduce_vol_params));
|
||||
vbdev_compress_claim(meta_ctx);
|
||||
spdk_bdev_module_examine_done(&compress_if);
|
||||
return;
|
||||
|
||||
err:
|
||||
free(meta_ctx);
|
||||
spdk_bdev_module_examine_done(&compress_if);
|
||||
|
Loading…
Reference in New Issue
Block a user