From: Jian Yu Date: Tue, 20 Feb 2018 22:35:52 +0000 (-0800) Subject: LU-10561 flr: remove "--parent" option from lfs mirror command X-Git-Tag: 2.10.59~79 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=905d37787638b94d02e58798f47677230253274a LU-10561 flr: remove "--parent" option from lfs mirror command "--parent" option for "lfs mirror create/extend" command was originally designed to use default stripe options inherited from parent directory. However, if parent directory has composite layout, there will be inconsistency to choose the stripe options from which component to inherit. And if there is any other option specified, it's also inconsistent to inherit the layout of parent directory. So, this patch removes "--parent" option to eliminate ambiguity. For "--pool|-p" option, this patch supports specifying "none" to clear the pool name and inherit from parent directory. Unspecified stripe count, stripe size and OST pool name will inherit from previous component. If there is no previous component, then unspecified stripe count and stripe size attributes will inherit from filesystem-wide default values. Unspecified or cleared OST pool name will inherit from parent directory. Change-Id: Ib0ec3cbc65fb307c42881f35dc676090ab8319ff Signed-off-by: Jian Yu Reviewed-on: https://review.whamcloud.com/31298 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Jinshan Xiong Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin --- diff --git a/lustre/doc/lfs-mirror-create.1 b/lustre/doc/lfs-mirror-create.1 index 2943851..28092fa 100644 --- a/lustre/doc/lfs-mirror-create.1 +++ b/lustre/doc/lfs-mirror-create.1 @@ -4,7 +4,7 @@ lfs mirror create \- create a mirrored file or directory .SH SYNOPSIS .B lfs mirror create <\fB\-\-mirror\-count\fR|\fB\-N\fR[\fImirror_count\fR]> -[\fIsetstripe_options\fR|\fB--parent\fR|[\fB--flags\fR<=\fIflags\fR>]] ... +[\fIsetstripe_options\fR|[\fB--flags\fR<=\fIflags\fR>]] ... .RI < filename | directory > .SH DESCRIPTION This command creates a mirrored file or directory specified by the path name @@ -21,10 +21,9 @@ be a plain layout with specific striping pattern or a composite layout like Progressive File Layout (PFL) (see \fBlfs-setstripe\fR(1)). If \fIsetstripe_options\fR are not specified, then the stripe options inherited from the previous component will be used. If -there is no previous component or \fB\-\-parent\fR option is specified, then the -default stripe options inherited from parent directory will be used. For stripe -options, only \fIstripe_count\fR, \fIstripe_size\fR and OST \fIpool_name\fR can -be inherited. +there is no previous component, then the \fIstripe_count\fR and +\fIstripe_size\fR options inherited from filesystem-wide default values will be +used, and OST \fIpool_name\fR inherited from parent directory will be used. .br If no option is specified, then the command will return an error. .SH OPTIONS @@ -41,10 +40,6 @@ The layout of one mirror. The options are the same as those for If \fIsetstripe_options\fR are not specified, then the stripe options inherited from the previous component will be used. .TP -.B \-\-parent -This option indicates that the default stripe options inherited from parent -directory will be used. -.TP .B --flags<=\fIflags\fR> Where available \fIflags\fR are as follows: .RS @@ -69,7 +64,9 @@ set to individual components at mirror creation time. .TP .B lfs mirror create -N2 /mnt/lustre/file1 Create a mirrored file with 2 mirrors. Each mirror has the same default striping -pattern inherited from parent directory or filesystem-wide default. +pattern with \fIstripe_count\fR and \fIstripe_size\fR inherited from +filesystem-wide default values, and OST \fIpool_name\fR inherited from +parent directory. .TP .B lfs mirror create -N2 -E 1M -E eof -c -1 /mnt/lustre/dir1 Create a mirrored directory with 2 PFL mirrors. Each mirror has the same @@ -80,13 +77,16 @@ specified PFL layout. .in Create a mirrored file with 3 PFL mirrors. Each mirror has the same specified PFL layout. -.TP -.B lfs mirror create -N -c 1 -S 4M -N -c 2 -o 2,3 -N --parent /mnt/lustre/file1 +.LP +.B lfs mirror create -N -c 1 -S 4M -N -c 2 -o 2,3 -p flash +.B -N -p none /mnt/lustre/file1 +.in Create a mirrored file with 3 plain layout mirrors. The first mirror has a single stripe and 4MB stripe size. The second mirror has two stripes and locates -on OSTs with indices 2 and 3. It also has 4MB stripe size inherited from the -first mirror. The third mirror has default striping pattern inherited from -parent directory. +on OSTs with indices 2 and 3 allocated from the \fBflash\fR OST pool. +It also has 4MB stripe size inherited from the first mirror. +The third mirror has two stripes and 4MB stripe size inherited from the previous +mirror, and also has inherited OST \fIpool_name\fR from parent directory. .LP .B lfs mirror create -N2 -E 4M -c 2 --pool flash --flags prefer -E eof -c 4 .B -N3 -E 16M -c 4 -S 16M --pool archive --comp-flags=prefer -E eof -c -1 diff --git a/lustre/doc/lfs-mirror-extend.1 b/lustre/doc/lfs-mirror-extend.1 index 22c06a5..f97ca66 100644 --- a/lustre/doc/lfs-mirror-extend.1 +++ b/lustre/doc/lfs-mirror-extend.1 @@ -5,7 +5,7 @@ lfs mirror extend \- add mirror(s) to an existing file .B lfs mirror extend [\fB\-\-no\-verify\fR] <\fB\-\-mirror\-count\fR|\fB\-N\fR[\fImirror_count\fR]> -[\fIsetstripe_options\fR|\fB\-\-parent\fR|\fB\-f\fR <\fIvictim_file\fR>] ... +[\fIsetstripe_options\fR|\fB\-f\fR <\fIvictim_file\fR>] ... <\fIfilename\fR> .SH DESCRIPTION This command adds mirror(s) to an existing file specified by the path name @@ -25,17 +25,14 @@ The \fIsetstripe_options\fR specify the specific layout for the mirror. It can be a plain layout with specific striping pattern or a composite layout like Progressive File Layout (PFL) (see \fBlfs-setstripe\fR(1)). If \fIsetstripe_options\fR are not specified, -then the stripe options inherited from the previous component will be used. If -\fB\-\-parent\fR option is specified, then the default stripe options inherited -from parent directory will be used. For stripe options, only \fIstripe_count\fR, -\fIstripe_size\fR and OST \fIpool_name\fR can be inherited. +then the stripe options inherited from the previous component will be used. If \fIvictim_file\fR exists, then the command will split the layout from that file and use it as a mirror added to the mirrored file. After the command is finished, the victim file will be removed. -The \fIsetstripe_options\fR and \fB\-\-parent\fR option cannot be specified with +The \fIsetstripe_options\fR cannot be specified with \fB\-f\fR <\fIvictim_file\fR> option in one command line. .br -If \fIvictim_file\R is specified, the utility will verify that the file contents +If \fIvictim_file\fR is specified, the utility will verify that the file contents from \fIvictim_file\fR are the same as \fIfilename\fR. Otherwise the command will return failure. However, option \fB\-\-no\-verify\fR can be used to override this verification. The option can save siginificant time on file @@ -58,15 +55,10 @@ If \fIsetstripe_options\fR are not specified, then the stripe options inherited from the previous component will be used. This option cannot be specified with \fB\-f\fR <\fIvictim_file\fR> option. .TP -.BR \-\-parent -This option indicates that the default stripe options inherited from parent -directory will be used. -It cannot be specified with \fB\-f\fR <\fIvictim_file\fR> option. -.TP .BR \-f\fR\ <\fIvictim_file\fR> The layout of \fIvictim_file\fR will be split and used as a mirror added to the -mirrored file. This option cannot be specified with \fIsetstripe_options\fR or -\fB\-\-parent\fR option. +mirrored file. This option cannot be specified with \fIsetstripe_options\fR +option. .TP .BR \-\-no\-verify This option indicates not to verify the mirror(s) from victim file(s) in case @@ -76,20 +68,25 @@ the victim file(s) contains the same data as the original mirrored file. .B lfs mirror extend -N2 /mnt/lustre/file1 Add 2 mirrors to /mnt/lustre/file1. If file1 is a non-mirrored file, then the command will convert it to a mirrored file first and then add mirrors. Each -mirror has the same striping pattern inherited from parent directory. +mirror has the same default striping pattern with \fIstripe_count\fR and +\fIstripe_size\fR inherited from filesystem-wide default values, and +OST \fIpool_name\fR inherited from parent directory. .LP .B lfs mirror extend -N3 -E 1M -c 1 -E 32M -c 4 -S 16M -E eof -c -1 .B /mnt/lustre/file1 .in Add 3 PFL mirrors to /mnt/lustre/file1. Each mirror has the same specified PFL layout. -.TP -.B lfs mirror extend -N -c 1 -S 4M -N -c 2 -o 2,3 -N --parent /mnt/lustre/file1 +.LP +.B lfs mirror extend -N -c 1 -S 4M -N -c 2 -o 2,3 -p flash +.B -N -p none /mnt/lustre/file1 +.in Add 3 plain layout mirrors to /mnt/lustre/file1. The first mirror has a single stripe and 4MB stripe size. The second mirror has two stripes and locates on -OSTs with indices 2 and 3. It also has 4MB stripe size inherited from the first -mirror. The third mirror has default striping pattern inherited from parent -directory. +OSTs with indices 2 and 3 allocated from the \fBflash\fR OST pool. +It also has 4MB stripe size inherited from the first mirror. +The third mirror has two stripes and 4MB stripe size inherited from the previous +mirror, and also has inherited OST \fIpool_name\fR from parent directory. .LP .B lfs mirror extend -N2 -E 4M -c 2 --pool flash -E eof -c 4 -N3 -E 16M -c 4 .B -S 16M --pool archive -E eof -c -1 /mnt/lustre/file1 diff --git a/lustre/doc/lfs-setstripe.1 b/lustre/doc/lfs-setstripe.1 index ada5407..98abce4 100644 --- a/lustre/doc/lfs-setstripe.1 +++ b/lustre/doc/lfs-setstripe.1 @@ -166,6 +166,9 @@ and will be used as well; the .I start_ost_index must be part of the pool or an error will be returned. +If <\fIpool_name\fR> is +.BR none +, then the OST pool name will be cleared and inherit from parent directory. .TP .B -L, --layout <\fIlayout type\fB>\fR The type of stripe layout, can be diff --git a/lustre/tests/sanity-flr.sh b/lustre/tests/sanity-flr.sh index eb99d6d..3d87ba5 100644 --- a/lustre/tests/sanity-flr.sh +++ b/lustre/tests/sanity-flr.sh @@ -205,18 +205,56 @@ verify_comp_attr_with_parent() { } # -# Verify component attributes with parent directory for a given file +# Verify component attribute with filesystem-wide default value for a given file +# and component ID. +# +verify_comp_attr_with_default() { + local attr=$1 + local tf=$2 + local comp_id=$3 + local tf_cmd="$LFS getstripe -I$comp_id" + local opt + local expected + local value + + case $attr in + stripe-size) + opt="-S" + expected=$($LCTL get_param -n \ + lov.$FSNAME-clilov-*.stripesize) + ;; + stripe-count) + opt="-c" + expected=$($LCTL get_param -n \ + lov.$FSNAME-clilov-*.stripecount) + [[ $expected = -1 ]] && expected=$OSTCOUNT + ;; + *) error "invalid attribute $attr";; + esac + + value=$($tf_cmd $opt $tf) + [[ $value = -1 ]] && value=$OSTCOUNT + + [[ $value = $expected ]] || { + $tf_cmd -v $tf + error "verify $attr failed with default value on $tf:" \ + "$value != $expected" + } +} + +# +# Verify unspecified component attributes for a given file # and component ID. # # This will only verify the inherited attributes: # stripe size, stripe count and OST pool name # -verify_comp_attrs_with_parent() { +verify_comp_attrs() { local tf=$1 local comp_id=$2 - verify_comp_attr_with_parent stripe-size $tf $comp_id - verify_comp_attr_with_parent stripe-count $tf $comp_id + verify_comp_attr_with_default stripe-size $tf $comp_id + verify_comp_attr_with_default stripe-count $tf $comp_id verify_comp_attr_with_parent pool $tf $comp_id } @@ -238,7 +276,7 @@ test_0a() { $mirror_cmd -N $tf || error "create mirrored file $tf failed" verify_mirror_count $tf 1 id=$($LFS getstripe -I $tf) - verify_comp_attrs_with_parent $tf $id + verify_comp_attrs $tf $id verify_comp_extent $tf $id 0 EOF $mirror_cmd -N0 $tf-1 &> /dev/null && error "invalid mirror count 0" @@ -250,7 +288,7 @@ test_0a() { verify_mirror_count $tf-1 $mirror_count ids=($($LFS getstripe $tf-1 | awk '/lcme_id/{print $2}' | tr '\n' ' ')) for ((i = 0; i < $mirror_count; i++)); do - verify_comp_attrs_with_parent $tf-1 ${ids[$i]} + verify_comp_attrs $tf-1 ${ids[$i]} verify_comp_extent $tf-1 ${ids[$i]} 0 EOF done @@ -259,7 +297,7 @@ test_0a() { verify_mirror_count $tf-2 10 ids=($($LFS getstripe $tf-2 | awk '/lcme_id/{print $2}' | tr '\n' ' ')) for ((i = 0; i < 10; i++)); do - verify_comp_attrs_with_parent $tf-2 ${ids[$i]} + verify_comp_attrs $tf-2 ${ids[$i]} verify_comp_extent $tf-2 ${ids[$i]} 0 EOF done } @@ -274,42 +312,61 @@ test_0b() { local ids local i + # create a new OST pool + local pool_name=$TESTNAME + create_pool $FSNAME.$pool_name || + error "create OST pool $pool_name failed" + + # add OSTs into the pool + pool_add_targets $pool_name 0 $((OSTCOUNT - 1)) || + error "add OSTs into pool $pool_name failed" + # create parent directory mkdir $td || error "mkdir $td failed" + $LFS setstripe -S 8M -c -1 -p $pool_name $td || + error "$LFS setstripe $td failed" # create a mirrored file with plain layout mirrors - $mirror_cmd -N -S 4M -c 2 -p flash -i 2 -o 2,3 \ - -N -S 16M -N -c -1 -N -p archive -N --parent $tf || + $mirror_cmd -N -N -S 4M -c 2 -p flash -i 2 -o 2,3 \ + -N -S 16M -N -c -1 -N -p archive -N -p none $tf || error "create mirrored file $tf failed" - verify_mirror_count $tf 5 + verify_mirror_count $tf 6 ids=($($LFS getstripe $tf | awk '/lcme_id/{print $2}' | tr '\n' ' ')) - for ((i = 0; i < 5; i++)); do + for ((i = 0; i < 6; i++)); do verify_comp_extent $tf ${ids[$i]} 0 EOF done # verify component ${ids[0]} - verify_comp_attr stripe-size $tf ${ids[0]} 4194304 - verify_comp_attr stripe-count $tf ${ids[0]} 2 - verify_comp_attr stripe-index $tf ${ids[0]} 2 - verify_comp_attr pool $tf ${ids[0]} flash + verify_comp_attrs $tf ${ids[0]} # verify component ${ids[1]} - verify_comp_attr stripe-size $tf ${ids[1]} 16777216 + verify_comp_attr stripe-size $tf ${ids[1]} 4194304 verify_comp_attr stripe-count $tf ${ids[1]} 2 + verify_comp_attr stripe-index $tf ${ids[1]} 2 verify_comp_attr pool $tf ${ids[1]} flash # verify component ${ids[2]} verify_comp_attr stripe-size $tf ${ids[2]} 16777216 - verify_comp_attr stripe-count $tf ${ids[2]} $OSTCOUNT + verify_comp_attr stripe-count $tf ${ids[2]} 2 verify_comp_attr pool $tf ${ids[2]} flash # verify component ${ids[3]} verify_comp_attr stripe-size $tf ${ids[3]} 16777216 verify_comp_attr stripe-count $tf ${ids[3]} $OSTCOUNT - verify_comp_attr pool $tf ${ids[3]} archive + verify_comp_attr pool $tf ${ids[3]} flash # verify component ${ids[4]} - verify_comp_attrs_with_parent $tf ${ids[4]} + verify_comp_attr stripe-size $tf ${ids[4]} 16777216 + verify_comp_attr stripe-count $tf ${ids[4]} $OSTCOUNT + verify_comp_attr pool $tf ${ids[4]} archive + + # verify component ${ids[5]} + verify_comp_attr stripe-size $tf ${ids[5]} 16777216 + verify_comp_attr stripe-count $tf ${ids[5]} $OSTCOUNT + verify_comp_attr_with_parent pool $tf ${ids[5]} + + # destroy OST pool + destroy_test_pools } run_test 0b "lfs mirror create plain layout mirrors" @@ -322,12 +379,23 @@ test_0c() { local ids local i + # create a new OST pool + local pool_name=$TESTNAME + create_pool $FSNAME.$pool_name || + error "create OST pool $pool_name failed" + + # add OSTs into the pool + pool_add_targets $pool_name 0 $((OSTCOUNT - 1)) || + error "add OSTs into pool $pool_name failed" + # create parent directory mkdir $td || error "mkdir $td failed" + $LFS setstripe -E 32M -S 8M -c -1 -p $pool_name -E eof -S 16M $td || + error "$LFS setstripe $td failed" # create a mirrored file with composite layout mirrors $mirror_cmd -N2 -E 4M -c 2 -p flash -i 1 -o 1,3 -E eof -S 4M \ - -N --parent \ + -N -c 4 -p none \ -N3 -E 512M -S 16M -p archive -E -1 -i -1 -c -1 $tf || error "create mirrored file $tf failed" verify_mirror_count $tf 6 @@ -335,7 +403,7 @@ test_0c() { # verify components ${ids[0]} and ${ids[2]} for i in 0 2; do - verify_comp_attr_with_parent stripe-size $tf ${ids[$i]} + verify_comp_attr_with_default stripe-size $tf ${ids[$i]} verify_comp_attr stripe-count $tf ${ids[$i]} 2 verify_comp_attr stripe-index $tf ${ids[$i]} 1 verify_comp_attr pool $tf ${ids[$i]} flash @@ -351,13 +419,15 @@ test_0c() { done # verify component ${ids[4]} - verify_comp_attrs_with_parent $tf ${ids[4]} + verify_comp_attr stripe-size $tf ${ids[4]} 4194304 + verify_comp_attr stripe-count $tf ${ids[4]} 4 + verify_comp_attr_with_parent pool $tf ${ids[4]} verify_comp_extent $tf ${ids[4]} 0 EOF # verify components ${ids[5]}, ${ids[7]} and ${ids[9]} for i in 5 7 9; do verify_comp_attr stripe-size $tf ${ids[$i]} 16777216 - verify_comp_attr_with_parent stripe-count $tf ${ids[$i]} + verify_comp_attr stripe-count $tf ${ids[$i]} 4 verify_comp_attr pool $tf ${ids[$i]} archive verify_comp_extent $tf ${ids[$i]} 0 536870912 done @@ -369,6 +439,9 @@ test_0c() { verify_comp_attr pool $tf ${ids[$i]} archive verify_comp_extent $tf ${ids[$i]} 536870912 EOF done + + # destroy OST pool + destroy_test_pools } run_test 0c "lfs mirror create composite layout mirrors" @@ -392,7 +465,7 @@ test_0d() { verify_mirror_count $tf 2 ids=($($LFS getstripe $tf | awk '/lcme_id/{print $2}' | tr '\n' ' ')) for ((i = 0; i < 2; i++)); do - verify_comp_attrs_with_parent $tf ${ids[$i]} + verify_comp_attrs $tf ${ids[$i]} verify_comp_extent $tf ${ids[$i]} 0 EOF done @@ -405,15 +478,12 @@ test_0d() { $mirror_cmd -N -S 4M -N -f $tf-2 $tf-1 &> /dev/null && error "setstripe options should not be specified with -f option" - $mirror_cmd -N -f $tf-2 -N --parent $tf-1 &> /dev/null && - error "--parent option should not be specified with -f option" - $mirror_cmd -N$((mirror_count - 1)) $tf-1 || error "extend mirrored file $tf-1 failed" verify_mirror_count $tf-1 $mirror_count ids=($($LFS getstripe $tf-1 | awk '/lcme_id/{print $2}' | tr '\n' ' ')) for ((i = 0; i < $mirror_count; i++)); do - verify_comp_attrs_with_parent $tf-1 ${ids[$i]} + verify_comp_attrs $tf-1 ${ids[$i]} verify_comp_extent $tf-1 ${ids[$i]} 0 EOF done @@ -440,7 +510,7 @@ test_0e() { # extend the mirrored file with plain layout mirrors $mirror_cmd -N -S 4M -c 2 -p flash -i 2 -o 2,3 \ - -N -S 16M -N -c -1 -N -p archive -N --parent $tf || + -N -S 16M -N -c -1 -N -p archive -N -p none $tf || error "extend mirrored file $tf failed" verify_mirror_count $tf 6 ids=($($LFS getstripe $tf | awk '/lcme_id/{print $2}' | tr '\n' ' ')) @@ -476,7 +546,9 @@ test_0e() { verify_comp_attr pool $tf ${ids[4]} archive # verify component ${ids[5]} - verify_comp_attrs_with_parent $tf ${ids[5]} + verify_comp_attr stripe-size $tf ${ids[5]} 16777216 + verify_comp_attr stripe-count $tf ${ids[5]} $OSTCOUNT + verify_comp_attr_with_parent pool $tf ${ids[5]} } run_test 0e "lfs mirror extend plain layout mirrors" @@ -498,7 +570,7 @@ test_0f() { # extend the mirrored file with composite layout mirrors $mirror_cmd -N2 -E 4M -c 2 -p flash -i 1 -o 1,3 -E eof -S 4M \ - -N --parent \ + -N -c -1 -p none \ -N3 -E 512M -S 16M -p archive -E -1 -i -1 -c -1 $tf || error "extend mirrored file $tf failed" verify_mirror_count $tf 7 @@ -506,19 +578,19 @@ test_0f() { # verify component ${ids[0]} verify_comp_attr stripe-size $tf ${ids[0]} 16777216 - verify_comp_attr_with_parent stripe-count $tf ${ids[0]} + verify_comp_attr_with_default stripe-count $tf ${ids[0]} verify_comp_attr pool $tf ${ids[0]} ssd verify_comp_extent $tf ${ids[0]} 0 33554432 # verify component ${ids[1]} verify_comp_attr stripe-size $tf ${ids[1]} 33554432 - verify_comp_attr_with_parent stripe-count $tf ${ids[1]} + verify_comp_attr_with_default stripe-count $tf ${ids[1]} verify_comp_attr pool $tf ${ids[1]} ssd verify_comp_extent $tf ${ids[1]} 33554432 EOF # verify components ${ids[2]} and ${ids[4]} for i in 2 4; do - verify_comp_attr_with_parent stripe-size $tf ${ids[$i]} + verify_comp_attr_with_default stripe-size $tf ${ids[$i]} verify_comp_attr stripe-count $tf ${ids[$i]} 2 verify_comp_attr stripe-index $tf ${ids[$i]} 1 verify_comp_attr pool $tf ${ids[$i]} flash @@ -534,13 +606,15 @@ test_0f() { done # verify component ${ids[6]} - verify_comp_attrs_with_parent $tf ${ids[6]} + verify_comp_attr stripe-size $tf ${ids[6]} 4194304 + verify_comp_attr stripe-count $tf ${ids[6]} $OSTCOUNT + verify_comp_attr_with_parent pool $tf ${ids[6]} verify_comp_extent $tf ${ids[6]} 0 EOF # verify components ${ids[7]}, ${ids[9]} and ${ids[11]} for i in 7 9 11; do verify_comp_attr stripe-size $tf ${ids[$i]} 16777216 - verify_comp_attr_with_parent stripe-count $tf ${ids[$i]} + verify_comp_attr stripe-count $tf ${ids[$i]} $OSTCOUNT verify_comp_attr pool $tf ${ids[$i]} archive verify_comp_extent $tf ${ids[$i]} 0 536870912 done diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 8c01155..bb0f81b 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -193,7 +193,6 @@ static inline int lfs_mirror_split(int argc, char **argv) "\t It can be a plain layout or a composite layout.\n" \ "\t If not specified, the stripe options inherited\n" \ "\t from the previous component will be used.\n" \ - "\tparent: Use default stripe options from parent directory\n" \ "\tflags: set flags to the component of the current mirror.\n" \ "\t Only \"prefer\" flag is supported so far.\n" @@ -208,7 +207,7 @@ static inline int lfs_mirror_split(int argc, char **argv) #define MIRROR_EXTEND_USAGE \ " <--mirror-count|-N[mirror_count]>\n" \ - " [setstripe options|--parent|-f ]\n" \ + " [setstripe options|-f ]\n" \ " [--no-verify]\n" #define SETSTRIPE_USAGE \ @@ -251,13 +250,13 @@ command_t mirror_cmdlist[] = { .pc_help = "Create a mirrored file.\n" "usage: lfs mirror create " "<--mirror-count|-N[mirror_count]> " - "[setstripe options|--parent] ... \n" + "[setstripe options] ... \n" MIRROR_CREATE_HELP }, { .pc_name = "extend", .pc_func = lfs_mirror_extend, .pc_help = "Extend a mirrored file.\n" "usage: lfs mirror extend " "<--mirror-count|-N[mirror_count]> [--no-verify] " - "[setstripe options|--parent|-f ] ... \n" + "[setstripe options|-f ] ... \n" MIRROR_EXTEND_HELP }, { .pc_name = "split", .pc_func = lfs_mirror_split, .pc_help = "Split a mirrored file.\n" @@ -1306,9 +1305,9 @@ static int mirror_create_sanity_check(const char *fname, } if (has_m_file && has_m_layout) { - fprintf(stderr, "error: %s: -f option should not " - "be specified with setstripe options or " - "--parent option\n", progname); + fprintf(stderr, + "error: %s: -f option should not be specified with setstripe options\n", + progname); return -EINVAL; } @@ -2295,7 +2294,6 @@ enum { LFS_COMP_DEL_OPT, LFS_COMP_SET_OPT, LFS_COMP_ADD_OPT, - LFS_COMP_USE_PARENT_OPT, LFS_COMP_NO_VERIFY_OPT, LFS_PROJID_OPT, LFS_MIRROR_FLAGS_OPT, @@ -2362,8 +2360,6 @@ static int lfs_setstripe_internal(int argc, char **argv, { .val = LFS_COMP_SET_OPT, .name = "component-set", .has_arg = no_argument}, - { .val = LFS_COMP_USE_PARENT_OPT, - .name = "parent", .has_arg = no_argument}, { .val = LFS_COMP_NO_VERIFY_OPT, .name = "no-verify", .has_arg = no_argument}, { .val = LFS_MIRROR_FLAGS_OPT, @@ -2458,15 +2454,6 @@ static int lfs_setstripe_internal(int argc, char **argv, case LFS_COMP_SET_OPT: comp_set = 1; break; - case LFS_COMP_USE_PARENT_OPT: - if (!mirror_mode) { - fprintf(stderr, "error: %s: --parent must be " - "specified with --mirror-count|-N " - "option\n", progname); - goto usage_error; - } - setstripe_args_init(&lsa); - break; case LFS_COMP_NO_VERIFY_OPT: mirror_flags |= MF_NO_VERIFY; break; @@ -2732,6 +2719,11 @@ static int lfs_setstripe_internal(int argc, char **argv, if (optarg == NULL) goto usage_error; lsa.lsa_pool_name = optarg; + + if (strlen(lsa.lsa_pool_name) == 0 || + strncmp(lsa.lsa_pool_name, "none", + LOV_MAXPOOLNAME) == 0) + lsa.lsa_pool_name = NULL; break; case 'S': result = llapi_parse_size(optarg, &lsa.lsa_stripe_size, diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index 4e32318..09775d2 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -3934,6 +3934,11 @@ static int extract_fsname_poolname(const char *arg, char *fsname, strncpy(poolname, ptr, LOV_MAXPOOLNAME); poolname[LOV_MAXPOOLNAME] = '\0'; + + if (strncmp(poolname, "none", LOV_MAXPOOLNAME) == 0) { + fprintf(stderr, "poolname cannot be 'none'\n"); + return -EINVAL; + } return 0; err: