Commit Graph

68 Commits

Author SHA1 Message Date
wuzhouhui
7806ece53b bdev/raid: raid_bdev_add_base_device: fix wrong param in log
And adjust language a little, by the way

Change-Id: I6bd6412a061657b23c4fd2e2db265da56b823514
Signed-off-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/431581
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-11-02 22:19:02 +00:00
wuzhouhui
1ab092348a bdev/raid: avoid reference null pointer in log message
glibc will print "(null)" if we pass a null pointer as the argument for
a %s conversion, but it is not a standard behavior.

Change-Id: I85a6b4d571a60e7f3755d13722247e7494998a94
Signed-off-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/431725
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-11-02 18:56:25 +00:00
Jim Harris
fd1e204647 bdev: remove "v" prefix from vbdev library names
Let's just make them consistent and all with a
bdev_* format.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia3dec7f4be2ecc765b4aa095e6b675f13d326063

Reviewed-on: https://review.gerrithub.io/429289
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
2018-11-01 21:25:55 +00:00
Shuhei Matsumoto
8f06e9528d bdev/raid: Refactor raid_bdev_remove_base_bdev
Put the core operation into the loop without using the found flag.

Change-Id: I6509988f11a87e7a7f0ffbad46a090837ee9de20
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/430512
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2018-10-31 22:45:33 +00:00
Shuhei Matsumoto
935c0b4745 bdev/raid: Remove unnecessary check in raid_bdev_remove_base_bdev
The condition that both raid_bdev and raid_bdev->base_bdev_info[i].bdev
are not NULL is already verified by matching it with base_bdev.

This is a preparation to the further refactoring in the next patch.

Change-Id: I273a31c2ff2f79caf52b59938eee547129768abe
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/430511
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com>
2018-10-31 22:45:33 +00:00
Shuhei Matsumoto
e9344656a0 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 <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/430400
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-10-31 22:45:33 +00:00
Shuhei Matsumoto
bf9dbb9f3b bdev: Use not C++ style comments // but C-style comments /* */
Change-Id: Ic3026ae58e8495586fc9c6e61a570cd050819b67
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/431080
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-10-31 22:01:47 +00:00
wuzhouhui
e8b0ae0393 bdev/raid: raid_bdev_remove_base_bdev: cleanup not registered raid bdev
If raid bdev creation failed, the bdev still be configuring and not
register it. For those raid bdev, raid_bdev_remove_base_bdev() should
cleanup them as well.

Change-Id: If2eda8ec80e7fdeb5e551fafe57a43a27ae0f9e6
Signed-off-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/427331
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-10-15 21:49:46 +00:00
wuzhouhui
5349f4b2d4 bdev/raid: do not set configuring raid bdev to offline
Previously, the difference between configuring and offline is
unclear, this patch just fixes it. The key difference should be
whether the raid bdev have ever registered. Offline is registered
before but unregistered now, and configuring has never registered.

According to the above, we should never set configuring raid bdev to
offline because it never got registered.

Change-Id: Id44ef6654e032993ffb8444e7e7ae3e43a9b0f16
Signed-off-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/428321
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2018-10-15 21:49:46 +00:00
wuzhouhui
d5132e871c bdev/raid: raid_bdev_add_base_devices: fix wrong param of spdk_strerror
And add newline at the end, by the way.

Change-Id: I0b3b72c066e5bb161d9e7212367c8ff663a95b27
Signed-off-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/427330
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2018-10-04 21:39:40 +00:00
Shuhei Matsumoto
ef80470338 bdev/raid: Add .INI config dump
Add dump the current configuration of raid bdevs to the specified
file for .INI config file.

.INI config file will be deprecated but this addition will be helpful
for now.

Change-Id: I35582ceaff18d81b066e3e63e0c8c22525ec6b9e
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/426299
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Hailiang Wang <hailiangx.e.wang@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-09-26 15:39:37 +00:00
Shuhei Matsumoto
ed6a63d569 bdev/raid: Add JSON config dump
Change-Id: I5b2832aad585145e021e26ac288da91ece2153a9
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/426289
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-09-26 15:39:37 +00:00
Shuhei Matsumoto
9d1b8599ea bdev/raid: Remove duplicated error check in construct RPC
This part was duplicated but was not removed during refactoring caressly.

