From e4150a55409146db8e465566afb74dd668e1298d Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Fri, 5 Jan 2018 11:16:37 +0800 Subject: [PATCH] lvol: add a wrapper function for calling spdk_bs_init Purpose: Make the max_channel_ops initialization in the single place, and we only need to call spdk_lvol_bs_opts_init instead of spdk_bs_opts_init Change-Id: If1dd0b30e982a26ab2801a0dd99dd82633e02c74 Signed-off-by: Ziye Yang Reviewed-on: https://review.gerrithub.io/393722 Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- lib/lvol/lvol.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/lvol/lvol.c b/lib/lvol/lvol.c index 98a6b9e6c..86118a5c4 100644 --- a/lib/lvol/lvol.c +++ b/lib/lvol/lvol.c @@ -368,6 +368,13 @@ _spdk_lvs_load_cb(void *cb_arg, struct spdk_blob_store *bs, int lvolerrno) spdk_bs_get_super(bs, _spdk_lvs_open_super, req); } +static void +spdk_lvs_bs_opts_init(struct spdk_bs_opts *opts) +{ + spdk_bs_opts_init(opts); + opts->max_channel_ops = SPDK_LVOL_BLOB_OPTS_CHANNEL_OPS; +} + void spdk_lvs_load(struct spdk_bs_dev *bs_dev, spdk_lvs_op_with_handle_complete cb_fn, void *cb_arg) { @@ -393,8 +400,7 @@ spdk_lvs_load(struct spdk_bs_dev *bs_dev, spdk_lvs_op_with_handle_complete cb_fn req->cb_arg = cb_arg; req->bs_dev = bs_dev; - spdk_bs_opts_init(&opts); - opts.max_channel_ops = SPDK_LVOL_BLOB_OPTS_CHANNEL_OPS; + spdk_lvs_bs_opts_init(&opts); strncpy(opts.bstype.bstype, "LVOLSTORE", SPDK_BLOBSTORE_TYPE_LENGTH); spdk_bs_load(bs_dev, &opts, _spdk_lvs_load_cb, req); @@ -535,7 +541,7 @@ static void _spdk_setup_lvs_opts(struct spdk_bs_opts *bs_opts, struct spdk_lvs_opts *o) { assert(o != NULL); - spdk_bs_opts_init(bs_opts); + spdk_lvs_bs_opts_init(bs_opts); bs_opts->cluster_sz = o->cluster_sz; }