From: Lai Siyao Date: Tue, 26 Jul 2016 15:27:48 +0000 (+0800) Subject: LU-8314 utils: revert lfs_getdirstripe to non-recursive mode X-Git-Tag: 2.8.57~26 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=957df6f030e8c89b02b168776d237dbb6879073b LU-8314 utils: revert lfs_getdirstripe to non-recursive mode Since 2.7 'lfs getdirstripe' enabled recursion mode by default, while it's not the obvious behavior, this patch reverts it to non-recursive mode. Signed-off-by: Lai Siyao Change-Id: I683f5dec203230b36ee3da404e7f0817e91d090f Reviewed-on: http://review.whamcloud.com/21516 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 12ca545..4947f7b 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -4459,6 +4459,26 @@ test_56a() { # was test_56 } run_test 56a "check $GETSTRIPE" +test_56b() { + test_mkdir $DIR/$tdir + NUMDIRS=3 + for i in $(seq 1 $NUMDIRS); do + test_mkdir $DIR/$tdir/dir$i + done + + # test lfs getdirstripe default mode is non-recursion, which is + # different from lfs getstripe + dircnt=$($LFS getdirstripe $DIR/$tdir | grep -c lmv_stripe_count) + [[ $dircnt -eq 1 ]] || + error "$LFS getdirstripe: found $dircnt, not 1" + dircnt=$($LFS getdirstripe --recursive $DIR/$tdir | + grep -c lmv_stripe_count) + [[ $dircnt -eq $((NUMDIRS + 1)) ]] || + error "$LFS getdirstripe --recursive: found $dircnt, \ + not $((NUMDIRS + 1))" +} +run_test 56b "check $LFS getdirstripe" + NUMFILES=3 NUMDIRS=3 setup_56() { diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 3c5aefa..6969373 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -1775,7 +1775,6 @@ static int lfs_getstripe_internal(int argc, char **argv, }; int c, rc; - param->fp_max_depth = 1; while ((c = getopt_long(argc, argv, "cdDghiLMoO:pqrRsSv", long_opts, NULL)) != -1) { switch (c) { @@ -1936,6 +1935,8 @@ static int lfs_tgts(int argc, char **argv) static int lfs_getstripe(int argc, char **argv) { struct find_param param = { 0 }; + + param.fp_max_depth = 1; return lfs_getstripe_internal(argc, argv, ¶m); }