.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
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
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
.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
.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
.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
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
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
.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
}
#
-# 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
}
$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"
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
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
}
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"
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
# 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
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
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"
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
$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
# 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' ' '))
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"
# 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
# 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
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
"\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"
#define MIRROR_EXTEND_USAGE \
" <--mirror-count|-N[mirror_count]>\n" \
- " [setstripe options|--parent|-f <victim_file>]\n" \
+ " [setstripe options|-f <victim_file>]\n" \
" [--no-verify]\n"
#define SETSTRIPE_USAGE \
.pc_help = "Create a mirrored file.\n"
"usage: lfs mirror create "
"<--mirror-count|-N[mirror_count]> "
- "[setstripe options|--parent] ... <filename|directory>\n"
+ "[setstripe options] ... <filename|directory>\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 <victim_file>] ... <filename>\n"
+ "[setstripe options|-f <victim_file>] ... <filename>\n"
MIRROR_EXTEND_HELP },
{ .pc_name = "split", .pc_func = lfs_mirror_split,
.pc_help = "Split a mirrored file.\n"
}
if (has_m_file && has_m_layout) {
- fprintf(stderr, "error: %s: -f <victim_file> option should not "
- "be specified with setstripe options or "
- "--parent option\n", progname);
+ fprintf(stderr,
+ "error: %s: -f <victim_file> option should not be specified with setstripe options\n",
+ progname);
return -EINVAL;
}
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,
{ .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,
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;
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,