Additionally, the variable iter was not changed to the single character
variable i too.

Fix them in this patch.

Change-Id: I1e026434ce48e9e8d492a3aa772c3be6df0b1d37
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/425528
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-09-26 15:39:37 +00:00
Jim Harris
10ee6eecb3 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 <james.r.harris@intel.com>
Change-Id: I0fa741f627b5aeb15d2ab19365afac4f48248654

Reviewed-on: https://review.gerrithub.io/425322
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2018-09-12 13:18:12 +00:00
Jim Harris
13c3b147dc bdev/raid: rename some of the I/O submission path functions
These new names are a bit more clear after some of the recent
I/O splitting changes.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ibe265ca2f969ee1058316c519e5d679861e03713

Reviewed-on: https://review.gerrithub.io/425321
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2018-09-12 13:18:12 +00:00
Jim Harris
f2a9507af6 bdev/raid: enable multiple iovs
The bdevio tests will now work on RAID volumes, so enable
RAID testing there too.

It is probably safe now to just build RAID by default, and
not require --with-raid - but let's do some more testing
with vhost and NVMe-oF against it first before we do so.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I15697f035cb688574a7ecb8be24d0c84fc622d83

Reviewed-on: https://review.gerrithub.io/423408
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2018-09-12 13:18:12 +00:00
Jim Harris
4c60fa994f bdev/raid: add reset handling
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I2732039bd062dba3fdbf1929f92073316fc6462b

Reviewed-on: https://review.gerrithub.io/423407
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-09-11 19:00:29 +00:00
Shuhei Matsumoto
6bc4a314ae bdev/raid: Update the comment of raid_bdev_add_base_bdevs()
Implementation was updated by the previous patch series but the
comment was not. Hence update the comment in this patch.

Change-Id: Ib2097561501984c4ad213652ba716ce195c7bea5
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/424737
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-09-11 19:00:05 +00:00
Shuhei Matsumoto
7f78f68ec8 bdev/raid: Use helper function to get config in destroy_raid_bdev RPC
Use helper function raid_bdev_config_find_by_name() in destroy_raid_bdev
RPC.

Besides, unify two iterator variables in construct_raid_bdev RPC.
This is too small to add in a separate patch.

Change-Id: If0bbae8993af4e402a82299db378e89245b8966e
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/424150
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-09-11 19:00:05 +00:00
Shuhei Matsumoto
dbc4e5094a bdev/raid: Refactor raid_bdev_config_destroy()
raid_bdev_config_destroy_check_raid_bdev_exists() and
raid_bdev_config_destroy() do almost same operation and can be
unified to raid_bdev_config_destroy().

Comment in spdk_rpc_destroy_raid_bdev() about raid_bdev_config_destroy()
are duplicated with the one on top of the raid_bdev_config_destroy().
Hence remove the former in this patch too.

Change-Id: I4a323bf24d2266e2da7f030c52771013d075eb31
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/424149
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-09-11 19:00:05 +00:00
Shuhei Matsumoto
3f578219be bdev/raid: Extract adding base bdevs from RPC and apply it to parse .INI config
Initialization of bdev modules don't have fixed ordering.
Hence both cases should succeed to create configured raid bdev
for .INI config file.

1. create raid bdev and then create base bdevs of it.
2. before creating raid bdev, create base bdevs of it.

To do this, factor out adding base bdevs to raid bdev
to a helper function raid_bdev_add_base_devices() first
and then apply it to construct_raid_bdev RPC and parse .INI
config file.

Change-Id: I4389fd4e7bd41296dfa9210bbe8b60348ee5bc9d
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/423769
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-09-11 19:00:05 +00:00
Shuhei Matsumoto
a3004632e2 bdev/raid: Change construct_raid_bdev RPC to be consistent to other bdev modules
Change the behavior of construct_raid_bdev RPC to be consistent with
other bdev modules.

Create a config of raid bdev first. Then create a raid bdev based
on the config.

If both succeed, the config and the raid bdev are not removed even if
any failure occur later in construct_raid_bdev RPC. Otherwise, both
are removed and return failure.

During iteration of adding base bdevs in construct_raid_bdev RPC,
- skip any nonexistent bdev and move to the next base bdev.
- if adding any base bdev fails, move to the next bdev.
- if adding base bdevs don't fail but any base bdev doesn't exist,
  the raid bdev is in the configuring state and return success.
