From 10ee6eecb35ab4de5a5601bcbf06b27a31d833aa Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Tue, 11 Sep 2018 13:57:21 -0700 Subject: [PATCH] bdev/raid: optimize for single base bdev case We do not need to split I/O to single base bdev RAID, since strips do not really apply. Signed-off-by: Jim Harris Change-Id: I0fa741f627b5aeb15d2ab19365afac4f48248654 Reviewed-on: https://review.gerrithub.io/425322 Reviewed-by: Paul Luse Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto Reviewed-by: Kunal Sablok Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System --- lib/bdev/raid/bdev_raid.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/bdev/raid/bdev_raid.c b/lib/bdev/raid/bdev_raid.c index 001d84ef8..77b7b7d1c 100644 --- a/lib/bdev/raid/bdev_raid.c +++ b/lib/bdev/raid/bdev_raid.c @@ -453,7 +453,7 @@ raid_bdev_start_rw_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev start_strip = bdev_io->u.bdev.offset_blocks >> raid_bdev->strip_size_shift; end_strip = (bdev_io->u.bdev.offset_blocks + bdev_io->u.bdev.num_blocks - 1) >> raid_bdev->strip_size_shift; - if (start_strip != end_strip) { + if (start_strip != end_strip && raid_bdev->num_base_bdevs > 1) { assert(false); SPDK_ERRLOG("I/O spans strip boundary!\n"); spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED); @@ -1292,8 +1292,14 @@ raid_bdev_configure(struct raid_bdev *raid_bdev) 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->optimal_io_boundary = raid_bdev->strip_size; - raid_bdev_gen->split_on_optimal_io_boundary = true; + 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; + } else { + /* Do not need to split reads/writes on single bdev RAID modules. */ + raid_bdev_gen->optimal_io_boundary = 0; + raid_bdev_gen->split_on_optimal_io_boundary = false; + } /* * RAID bdev logic is for striping so take the minimum block count based