From e9344656a0c0abc72362eacbbeee1e7a37f1cbd4 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Tue, 23 Oct 2018 11:30:12 +0900 Subject: [PATCH] bdev/raid: Fix duplicated initialization between create and configure Remove the duplicated operation and reorder configure() to initialize the raid_bdev and then the bdev. Change-Id: Ic39da1936b0755e6acd1ae62bd55a241b77f7056 Signed-off-by: Shuhei Matsumoto Reviewed-on: https://review.gerrithub.io/430400 Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Seth Howell Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- lib/bdev/raid/bdev_raid.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/bdev/raid/bdev_raid.c b/lib/bdev/raid/bdev_raid.c index 116a352f62..edd5ac5b46 100644 --- a/lib/bdev/raid/bdev_raid.c +++ b/lib/bdev/raid/bdev_raid.c @@ -1273,6 +1273,7 @@ raid_bdev_create(struct raid_bdev_config *raid_cfg) raid_bdev_gen->ctxt = raid_bdev; raid_bdev_gen->fn_table = &g_raid_bdev_fn_table; raid_bdev_gen->module = &g_raid_if; + raid_bdev_gen->write_cache = 0; TAILQ_INSERT_TAIL(&g_spdk_raid_bdev_configuring_list, raid_bdev, state_link); TAILQ_INSERT_TAIL(&g_spdk_raid_bdev_list, raid_bdev, global_link); @@ -1364,15 +1365,12 @@ raid_bdev_configure(struct raid_bdev *raid_bdev) } } - raid_bdev_gen = &raid_bdev->bdev; - raid_bdev_gen->write_cache = 0; - raid_bdev_gen->blocklen = blocklen; - raid_bdev_gen->ctxt = raid_bdev; - raid_bdev_gen->fn_table = &g_raid_bdev_fn_table; - raid_bdev_gen->module = &g_raid_if; raid_bdev->strip_size = (raid_bdev->strip_size * 1024) / blocklen; raid_bdev->strip_size_shift = spdk_u32log2(raid_bdev->strip_size); raid_bdev->blocklen_shift = spdk_u32log2(blocklen); + + raid_bdev_gen = &raid_bdev->bdev; + raid_bdev_gen->blocklen = blocklen; if (raid_bdev->num_base_bdevs > 1) { raid_bdev_gen->optimal_io_boundary = raid_bdev->strip_size; raid_bdev_gen->split_on_optimal_io_boundary = true;