- if adding base bdev fails, the raid bdev is in the configuring state
  and return failure.
- if all adding base bdevs succeed, configure the raid bdev. If configuring
  the raid bdev fails, move the raid bdev to the offline state and return
  failure. If configuring the raid bdev succeed, return success.

check_and_remove_raid_bdev() becomes unused in raid_bdev_rpc.c but
is still necessary in UT. Hence move this function to UT.

In UT, finding a raid bdev config by name becomes necessary. Hence
factor out the iteration to a function and use the function in UT.

Change-Id: Ifa36967bdc987d97030e3a4e36684cb37b329d4e
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/423622
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-09-11 19:00:05 +00:00
Shuhei Matsumoto
50b51bc831 bdev/raid: Create raid bdev before starting to add base bdevs to it
When construct_raid_bdev RPC is callled, even if all adding base bdevs
to it fail, a raid bdev with no base bdev should exist and be in
the configuring state.

Extract raid_bdev_create() from raid_bdev_add_base_bdev() and put it
before starting iteration of raid_bdev_add_base_bdev().

This change cam be applied to .INI config file too.

Change-Id: Ia71aca0bbdb33049fe5bd9b8fd8163c99c032401
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/424148
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-09-11 19:00:05 +00:00
Ben Walker
c94020001a thread: Add a name parameter to spdk_register_io_device
This is a string name used for debugging only.

Change-Id: I9827f0e6c83be7bc13951c7b5f0951ce6c2a1ece
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/424127
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2018-09-05 16:00:54 +00:00
Jim Harris
526fa366d4 bdev/raid: remove unneeded buf field
buf is no longer needed, now that RAID I/O will never
span a strip boundary.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Icc03b985f540797597c238005bf9883f6f8ad010

Reviewed-on: https://review.gerrithub.io/423406
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-08-31 23:21:19 +00:00
Jim Harris
ca8529ff67 bdev/raid: fix up some whitespace
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ib47f1b360b7a44b82bbbd8cd51fd6740ba47b25d

Reviewed-on: https://review.gerrithub.io/423405
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-08-31 19:18:02 +00:00
Jim Harris
cd6b3a892d bdev/raid: remove raid_bdev_io_terminate
This has been reduced to just a call to
spdk_bdev_io_complete(), so it is no longer needed.

While here, call spdk_bdev_io_complete() directly
in the strip-crossing error case as well.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia949e3fd55b52e5c873bd591e541ecf6c0c086b1

Reviewed-on: https://review.gerrithub.io/423327
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-08-31 19:18:02 +00:00
Jim Harris
29f0c4c76d bdev/raid: remove split counting
Now that I/O never span a strip boundary, we don't
need to count splits.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iea5df5ca055fe4b338fb5cb0828a45502c239458

Reviewed-on: https://review.gerrithub.io/423325
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-08-31 19:18:02 +00:00
Jim Harris
2e6aac525c bdev/raid: use split_on_optimal_io_boundary
Set the bdev->optimal_io_boundary to the strip size, and
set split_on_optimal_io_boundary = true.  This will ensure
that all I/O submitted to the raid module do not cross
a strip boundary, meaning it does not need to be split
across multiple member disks.

This is a step towards removing the iovcnt == 1
limitation.  Further improvements and simplifications
will be made in future patches before removing this
restriction.

Unit tests need to be adjusted here to not span
boundaries either.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I08943805def673288f552a1b7662a4fbe16f25eb

Reviewed-on: https://review.gerrithub.io/423323
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-08-31 17:53:42 +00:00
Shuhei Matsumoto
1ac058ca08 bdev/raid: Set RAID bdev's name at its creation to prevent unnamed device
Next patch will keep RAID bdev without removal when adding any base
bdev to the RAID bdev fails for some reason for construct_raid_bdev
RPC.

The half-baked RAID bdev will become unnamed and this should be avoided.

Change-Id: I3ad0d58a04a7638b9b286babe0e56e057e7f5d0d
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/423621
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
2018-08-30 16:13:35 +00:00
Shuhei Matsumoto
12881ad9bc bdev/raid: Remove duplicated and not enough state check in RPC
When check_and_remove_raid_bdev(raid_cfg) is called, raid_bdev
must be in configuring state. However, offline state will be
probable as well. Besides similar and more comprehensive state
check is done in raid_bdev_cleanup(). Hence remove this check.

