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;
|
meta_ctx->base_desc = NULL;
|
||||||
|
|
||||||
if (reduce_errno != 0 && reduce_errno != -ENOENT) {
|
if (reduce_errno == 0) {
|
||||||
/* This error means it is not a compress disk. */
|
if (_set_pmd(meta_ctx) == false) {
|
||||||
if (reduce_errno != -EILSEQ) {
|
SPDK_ERRLOG("could not find required pmd\n");
|
||||||
SPDK_ERRLOG("for vol %s, error %u\n",
|
|
||||||
spdk_bdev_get_name(meta_ctx->base_bdev), reduce_errno);
|
|
||||||
}
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this status means that the vol could not be loaded because
|
/* Update information following volume load. */
|
||||||
* the pmem file can't be found.
|
meta_ctx->vol = vol;
|
||||||
*/
|
memcpy(&meta_ctx->params, spdk_reduce_vol_get_params(vol),
|
||||||
if (reduce_errno == -ENOENT) {
|
sizeof(struct spdk_reduce_vol_params));
|
||||||
|
vbdev_compress_claim(meta_ctx);
|
||||||
|
} else if (reduce_errno == -ENOENT) {
|
||||||
if (_set_compbdev_name(meta_ctx)) {
|
if (_set_compbdev_name(meta_ctx)) {
|
||||||
goto err;
|
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;
|
meta_ctx->orphaned = true;
|
||||||
TAILQ_INSERT_TAIL(&g_vbdev_comp, meta_ctx, link);
|
TAILQ_INSERT_TAIL(&g_vbdev_comp, meta_ctx, link);
|
||||||
spdk_bdev_module_examine_done(&compress_if);
|
} else {
|
||||||
return;
|
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;
|
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);
|
spdk_bdev_module_examine_done(&compress_if);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
free(meta_ctx);
|
free(meta_ctx);
|
||||||
spdk_bdev_module_examine_done(&compress_if);
|
spdk_bdev_module_examine_done(&compress_if);
|
||||||
|
Loading…
Reference in New Issue
Block a user