Whamcloud - gitweb
LU-8314 utils: revert lfs_getdirstripe to non-recursive mode 16/21516/5
authorLai Siyao <lai.siyao@intel.com>
Tue, 26 Jul 2016 15:27:48 +0000 (23:27 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 15 Aug 2016 21:12:36 +0000 (21:12 +0000)
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 <lai.siyao@intel.com>
Change-Id: I683f5dec203230b36ee3da404e7f0817e91d090f
Reviewed-on: http://review.whamcloud.com/21516
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanity.sh
lustre/utils/lfs.c

index 12ca545..4947f7b 100755 (executable)
@@ -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() {
index 3c5aefa..6969373 100644 (file)
@@ -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, &param);
 }