Change-Id: I8526da51828f18a8393afbd3d81c0a52f2d33261
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/423620
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
2018-08-30 16:13:35 +00:00
Shuhei Matsumoto
a295285bf5 bdev/raid: Use descriptive error message for failure in JSON-RPC
Change-Id: I238c2ba43c77f47851aa9d28818d42e8d865f2d4
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/423619
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
2018-08-30 16:13:35 +00:00
Shuhei Matsumoto
0a46f5c2aa bdev/raid: Extract check claim operation from add base bdev operation
When a raid bdev is constructed by JSON-RPC construct_raid_bdev,
information about config and slot can be passed to
raid_bdev_add_base_device() and raid_bdev_can_claim() doesn't have
to be called.

Hence extract raid_bdev_can_claim_bdev() from raid_bdev_add_base_device()
and put it to raid_bdev_examine().

Change-Id: I92e02bf3661cb97b691246f32198ba946810d96c
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/423618
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
2018-08-30 16:13:35 +00:00
Shuhei Matsumoto
3333ceb6af bdev/raid: Leave checking bdev duplication with spdk_bdev_register()
When the name of raid bdev is already used by any existing bdev,
spdk_bdev_register() will fail. Hence checking if bdev is duplicated
can be left with spdk_bdev_register().

Change-Id: I22f0c75b0e87c5bd71ece383d146ec61cfaf2627
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/423617
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
2018-08-30 16:13:35 +00:00
Shuhei Matsumoto
432f8d9160 bdev/raid: Fix uncorrect cleanup call in raid_bdev_alloc_base_bdev_resource()
When raid_bdev_alloc_base_bdev_resource() is called through raid_bdev_examine(),
if raid_bdev_alloc_base_bdev_resource() fails, raid_bdev_cleanup() is called
without freeing base bdev resource.

There is no way to free base bdev resource in this case.

Hence remove cleanup call.

Change-Id: I93494502bfe653293825e11872de5883702e495a
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/423616
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
2018-08-30 16:13:35 +00:00
Shuhei Matsumoto
2c608684ff bdev/raid: Use descriptive error code for failure of config operation
Change-Id: I2c34e666fbdcfe5640a87398601f0b819c78a36f
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/423615
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
2018-08-30 16:13:35 +00:00
Shuhei Matsumoto
636b9d597c bdev/raid: Simplify variable name in struct raid_base_bdev_config
raid_base_bdev_config is suffciently descriptive as name and so
"name" can be used as the name of the base bdev.

Other structs have used "name" as the name of bdev.

Change-Id: I090ef541a84fd14d9ec3bfebbdc96ae649709551
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/423614
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
2018-08-30 16:13:35 +00:00
Jim Harris
d38b3d28a8 bdev/raid: remove raid_bdev_send_passthru
This function was meant to handle case when a RAID
volume only had one member disk.  This is not a
common case, so just go through the
raid_bdev_submit_children() path in this case.  This
will simplify some upcoming patches to use
split_on_optimal_io_boundary to enable vectored
I/O.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ic7c7f7987d54ffd836deabb98530f7c339094809

Reviewed-on: https://review.gerrithub.io/423322
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-08-29 16:42:53 +00:00
Chen Wang
6fa48bbf62 lib: fix typos in the lib directory
Change-Id: Idcb60b79d2902bb316facc6f60e0a81e5cf847ed
Signed-off-by: Chen Wang <chenx.wang@intel.com>
Reviewed-on: https://review.gerrithub.io/423372
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2018-08-24 17:15:12 +00:00
Shuhei Matsumoto
6058327b10 bdev/raid: Use more compact name for TAILQ_ENTRY of raid_bdev
According to the purpose of the lists, state_link and global_link
will be enough to understand the purpose well.

Besides, in raid_bdev_remove_base_bdev(), if any entry is not removed
during iteration, TAILQ_FOREACH_SAFE() is not necessary. Hence
change TAILQ_FOREACH_SAFE to TAILQ_FOREACH for this case.

