lkml.org 
[lkml]   [2022]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.4 410/411] md/raid0: Ignore RAID0 layout if the second zone has only one device
    Date
    From: Pascal Hambourg <pascal@plouf.fr.eu.org>

    commit ea23994edc4169bd90d7a9b5908c6ccefd82fa40 upstream.

    The RAID0 layout is irrelevant if all members have the same size so the
    array has only one zone. It is *also* irrelevant if the array has two
    zones and the second zone has only one device, for example if the array
    has two members of different sizes.

    So in that case it makes sense to allow assembly even when the layout is
    undefined, like what is done when the array has only one zone.

    Reviewed-by: NeilBrown <neilb@suse.de>
    Signed-off-by: Pascal Hambourg <pascal@plouf.fr.eu.org>
    Signed-off-by: Song Liu <song@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    drivers/md/raid0.c | 31 ++++++++++++++++---------------
    1 file changed, 16 insertions(+), 15 deletions(-)

    --- a/drivers/md/raid0.c
    +++ b/drivers/md/raid0.c
    @@ -143,21 +143,6 @@ static int create_strip_zones(struct mdd
    pr_debug("md/raid0:%s: FINAL %d zones\n",
    mdname(mddev), conf->nr_strip_zones);

    - if (conf->nr_strip_zones == 1) {
    - conf->layout = RAID0_ORIG_LAYOUT;
    - } else if (mddev->layout == RAID0_ORIG_LAYOUT ||
    - mddev->layout == RAID0_ALT_MULTIZONE_LAYOUT) {
    - conf->layout = mddev->layout;
    - } else if (default_layout == RAID0_ORIG_LAYOUT ||
    - default_layout == RAID0_ALT_MULTIZONE_LAYOUT) {
    - conf->layout = default_layout;
    - } else {
    - pr_err("md/raid0:%s: cannot assemble multi-zone RAID0 with default_layout setting\n",
    - mdname(mddev));
    - pr_err("md/raid0: please set raid0.default_layout to 1 or 2\n");
    - err = -ENOTSUPP;
    - goto abort;
    - }
    /*
    * now since we have the hard sector sizes, we can make sure
    * chunk size is a multiple of that sector size
    @@ -288,6 +273,22 @@ static int create_strip_zones(struct mdd
    (unsigned long long)smallest->sectors);
    }

    + if (conf->nr_strip_zones == 1 || conf->strip_zone[1].nb_dev == 1) {
    + conf->layout = RAID0_ORIG_LAYOUT;
    + } else if (mddev->layout == RAID0_ORIG_LAYOUT ||
    + mddev->layout == RAID0_ALT_MULTIZONE_LAYOUT) {
    + conf->layout = mddev->layout;
    + } else if (default_layout == RAID0_ORIG_LAYOUT ||
    + default_layout == RAID0_ALT_MULTIZONE_LAYOUT) {
    + conf->layout = default_layout;
    + } else {
    + pr_err("md/raid0:%s: cannot assemble multi-zone RAID0 with default_layout setting\n",
    + mdname(mddev));
    + pr_err("md/raid0: please set raid0.default_layout to 1 or 2\n");
    + err = -EOPNOTSUPP;
    + goto abort;
    + }
    +
    pr_debug("md/raid0:%s: done.\n", mdname(mddev));
    *private_conf = conf;


    \
     
     \ /
      Last update: 2022-06-13 13:58    [W:4.342 / U:0.120 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site