Extracting codes to a function, makes the more clear. Signed-off-by: yidong0635 <dongx.yi@intel.com> Change-Id: I49ae7b4f07ebacbeaf0c03941aeefc4657317e3b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5304 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>