Change-Id: I3022c58faf96721df9241e07dbb5a06d7de89e70
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/423056
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-08-23 16:35:31 +00:00
Shuhei Matsumoto
b39b6024b5 bdev/raid: Refactor helper function check_and_remove_raid_bdev()
Other helper functions raid_bdev_free_base_bdev_resource() and
raid_bdev_cleanup() can be used in check_and_remove_raid_bdev().

Change-Id: I24ce02371f5bb29c3b6111da4475a9ad08e65c21
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/422794
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-08-23 16:35:31 +00:00
Shuhei Matsumoto
485c4b1346 bdev/raid: Factor out RAID parameter check of JSON RPC and config file
RAID parameter check operation of JSON RPC and config file are
duplicated now. This refactoring is one of small preparation to
extend RAID bdev to other RAID levels.

Change-Id: I88527bc9bd0b3a3392aba7d0008a53d518027bfa
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/422797
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-08-23 16:35:31 +00:00
Shuhei Matsumoto
88a1643dcc bdev/raid: Set IO channel to raid_bdev_io at the start of IO submission
IO channel of the RAID bdev has not been changed during IO submission.
Hence it can be set to raid_bdev_io at the start of IO submission.

This will simplify the logic and improve maintainability.

Change-Id: I7d2f35d877be5ea0731e9b635133c1106f294a57
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/422790
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2018-08-23 16:35:31 +00:00
Shuhei Matsumoto
87e849f88b bdev/raid: Use raid_io as a pointer to raid_bdev_io throughout
to hold a pointer to the struct raid_bdev_io, raid_bdev_io had
been used throughout. Using struct name as is may be error prone.
raid_io may be sufficiently descriptive and fit other bdev modules.

Change-Id: I2c19359b75e89cc593371d8bee46203494f57841
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/422924
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
2018-08-23 16:35:31 +00:00
Shuhei Matsumoto
a4b975244d bdev/raid: Simplify variable name in struct raid_bdev
struct raid_bdev has a pointer raid_bdev_config to its configuration,
but raid_bdev is duplicated between raid_bdev and raid_bdev_config
and just config may be enough as a name.

Change-Id: I77f6a69b913cd540c22f05803c486a4caf103f24
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/422923
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
2018-08-23 16:35:31 +00:00
Shuhei Matsumoto
a74212733b bdev/raid: Use raid_cfg as a pointer to raid_bdev_config throughout
In bdev_raid.c and bdev_raid_rpc.c, to hold a pointer to
raid_bdev_config, some have used raid_cfg and other have used
raid_bdev_config.

raid_bdev_config is the name of the struct and using the name of
the struct as a pointer to it may cause any confusion.

Change-Id: Ic87ff04d58ea46c30081aaae8d9cda5a53135be9
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/422922
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
2018-08-23 16:35:31 +00:00
Shuhei Matsumoto
ab9661c990 bdev/raid: Simplify variable name in struct raid_bdev_io_channel
base_bdevs_io_channel is good but base_channel may be enough and
fit other bdev modules.

Change-Id: I67a1d224f1ef4ca1fc048b4325333f2552a37150
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/422921
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
2018-08-23 16:35:31 +00:00
Shuhei Matsumoto
bc5906b14a bdev/raid: Use raid_ch as a pointer to raid_bdev_io_channel throughout
In bdev_raid.c, to hold a pointer to raid_bdev_io_channel, some
have used ch and other have used raid_bdev_io_channel.

Using raid_ch as that purpose throughout will be consistent and
differentiation to pointers to spdk_io_channel, and will improve
readability.

Change-Id: Ib10729f9fa3ebbfdb7b7cc013386b9b5cc0e93cb
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/422920
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
2018-08-23 16:35:31 +00:00
Shuhei Matsumoto
c7756fe71d bdev/raid: Simplify variable names in struct raid_base_bdev_info
raid_base_bdev_info is sufficiently descriptive as name and so
names of member variables in raid_base_bdev_info can be simplified.

Change-Id: I759a758ec0f3ac21de767ad379a902f1b04cc66d
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/422919
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
2018-08-23 16:35:31 +00:00
Jim Harris
01035cd49f bdev: cleanup registered bdevs in reverse order
This ensures (for example) that a RAID volume is
unregistered before its member disks.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I7a7c16acc351f2d5d4218b64b370e2c77c6e2b5e
Reviewed-on: https://review.gerrithub.io/420812
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-08-17 00:11:03 +00:00