From 5fee5b700d1e683d165fc0ef0ae88c2a0ab83681 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Thu, 17 Aug 2017 17:33:47 -0600 Subject: [PATCH] LU-7501 utils: clean up lfs argument handling/docs Change "mdt-hash" option in lfs_setstripe() and lfs_setdirstripe to use C99 formatting as used for other options. Add comments for already-used options to lfs_find(), lfs_getstripe(), and lfs_setstripe() to avoid conflicts in the future. A few initializers can fit onto the same line with minor formatting changes, better to be more compact than a slave to exact formatting. Remove options that are obsoleted by LUSTRE_VERSION_CODE after 2.10. Remove over-zealous deprecation of "lfs mkdir -c". Sort options to be in mostly alphabetical order, unless the long option parsing would return a deprecated short option. Add deprecation warnings for short/long options that were deprecated already in commit cdeb2f3a56e8 (http://review.whamcloud.com/22581). Fix up lfs-setdirstripe.1 and lfs-getdirstripe.1 man pages to list preferred option names. Also, lfs-getdirstripe.1 listed some options that never existed, and others that were named incorrectly. Move test scripts over to use preferred command and option names. Signed-off-by: Andreas Dilger Change-Id: I74a59ce372115ae0906d0feb37c539a450bed6bd Reviewed-on: https://review.whamcloud.com/28592 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: James Nunez Reviewed-by: Oleg Drokin --- lustre/doc/lfs-getdirstripe.1 | 56 ++++---- lustre/doc/lfs-setdirstripe.1 | 76 +++++++---- lustre/doc/lfs.1 | 2 +- lustre/tests/conf-sanity.sh | 4 +- lustre/tests/lfsck-performance.sh | 2 +- lustre/tests/sanity-hsm.sh | 4 +- lustre/tests/sanity.sh | 43 +++--- lustre/utils/lfs.c | 266 +++++++++++++++++--------------------- 8 files changed, 219 insertions(+), 234 deletions(-) diff --git a/lustre/doc/lfs-getdirstripe.1 b/lustre/doc/lfs-getdirstripe.1 index b5bcaff..7727020 100644 --- a/lustre/doc/lfs-getdirstripe.1 +++ b/lustre/doc/lfs-getdirstripe.1 @@ -1,48 +1,48 @@ -.TH LFS-GETDIRSTRIPE 1 2014-06-08 "Lustre" "Lustre Utilities" +.TH LFS-GETDIRSTRIPE 1 2017-11-07 "Lustre" "Lustre Utilities" .SH NAME -lfs getdirstripe \- list the striping pattern of a given directory. +lfs getdirstripe \- list the layout pattern of a given directory .SH SYNOPSIS -.B lfs getdirstripe -[\fIOPTION\fR]... \fIDIR\fR... +.BR "lfs getdirstripe" " [" -cDimOrTy "]... " \fIDIR\fR... .SH DESCRIPTION -Get the striping pattern information of directories. This lfs utility is -similar to -.B lfs getstripe -, but is used to get directory striping pattern. -.BP lfs +Get the layout pattern of striped directories. This +.BR lfs (1) +command is similar to +.BR "lfs getstripe" , +but is used for the directory layout. .SH OPTIONS .TP -.B \-c, \-\-stripe-count -Only show the stripe count of the directory. +.BR \-c ", " \-T ", " \-\-mdt-count +Only show the number of MDTs the directory is striped across. .TP -.B \-i, \-\-stripe-index -Only show the stripe index of the directory. +.BR \-D ", " \-\-default +Show the default layout used when creating new subdirectories. .TP -.B \-R, \-\-raw -The striping information is printed without substituting the -filesystem's default values for unspecified fields. If the striping EA is not -set, 0, and -1 will be printed for the stripe count, and offset respectively. +.BR \-H ", " \-\-mdt-hash +Only show the hash function being used for this directory. .TP -.B \-q, \-\-quiet -Only show the details of the sub-striped directory FID information. +.BR \-i ", " \-m ", " \-\-mdt-index +Only show the master MDT index of the directory. .TP -.B \-v, \-\-verbose -Additional information will be shown with this option. +\fB\-O\fR, \fB\-\-obd\fR=\fIFSNAME-MDTnnnn_UUID\fR +Limit the returned directories to those with objects on a specific MDT, +whose UUID is +.I FSNAME-MDTnnnn_UUID. .TP -.B \-r, \-\-recursive +.BR \-r ", " \-\-recursive The default behavior when a directory is specified is to list the striping information for all sub-directories within the specified directory. This -can be expanded with --recursive, which will recurse into all subdirectories. +can be expanded with +.BR --recursive , +which will recurse into all subdirectories. .TP -\fB\-O\fR, \fB\-\-obd\fR=\fIFSNAME-MDTnnnn_UUID\fR -Limit the returned directories to those with objects on a specific MDT, -whose uuid is -.I FSNAME-MDTnnnn_UUID. +.BR \-y ", " \-\-yaml +Show the layout in YAML format for easier parsing. .SH EXAMPLES .TP .B $ lfs getdirstripe -O lustre-MDT0001_UUID -r /mnt/lustre/dir1 List the striping information of sub-directories, that are located on MDT1, -under /mnt/lustre/dir1. +under +.BR /mnt/lustre/dir1 . .SH AVAILABILTY The lfs getdirstripe command is part of the Lustre filesystem. .SH SEE ALSO diff --git a/lustre/doc/lfs-setdirstripe.1 b/lustre/doc/lfs-setdirstripe.1 index 9720cb3..b4ea2b0 100644 --- a/lustre/doc/lfs-setdirstripe.1 +++ b/lustre/doc/lfs-setdirstripe.1 @@ -1,30 +1,32 @@ -.TH LFS-SETDIRSTRIPE 1 2014-06-08 "Lustre" "Lustre Utilities" +.TH LFS-SETDIRSTRIPE 1 2017-11-07 "Lustre" "Lustre Utilities" .SH NAME lfs setdirstripe, mkdir \- set striping pattern of a directory. .SH SYNOPSIS -.B lfs setdirstripe -[\fIOPTION\fR]... \fIDIR\fR... +.B lfs setdirstripe [\fR-cdDHioT\fR] \fIDIR\fR... .br .SH DESCRIPTION Create a striped directory with specified striping pattern. This lfs utility is similar to -.B lfs setstripe +.BR lfs setstripe , but is used to create striped directory. .B lfs mkdir is an alias for this command. .SH OPTIONS .TP -\fB\-c\fR, \fB\-\-count\fR=\fICOUNT\fR -Stripe over +.BR \-c ", " \-T ", " \-\-mdt\-count =\fICOUNT\fR +Stripe the new directory over .I COUNT MDTs. .TP -\fB\-i\fR, \fB\-\-index\fR=\fISTART_MDT_INDEX\fR -Stripe from the MDT, whose index is -.I START_MDT_INDEX. +.BR \-i ", " \-\-mdt\-index =\fISTART_MDT_INDEX\fR +Use the MDT whose index is +.I START_MDT_INDEX +as the master/starting MDT for the directory. .TP -\fB\-t\fR, \fB\-\-hash\-type\fR=\fIHASH_TYPE\fR -the hash_type of the striped directory. +.BR \-H ", " \-\-mdt-hash =\fIHASH_TYPE\fR +Use +.I hash_type +for the striped directory. .RS 1.2i .TP .B fnv_1a_64 @@ -39,25 +41,44 @@ for only testing or when the input is known to have perfectly uniform distribution (e.g. sequential numbers). .RE .TP -.B \-D, \-\-default_stripe -Set the default striping pattern of the directory. Newly created +.BR \-d ", " \-\-delete +Delete the default striping layout from the directory. New subdirectories +created in this directory will inherit the global default directory layout +(by default they will not be striped). +.TP +.BR \-D ", " \-\-default +Set the default striping pattern of subdirectories. Newly created sub-directories will use the new default striping pattern, but existing sub-directories will not be affected. The newly -created sub-directories will also inherit the current default +created sub-directories will also inherit the specified default striping pattern. Only default stripe count is supported for now. + +Note that striping all directories across all MDTs by default is not +recommended at this time, as the clients will have to do more RPCs to +create and access each directory, hurting performance rather than +improving it. Default striped directories are preferred for cases +where large subdirectories will be created (e.g. file-per-process +job output directories). .TP -\fB\-m\fR, \fB\-\-mode\fR=\fIMODE\fR -Set the file access mode of the new directory to the specified -numeric value (typically octal) as specified in -.BR chmod (1), -and is not affected by the current +.BR \-o ", " \-\-mode =\fIMODE\fR +Set the file access permissions of the new directory to the specified +numeric +.I MODE +(typically octal), as with +.BR chmod (1). +It is not affected by the current .BR umask (1p). .SH NOTE .PP -The "lfs setdirstripe" command is only executable by root unless -"mdt.*.enable_remote_dir_gid" is set via "lctl set_param" to be either a -non-zero GID to limit it to a single group (e.g. "operator" or "admin"), -or "-1" to allow any group to create remote directories. +The +.B lfs setdirstripe +command is only executable by root unless +.B "mdt.*.enable_remote_dir_gid" +is set on the MDS via +.B lctl set_param +to be either a non-zero GID to limit it to a single group +(e.g. "operator" or "admin"), or "-1" to allow any group +to create remote directories. The root of the file system is on MDT0000, and directories and files inherit the MDT of their parent directory unless a different MDT is specified with this @@ -71,16 +92,17 @@ intermediate path components on a series different MDTs and become unavailable if any of the intermediate MDTs are offline. .SH EXAMPLES .TP -.B $ lfs setdirstripe -c 2 -i 1 -t all_char /mnt/lustre/dir1 +.B $ lfs setdirstripe -c 2 -i 1 -H all_char /mnt/lustre/dir1 This creates a directory striped on two MDTs, whose first stripe is on .B MDT0001 (MDT index 1), and whose hash type is .BR all_char . -.SH BUGS -Default stripe cannot be deleted once it is set. .SH AVAILABILITY -The lfs setdirstripe command is part of the Lustre filesystem. +The +.B lfs setdirstripe +command is part of the Lustre filesystem. .SH SEE ALSO +.BR lctl (8), .BR lfs (1), .BR lfs-getdirstripe (1), .BR lfs-setstripe (1), diff --git a/lustre/doc/lfs.1 b/lustre/doc/lfs.1 index c18e370..469b4ae 100644 --- a/lustre/doc/lfs.1 +++ b/lustre/doc/lfs.1 @@ -37,7 +37,7 @@ lfs \- Lustre utility to create a file with specific striping pattern, find the .br .B lfs getstripe [\fB--obd\fR|\fB-O\fR <\fIuuid\fR>] [\fB--quiet\fR|\fB-q\fR] [\fB--verbose\fR|\fB-v\fR] [\fB--stripe-count\fR|\fB-c\fR] - [\fB--stripe-index\fR|\fB-i\fR] [\fB--mdt-index\fR|\fB-M\fR] + [\fB--stripe-index\fR|\fB-i\fR] [\fB--mdt-index\fR|\fB-m\fR] [\fB--fid\fR|\fB-F\fR] [\fB--stripe-size\fR|\fB-S\fR] [\fB--directory\fR|\fB-d\fR] [\fB--layout\fR|\fB-L\fR] [\fB--generation\fR|\fB-g\fR] diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 8d6d03f..1f5652b 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -2240,7 +2240,7 @@ t32_test() { mdt_index=$($LFS getdirstripe -i $dir) stripe_cnt=$($LFS getdirstripe -c $dir) if [ $mdt_index = 0 -a $stripe_cnt -le 1 ]; then - $LFS mv -M 1 $dir || { + $LFS migrate -m 1 $dir || { popd error_noexit "migrate MDT1 failed" return 1 @@ -2252,7 +2252,7 @@ t32_test() { mdt_index=$($LFS getdirstripe -i $dir) stripe_cnt=$($LFS getdirstripe -c $dir) if [ $mdt_index = 1 -a $stripe_cnt -le 1 ]; then - $LFS mv -M 0 $dir || { + $LFS migrate -m 0 $dir || { popd error_noexit "migrate MDT0 failed" return 1 diff --git a/lustre/tests/lfsck-performance.sh b/lustre/tests/lfsck-performance.sh index f6d7a12..ead92af 100644 --- a/lustre/tests/lfsck-performance.sh +++ b/lustre/tests/lfsck-performance.sh @@ -780,7 +780,7 @@ namespace_gen_one() { echo "Creating $count 2-striped sub-dirs under $show_dir," \ "and 4 regular files under each striped sub-dir at: $(date)" for ((m = 0; m < $count; m++)); do - $LFS setdirstripe -i ${idx1} -c 2 -t all_char \ + $LFS setdirstripe -i ${idx1} -c 2 -H all_char \ $work_dir/d_s_${m} || { error_noexit \ "(27) Fail to make striped-dir $work_dir/d_s_${m}" diff --git a/lustre/tests/sanity-hsm.sh b/lustre/tests/sanity-hsm.sh index d7ab2be..f244cd1 100755 --- a/lustre/tests/sanity-hsm.sh +++ b/lustre/tests/sanity-hsm.sh @@ -5193,7 +5193,7 @@ test_406() { $LFS hsm_release $DIR/$tdir/$tfile # Should migrate $tdir but not $tfile. - $LFS mv -M1 $DIR/$tdir && + $LFS migrate -m1 $DIR/$tdir && error "migrating HSM an archived file should fail" $LFS hsm_restore $DIR/$tdir/$tfile @@ -5205,7 +5205,7 @@ test_406() { cat $DIR/$tdir/$tfile > /dev/null || error "cannot read $DIR/$tdir/$tfile" - $LFS mv -M1 $DIR/$tdir || + $LFS migrate -m1 $DIR/$tdir || error "cannot complete migration after HSM remove" mdt_index=$($LFS getstripe -M $DIR/$tdir) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 4b61b27..d8fde97 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -2476,7 +2476,7 @@ test_31p() { test_mkdir $DIR/$tdir $LFS setdirstripe -i0 -c2 $DIR/$tdir/striped_dir - $LFS setdirstripe -D -c2 -t all_char $DIR/$tdir/striped_dir + $LFS setdirstripe -D -c2 -H all_char $DIR/$tdir/striped_dir opendirunlink $DIR/$tdir/striped_dir/test1 || error "open unlink test1 failed" @@ -12302,7 +12302,7 @@ test_162b() { [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return mkdir $DIR/$tdir - $LFS setdirstripe -i0 -c$MDSCOUNT -t all_char $DIR/$tdir/striped_dir || + $LFS setdirstripe -i0 -c$MDSCOUNT -H all_char $DIR/$tdir/striped_dir || error "create striped dir failed" local FID=$($LFS getdirstripe $DIR/$tdir/striped_dir | @@ -16239,7 +16239,7 @@ test_striped_dir() { SAVE_UMASK=$(umask) trap cleanup_test_300 RETURN EXIT - $LFS setdirstripe -i $mdt_index -c 2 -t all_char -m 755 \ + $LFS setdirstripe -i $mdt_index -c 2 -H all_char -o 755 \ $DIR/$tdir/striped_dir || error "set striped dir error" @@ -16318,23 +16318,19 @@ test_300b() { local mtime2 local mtime3 - test_mkdir $DIR/$tdir - $LFS setdirstripe -i 0 -c 2 -t all_char $DIR/$tdir/striped_dir || + test_mkdir $DIR/$tdir || error "mkdir fail" + $LFS setdirstripe -i 0 -c 2 -H all_char $DIR/$tdir/striped_dir || error "set striped dir error" - for ((i=0; i<10; i++)); do + for i in {0..9}; do mtime1=$(stat -c %Y $DIR/$tdir/striped_dir) sleep 1 - touch $DIR/$tdir/striped_dir/file_$i || - error "touch error $i" + touch $DIR/$tdir/striped_dir/file_$i || error "touch error $i" mtime2=$(stat -c %Y $DIR/$tdir/striped_dir) - [ $mtime1 -eq $mtime2 ] && - error "mtime not change after create" + [ $mtime1 -eq $mtime2 ] && error "mtime unchanged after create" sleep 1 - rm -f $DIR/$tdir/striped_dir/file_$i || - error "unlink error $i" + rm -f $DIR/$tdir/striped_dir/file_$i || error "unlink error $i" mtime3=$(stat -c %Y $DIR/$tdir/striped_dir) - [ $mtime2 -eq $mtime3 ] && - error "mtime did not change after unlink" + [ $mtime2 -eq $mtime3 ] && error "mtime unchanged after unlink" done true } @@ -16377,7 +16373,7 @@ test_300d() { $SETSTRIPE -c 2 $DIR/$tdir #local striped directory - $LFS setdirstripe -i 0 -c 2 -t all_char $DIR/$tdir/striped_dir || + $LFS setdirstripe -i 0 -c 2 -H all_char $DIR/$tdir/striped_dir || error "set striped dir error" createmany -o $DIR/$tdir/striped_dir/f 10 || error "create 10 files failed" @@ -16408,7 +16404,7 @@ test_300e() { mkdir -p $DIR/$tdir - $LFS setdirstripe -i 0 -c 2 -t all_char $DIR/$tdir/striped_dir || + $LFS setdirstripe -i 0 -c 2 -H all_char $DIR/$tdir/striped_dir || error "set striped dir error" touch $DIR/$tdir/striped_dir/a @@ -16419,13 +16415,13 @@ test_300e() { mkdir $DIR/$tdir/striped_dir/dir_b mkdir $DIR/$tdir/striped_dir/dir_c - $LFS setdirstripe -i 0 -c 2 -t all_char $DIR/$tdir/striped_dir/stp_a || + $LFS setdirstripe -i 0 -c 2 -H all_char $DIR/$tdir/striped_dir/stp_a || error "set striped adir under striped dir error" $LFS setdirstripe -i 0 -c 2 -H all_char $DIR/$tdir/striped_dir/stp_b || error "set striped bdir under striped dir error" - $LFS setdirstripe -i 0 -c 2 -t all_char $DIR/$tdir/striped_dir/stp_c || + $LFS setdirstripe -i 0 -c 2 -H all_char $DIR/$tdir/striped_dir/stp_c || error "set striped cdir under striped dir error" mrename $DIR/$tdir/striped_dir/dir_a $DIR/$tdir/striped_dir/dir_b || @@ -16455,10 +16451,10 @@ test_300f() { rm -rf $DIR/$tdir mkdir -p $DIR/$tdir - $LFS setdirstripe -i 0 -c 2 -t all_char $DIR/$tdir/striped_dir || + $LFS setdirstripe -i 0 -c 2 -H all_char $DIR/$tdir/striped_dir || error "set striped dir error" - $LFS setdirstripe -i 0 -c 2 -t all_char $DIR/$tdir/striped_dir1 || + $LFS setdirstripe -i 0 -c 2 -H all_char $DIR/$tdir/striped_dir1 || error "set striped dir error" touch $DIR/$tdir/striped_dir/a @@ -16592,8 +16588,7 @@ test_300h() { local stripe_count mkdir $DIR/$tdir - $LFS setdirstripe -i 0 -c $MDSCOUNT -t all_char \ - $DIR/$tdir/striped_dir || + $LFS setdirstripe -i 0 -c$MDSCOUNT -H all_char $DIR/$tdir/striped_dir || error "set striped dir error" test_300_check_default_striped_dir striped_dir $MDSCOUNT 1 @@ -16624,7 +16619,7 @@ test_300i() { mkdir $DIR/$tdir - $LFS setdirstripe -i 0 -c$MDSCOUNT -t all_char $DIR/$tdir/striped_dir || + $LFS setdirstripe -i 0 -c$MDSCOUNT -H all_char $DIR/$tdir/striped_dir || error "set striped dir error" createmany -o $DIR/$tdir/striped_dir/f- 10 || @@ -16680,7 +16675,7 @@ test_300j() { #define OBD_FAIL_SPLIT_UPDATE_REC 0x1702 $LCTL set_param fail_loc=0x1702 - $LFS setdirstripe -i 0 -c$MDSCOUNT -t all_char $DIR/$tdir/striped_dir || + $LFS setdirstripe -i 0 -c$MDSCOUNT -H all_char $DIR/$tdir/striped_dir || error "set striped dir error" createmany -o $DIR/$tdir/striped_dir/f- 10 || diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 7290411..cc0738b 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -291,13 +291,13 @@ command_t cmdlist[] = { "\t '^init' indicating all uninstantiated components\n" "\t-I and -F cannot be specified at the same time\n"}, {"getstripe", lfs_getstripe, 0, - "To list the striping info for a given file or files in a\n" + "To list the layout pattern for a given file or files in a\n" "directory or recursively for all files in a directory tree.\n" "usage: getstripe [--ost|-O ] [--quiet|-q] [--verbose|-v]\n" - " [--stripe-count|-c] [--stripe-index|-i]\n" + " [--stripe-count|-c] [--stripe-index|-i] [--fid|-F]\n" " [--pool|-p] [--stripe-size|-S] [--directory|-d]\n" - " [--mdt|-m] [--recursive|-r] [--raw|-R] [--yaml|-y]\n" - " [--layout|-L] [--fid|-F] [--generation|-g]\n" + " [--mdt-index|-m] [--recursive|-r] [--raw|-R]\n" + " [--layout|-L] [--generation|-g] [--yaml|-y]\n" " [--component-id[=comp_id]|-I[comp_id]]\n" " [--component-flags[=comp_flags]]\n" " [--component-count]\n" @@ -310,10 +310,10 @@ command_t cmdlist[] = { "usage: setdirstripe [OPTION] \n" SETDIRSTRIPE_USAGE}, {"getdirstripe", lfs_getdirstripe, 0, - "To list the striping info for a given directory\n" + "To list the layout pattern info for a given directory\n" "or recursively for all directories in a directory tree.\n" - "usage: getdirstripe [--obd|-O ] [--mdt-count|-c]\n" - " [--mdt-index|-i] [--mdt-hash|-t]\n" + "usage: getdirstripe [--mdt-count|-c] [--mdt-index|-m|-i]\n" + " [--mdt-hash|-H] [--obd|-O ]\n" " [--recursive|-r] [--yaml|-y]\n" " [--default|-D] ..."}, {"mkdir", lfs_setdirstripe, 0, @@ -489,7 +489,7 @@ command_t cmdlist[] = { " [--stripe-index|-i] \n" " [--stripe-size|-S] \n" " [--pool|-p] \n" - " [--ost-list|-o] \n" + " [--ost|-o] \n" " [--block|-b]\n" " [--non-block|-n]\n" " \n" @@ -503,7 +503,7 @@ command_t cmdlist[] = { {"mv", lfs_mv, 0, "To move directories between MDTs. This command is deprecated, " "use \"migrate\" instead.\n" - "usage: mv [--mdt-index|-M] " + "usage: mv [--mdt-index|-m] " "[--verbose|-v]\n"}, {"ladvise", lfs_ladvise, 0, "Provide servers with advice about access patterns for a file.\n" @@ -2112,25 +2112,24 @@ static int lfs_setstripe0(int argc, char **argv, enum setstripe_origin opc) char cmd[PATH_MAX]; struct option long_opts[] = { - /* --block is only valid in migrate mode */ - { .val = 'b', .name = "block", .has_arg = no_argument}, +/* find { .val = 'A', .name = "atime", .has_arg = required_argument }*/ + /* --block is only valid in migrate mode */ + { .val = 'b', .name = "block", .has_arg = no_argument }, { .val = LFS_COMP_ADD_OPT, - .name = "comp-add", .has_arg = no_argument}, + .name = "comp-add", .has_arg = no_argument }, { .val = LFS_COMP_ADD_OPT, - .name = "component-add", - .has_arg = no_argument}, + .name = "component-add", .has_arg = no_argument }, { .val = LFS_COMP_DEL_OPT, - .name = "comp-del", .has_arg = no_argument}, + .name = "comp-del", .has_arg = no_argument }, { .val = LFS_COMP_DEL_OPT, - .name = "component-del", - .has_arg = no_argument}, + .name = "component-del", .has_arg = no_argument }, { .val = LFS_COMP_FLAGS_OPT, - .name = "comp-flags", .has_arg = required_argument}, + .name = "comp-flags", .has_arg = required_argument }, { .val = LFS_COMP_FLAGS_OPT, .name = "component-flags", - .has_arg = required_argument}, + .has_arg = required_argument }, { .val = LFS_COMP_SET_OPT, - .name = "comp-set", .has_arg = no_argument}, + .name = "comp-set", .has_arg = no_argument }, { .val = LFS_COMP_SET_OPT, .name = "component-set", .has_arg = no_argument}, @@ -2142,12 +2141,16 @@ static int lfs_setstripe0(int argc, char **argv, enum setstripe_origin opc) .name = "flags", .has_arg = required_argument}, { .val = 'c', .name = "stripe-count", .has_arg = required_argument}, { .val = 'c', .name = "stripe_count", .has_arg = required_argument}, +/* find { .val = 'C', .name = "ctime", .has_arg = required_argument }*/ { .val = 'd', .name = "delete", .has_arg = no_argument}, { .val = 'E', .name = "comp-end", .has_arg = required_argument}, { .val = 'E', .name = "component-end", .has_arg = required_argument}, { .val = 'f', .name = "file", .has_arg = required_argument }, - /* dirstripe {"mdt-hash", required_argument, 0, 'H'}, */ +/* find { .val = 'F', .name = "fid", .has_arg = no_argument }, */ +/* find { .val = 'g', .name = "gid", .has_arg = no_argument }, */ +/* find { .val = 'G', .name = "group", .has_arg = required_argument }*/ +/* dirstripe { .val = 'H', .name = "mdt-hash", .has_arg = required_argument }*/ { .val = 'i', .name = "stripe-index", .has_arg = required_argument}, { .val = 'i', .name = "stripe_index", .has_arg = required_argument}, { .val = 'I', .name = "comp-id", .has_arg = required_argument}, @@ -2156,20 +2159,28 @@ static int lfs_setstripe0(int argc, char **argv, enum setstripe_origin opc) { .val = 'm', .name = "mdt", .has_arg = required_argument}, { .val = 'm', .name = "mdt-index", .has_arg = required_argument}, { .val = 'm', .name = "mdt_index", .has_arg = required_argument}, - { .val = 'N', .name = "mirror-count", .has_arg = optional_argument}, /* --non-block is only valid in migrate mode */ - { .val = 'n', .name = "non-block", .has_arg = no_argument}, - { .val = 'o', .name = "ost", .has_arg = required_argument}, + { .val = 'n', .name = "non-block", .has_arg = no_argument }, + { .val = 'N', .name = "mirror-count", .has_arg = optional_argument}, + { .val = 'o', .name = "ost", .has_arg = required_argument }, #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) { .val = 'o', .name = "ost-list", .has_arg = required_argument }, { .val = 'o', .name = "ost_list", .has_arg = required_argument }, #endif { .val = 'p', .name = "pool", .has_arg = required_argument }, +/* find { .val = 'P', .name = "print", .has_arg = no_argument }, */ +/* getstripe { .val = 'q', .name = "quiet", .has_arg = no_argument }, */ +/* getstripe { .val = 'r', .name = "recursive", .has_arg = no_argument }, */ +/* getstripe { .val = 'R', .name = "raw", .has_arg = no_argument }, */ { .val = 'S', .name = "stripe-size", .has_arg = required_argument }, { .val = 'S', .name = "stripe_size", .has_arg = required_argument }, - /* dirstripe {"mdt-count", required_argument, 0, 'T'}, */ +/* find { .val = 't', .name = "type", .has_arg = required_argument }*/ +/* dirstripe { .val = 'T', .name = "mdt-count", .has_arg = required_argument }*/ +/* find { .val = 'u', .name = "uid", .has_arg = required_argument }*/ +/* find { .val = 'U', .name = "user", .has_arg = required_argument }*/ /* --verbose is only valid in migrate mode */ - { .val = 'v', .name = "verbose", .has_arg = no_argument }, + { .val = 'v', .name = "verbose", .has_arg = no_argument}, +/* getstripe { .val = 'y', .name = "yaml", .has_arg = no_argument }, */ { .name = NULL } }; setstripe_args_init(&lsa); @@ -2430,6 +2441,11 @@ static int lfs_setstripe0(int argc, char **argv, enum setstripe_origin opc) lpp = &last_mirror->m_layout; break; case 'o': +#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) + if (strcmp(argv[optind - 1], "--ost-list") == 0) + fprintf(stderr, "warning: '--ost-list' is " + "deprecated, use '--ost' instead\n"); +#endif lsa.lsa_nr_tgts = parse_targets(osts, sizeof(osts) / sizeof(__u32), lsa.lsa_nr_tgts, optarg); @@ -2859,23 +2875,25 @@ static int lfs_find(int argc, char **argv) { .val = 'c', .name = "stripe-count", .has_arg = required_argument }, { .val = 'c', .name = "stripe_count", .has_arg = required_argument }, { .val = 'C', .name = "ctime", .has_arg = required_argument }, +/* getstripe { .val = 'd', .name = "directory", .has_arg = no_argument }, */ { .val = 'D', .name = "maxdepth", .has_arg = required_argument }, { .val = 'E', .name = "comp-end", .has_arg = required_argument }, { .val = 'E', .name = "component-end", .has_arg = required_argument }, +/* find { .val = 'F', .name = "fid", .has_arg = no_argument }, */ { .val = 'g', .name = "gid", .has_arg = required_argument }, { .val = 'G', .name = "group", .has_arg = required_argument }, { .val = 'H', .name = "mdt-hash", .has_arg = required_argument }, { .val = 'i', .name = "stripe-index", .has_arg = required_argument }, { .val = 'i', .name = "stripe_index", .has_arg = required_argument }, - /*{"component-id", required_argument, 0, 'I'},*/ +/* getstripe { .val = 'I', .name = "comp-id", .has_arg = required_argument }*/ { .val = 'L', .name = "layout", .has_arg = required_argument }, { .val = 'm', .name = "mdt", .has_arg = required_argument }, { .val = 'm', .name = "mdt-index", .has_arg = required_argument }, { .val = 'm', .name = "mdt_index", .has_arg = required_argument }, { .val = 'M', .name = "mtime", .has_arg = required_argument }, { .val = 'n', .name = "name", .has_arg = required_argument }, - /* reserve {"or", no_argument, , 0, 'o'}, to match find(1) */ +/* find { .val = 'o' .name = "or", .has_arg = no_argument }, like find(1) */ { .val = 'O', .name = "obd", .has_arg = required_argument }, { .val = 'O', .name = "ost", .has_arg = required_argument }, /* no short option for pool, p/P already used */ @@ -2885,6 +2903,9 @@ static int lfs_find(int argc, char **argv) { .val = 'P', .name = "print", .has_arg = no_argument }, { .val = LFS_PROJID_OPT, .name = "projid", .has_arg = required_argument }, +/* getstripe { .val = 'q', .name = "quiet", .has_arg = no_argument }, */ +/* getstripe { .val = 'r', .name = "recursive", .has_arg = no_argument }, */ +/* getstripe { .val = 'R', .name = "raw", .has_arg = no_argument }, */ { .val = 's', .name = "size", .has_arg = required_argument }, { .val = 'S', .name = "stripe-size", .has_arg = required_argument }, { .val = 'S', .name = "stripe_size", .has_arg = required_argument }, @@ -2892,6 +2913,8 @@ static int lfs_find(int argc, char **argv) { .val = 'T', .name = "mdt-count", .has_arg = required_argument }, { .val = 'u', .name = "uid", .has_arg = required_argument }, { .val = 'U', .name = "user", .has_arg = required_argument }, +/* getstripe { .val = 'v', .name = "verbose", .has_arg = no_argument }, */ +/* getstripe { .val = 'y', .name = "yaml", .has_arg = no_argument }, */ { .name = NULL } }; int pathstart = -1; int pathend = -1; @@ -3359,6 +3382,7 @@ static int lfs_getstripe_internal(int argc, char **argv, struct find_param *param) { struct option long_opts[] = { +/* find { .val = 'A', .name = "atime", .has_arg = required_argument }*/ { .val = LFS_COMP_COUNT_OPT, .name = "comp-count", .has_arg = no_argument }, { .val = LFS_COMP_COUNT_OPT, @@ -3371,29 +3395,17 @@ static int lfs_getstripe_internal(int argc, char **argv, .name = "comp-start", .has_arg = optional_argument }, { .val = LFS_COMP_START_OPT, .name = "component-start", .has_arg = optional_argument }, -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 59, 0) - /* This formerly implied "stripe-count", but was explicitly - * made "stripe-count" for consistency with other options, - * and to separate it from "mdt-count" when DNE arrives. */ - { .val = 'c', .name = "count", .has_arg = no_argument }, -#endif { .val = 'c', .name = "stripe-count", .has_arg = no_argument }, { .val = 'c', .name = "stripe_count", .has_arg = no_argument }, +/* find { .val = 'C', .name = "ctime", .has_arg = required_argument }*/ { .val = 'd', .name = "directory", .has_arg = no_argument }, { .val = 'D', .name = "default", .has_arg = no_argument }, { .val = 'E', .name = "comp-end", .has_arg = optional_argument }, - { .val = 'E', .name = "component-end", - .has_arg = optional_argument }, + { .val = 'E', .name = "component-end", .has_arg = optional_argument }, { .val = 'F', .name = "fid", .has_arg = no_argument }, { .val = 'g', .name = "generation", .has_arg = no_argument }, - /* dirstripe { .val = 'H', .name = "mdt-hash", - * .has_arg = required_argument }, */ -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 59, 0) - /* This formerly implied "stripe-index", but was explicitly - * made "stripe-index" for consistency with other options, - * and to separate it from "mdt-index" when DNE arrives. */ - { .val = 'i', .name = "index", .has_arg = no_argument }, -#endif +/* find { .val = 'G', .name = "group", .has_arg = required_argument }*/ +/* dirstripe { .val = 'H', .name = "mdt-hash", .has_arg = required_argument }*/ { .val = 'i', .name = "stripe-index", .has_arg = no_argument }, { .val = 'i', .name = "stripe_index", .has_arg = no_argument }, { .val = 'I', .name = "comp-id", .has_arg = optional_argument }, @@ -3402,32 +3414,21 @@ static int lfs_getstripe_internal(int argc, char **argv, { .val = 'm', .name = "mdt", .has_arg = no_argument }, { .val = 'm', .name = "mdt-index", .has_arg = no_argument }, { .val = 'm', .name = "mdt_index", .has_arg = no_argument }, -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) - { .val = 'M', .name = "mdt-index", .has_arg = no_argument }, - { .val = 'M', .name = "mdt_index", .has_arg = no_argument }, -#endif -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 59, 0) - /* This formerly implied "stripe-index", but was confusing - * with "file offset" (which will eventually be needed for - * with different layouts by offset), so deprecate it. */ - { .val = 'o', .name = "offset", .has_arg = no_argument }, -#endif +/* find { .val = 'M', .name = "mtime", .has_arg = required_argument }*/ +/* find { .val = 'n', .name = "name", .has_arg = required_argument }*/ { .val = 'O', .name = "obd", .has_arg = required_argument }, { .val = 'O', .name = "ost", .has_arg = required_argument }, { .val = 'p', .name = "pool", .has_arg = no_argument }, +/* find { .val = 'P', .name = "print", .has_arg = no_argument }, */ { .val = 'q', .name = "quiet", .has_arg = no_argument }, { .val = 'r', .name = "recursive", .has_arg = no_argument }, { .val = 'R', .name = "raw", .has_arg = no_argument }, -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 59, 0) - /* This formerly implied "--stripe-size", but was confusing - * with "lfs find --size|-s", which means "file size", so use - * the consistent "--stripe-size|-S" for all commands. */ - { .val = 's', .name = "size", .has_arg = no_argument }, -#endif { .val = 'S', .name = "stripe-size", .has_arg = no_argument }, { .val = 'S', .name = "stripe_size", .has_arg = no_argument }, - /* dirstripe { .val = 'T', .name = "mdt-count", - * .has_arg = required_argument }, */ +/* find { .val = 't', .name = "type", .has_arg = required_argument }*/ +/* dirstripe { .val = 'T', .name = "mdt-count", .has_arg = required_argument }*/ +/* find { .val = 'u', .name = "uid", .has_arg = required_argument }*/ +/* find { .val = 'U', .name = "user", .has_arg = required_argument }*/ { .val = 'v', .name = "verbose", .has_arg = no_argument }, { .val = 'y', .name = "yaml", .has_arg = no_argument }, { .name = NULL } }; @@ -3438,9 +3439,6 @@ static int lfs_getstripe_internal(int argc, char **argv, long_opts, NULL)) != -1) { switch (c) { case 'c': - if (strcmp(argv[optind - 1], "--count") == 0) - fprintf(stderr, "warning: '--count' deprecated," - " use '--stripe-count' instead\n"); if (!(param->fp_verbose & VERBOSE_DETAIL)) { param->fp_verbose |= VERBOSE_COUNT; param->fp_max_depth = 0; @@ -3543,17 +3541,7 @@ static int lfs_getstripe_internal(int argc, char **argv, param->fp_max_depth = 0; } break; -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 59, 0) - case 'o': - fprintf(stderr, "warning: '--offset|-o' deprecated, " - "use '--stripe-index|-i' instead\n"); -#endif case 'i': -#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 6, 53, 0) - if (strcmp(argv[optind - 1], "--index") == 0) - fprintf(stderr, "warning: '--index' deprecated" - ", use '--stripe-index' instead\n"); -#endif if (!(param->fp_verbose & VERBOSE_DETAIL)) { param->fp_verbose |= VERBOSE_OFFSET; param->fp_max_depth = 0; @@ -3584,10 +3572,8 @@ static int lfs_getstripe_internal(int argc, char **argv, break; #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) case 'M': -#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 11, 53, 0) fprintf(stderr, "warning: '-M' deprecated" - ", use '-m' instead\n"); -#endif + ", use '--mdt-index' or '-m' instead\n"); #endif case 'm': if (!(param->fp_verbose & VERBOSE_DETAIL)) @@ -3618,11 +3604,6 @@ static int lfs_getstripe_internal(int argc, char **argv, case 'R': param->fp_raw = 1; break; -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 59, 0) - case 's': - fprintf(stderr, "warning: '--size|-s' deprecated, " - "use '--stripe-size|-S' instead\n"); -#endif /* LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 59, 0) */ case 'S': if (!(param->fp_verbose & VERBOSE_DETAIL)) { param->fp_verbose |= VERBOSE_SIZE; @@ -3714,17 +3695,13 @@ static int lfs_getdirstripe(int argc, char **argv) { struct find_param param = { 0 }; struct option long_opts[] = { -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) { .val = 'c', .name = "mdt-count", .has_arg = no_argument }, -#endif { .val = 'D', .name = "default", .has_arg = no_argument }, { .val = 'H', .name = "mdt-hash", .has_arg = no_argument }, { .val = 'i', .name = "mdt-index", .has_arg = no_argument }, + { .val = 'm', .name = "mdt-index", .has_arg = no_argument }, { .val = 'O', .name = "obd", .has_arg = required_argument }, { .val = 'r', .name = "recursive", .has_arg = no_argument }, -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) - { .val = 't', .name = "mdt-hash", .has_arg = no_argument }, -#endif { .val = 'T', .name = "mdt-count", .has_arg = no_argument }, { .val = 'y', .name = "yaml", .has_arg = no_argument }, { .name = NULL } }; @@ -3733,39 +3710,36 @@ static int lfs_getdirstripe(int argc, char **argv) param.fp_get_lmv = 1; while ((c = getopt_long(argc, argv, - "cDHiO:rtTy", long_opts, NULL)) != -1) + "cDHimO:rtTy", long_opts, NULL)) != -1) { switch (c) { - case 'O': - if (param.fp_obd_uuid) { - fprintf(stderr, - "error: %s: only one obduuid allowed", - argv[0]); - return CMD_HELP; - } - param.fp_obd_uuid = (struct obd_uuid *)optarg; - break; -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) case 'c': -#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 10, 50, 0) - fprintf(stderr, "warning: '-c' deprecated" - ", use '-T' instead\n"); -#endif -#endif case 'T': param.fp_verbose |= VERBOSE_COUNT; break; + case 'D': + param.fp_get_default_lmv = 1; + break; case 'i': + case 'm': param.fp_verbose |= VERBOSE_OFFSET; break; #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) case 't': + fprintf(stderr, "warning: '-t' deprecated, " + "use '--mdt-hash' or '-H' instead\n"); #endif case 'H': param.fp_verbose |= VERBOSE_HASH_TYPE; break; - case 'D': - param.fp_get_default_lmv = 1; + case 'O': + if (param.fp_obd_uuid) { + fprintf(stderr, + "error: %s: only one obduuid allowed", + argv[0]); + return CMD_HELP; + } + param.fp_obd_uuid = (struct obd_uuid *)optarg; break; case 'r': param.fp_recursive = 1; @@ -3814,43 +3788,33 @@ static int lfs_setdirstripe(int argc, char **argv) bool delete = false; struct option long_opts[] = { -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) { .val = 'c', .name = "count", .has_arg = required_argument }, -#endif { .val = 'c', .name = "mdt-count", .has_arg = required_argument }, { .val = 'd', .name = "delete", .has_arg = no_argument }, + { .val = 'D', .name = "default", .has_arg = no_argument }, + { .val = 'D', .name = "default_stripe", .has_arg = no_argument }, + { .val = 'H', .name = "mdt-hash", .has_arg = required_argument }, + { .val = 'i', .name = "mdt-index", .has_arg = required_argument }, #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) { .val = 'i', .name = "index", .has_arg = required_argument }, #endif - { .val = 'i', .name = "mdt-index", .has_arg = required_argument }, - { .val = 'm', .name = "mode", .has_arg = required_argument }, + { .val = 'o', .name = "mode", .has_arg = required_argument }, #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) { .val = 't', .name = "hash-type", .has_arg = required_argument }, - { .val = 't', .name = "mdt-hash", .has_arg = required_argument }, -#endif - {"mdt-hash", required_argument, 0, 'H'}, -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) - { .val = 'D', .name = "default_stripe", - .has_arg = no_argument }, #endif - { .val = 'D', .name = "default", .has_arg = no_argument }, + { .val = 'T', .name = "mdt-count", .has_arg = required_argument }, { .name = NULL } }; setstripe_args_init(&lsa); - while ((c = getopt_long(argc, argv, "c:dDi:H:m:t:", long_opts, + while ((c = getopt_long(argc, argv, "c:dDi:H:m:o:t:T:", long_opts, NULL)) >= 0) { switch (c) { case 0: /* Long options. */ break; case 'c': -#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 11, 53, 0) - if (strcmp(argv[optind - 1], "--count") == 0) - fprintf(stderr, - "%s %s: warning: '--count' deprecated, use '--mdt-count' instead\n", - progname, argv[0]); -#endif + case 'T': lsa.lsa_stripe_count = strtoul(optarg, &end, 0); if (*end != '\0') { fprintf(stderr, @@ -3866,8 +3830,22 @@ static int lfs_setdirstripe(int argc, char **argv) case 'D': default_stripe = true; break; +#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) + case 't': + fprintf(stderr, "warning: '--hash-type' and '-t' " + "deprecated, use '--mdt-hash' or '-H' instead\n"); +#endif + case 'H': + lsa.lsa_pattern = check_hashtype(optarg); + if (lsa.lsa_pattern == 0) { + fprintf(stderr, + "%s %s: bad stripe hash type '%s'\n", + progname, argv[0], optarg); + return CMD_HELP; + } + break; case 'i': -#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 11, 53, 0) +#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) if (strcmp(argv[optind - 1], "--index") == 0) fprintf(stderr, "%s %s: warning: '--index' deprecated, use '--mdt-index' instead\n", @@ -3887,26 +3865,13 @@ static int lfs_setdirstripe(int argc, char **argv) if (lsa.lsa_stripe_off == LLAPI_LAYOUT_DEFAULT) lsa.lsa_stripe_off = mdts[0]; break; +#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 16, 53, 0) case 'm': - mode_opt = optarg; - break; -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) - case 't': -#endif - case 'H': -#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 11, 53, 0) - if (strcmp(argv[optind - 1], "--hash-type") == 0) - fprintf(stderr, - "%s %s: warning: '--hash-type' deprecated, use '--mdt-hash' instead\n", - progname, argv[0]); + fprintf(stderr, "warning: '-m' is deprecated, " + "use '--mode' or '-o' instead\n"); #endif - lsa.lsa_pattern = check_hashtype(optarg); - if (lsa.lsa_pattern == 0) { - fprintf(stderr, - "%s %s: bad stripe hash type '%s'\n", - progname, argv[0], optarg); - return CMD_HELP; - } + case 'o': + mode_opt = optarg; break; default: fprintf(stderr, "%s %s: unrecognized option '%s'\n", @@ -4046,13 +4011,18 @@ static int lfs_mv(int argc, char **argv) int c; int rc = 0; struct option long_opts[] = { - { .val = 'M', .name = "mdt-index", .has_arg = required_argument }, + { .val = 'm', .name = "mdt-index", .has_arg = required_argument }, { .val = 'v', .name = "verbose", .has_arg = no_argument }, { .name = NULL } }; - while ((c = getopt_long(argc, argv, "M:v", long_opts, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "m:M:v", long_opts, NULL)) != -1) { switch (c) { - case 'M': { +#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) + case 'M': + fprintf(stderr, "warning: '-M' deprecated" + ", use '--mdt-index' or '-m' instead\n"); +#endif + case 'm': param.fp_mdt_index = strtoul(optarg, &end, 0); if (*end != '\0') { fprintf(stderr, "%s: invalid MDT index'%s'\n", @@ -4060,11 +4030,9 @@ static int lfs_mv(int argc, char **argv) return CMD_HELP; } break; - } - case 'v': { + case 'v': param.fp_verbose = VERBOSE_DETAIL; break; - } default: fprintf(stderr, "error: %s: unrecognized option '%s'\n", argv[0], argv[optind - 1]); -- 1.8.3.1