Whamcloud - gitweb
LU-10560 llite: remove extra headers from llite_mmap.c
[fs/lustre-release.git] / lustre / tests / sanity-pfl.sh
index e893344..3f9083b 100644 (file)
@@ -196,7 +196,7 @@ test_5() {
        local subdir=$parent/subdir
 
        rm -fr $parent
-       test_mkdir $parent || error "Create dir $parent failed"
+       test_mkdir $parent
 
        # set default layout to parent directory
        $LFS setstripe -E 64M -c 2 -i 0 -E -1 -c 4 -i 0 $parent ||
@@ -235,7 +235,7 @@ test_5() {
                error "Delete default layout from $parent failed"
 
        comp_cnt=$($LFS getstripe -d --component-count $parent)
-       [ ! -z "$comp_cnt" ] && error "$comp_cnt isn't empty"
+       [ $comp_cnt -ne 0 ] && error "$comp_cnt isn't 0"
 
        rm -f $comp_file || error "Delete $comp_file failed"
        rm -f $subdir/$tfile || error "Delete $subdir/$tfile failed"
@@ -254,7 +254,7 @@ test_6() {
                error "Create v1 $comp_file failed"
 
        local comp_cnt=$($LFS getstripe --component-count $comp_file)
-       [ ! -z "$comp_cnt" ] && error "Wrong component count $comp_cnt"
+       [ $comp_cnt -ne 0 ] && error "Wrong component count $comp_cnt"
 
        dd if=/dev/urandom of=$comp_file bs=1M count=5 oflag=sync ||
                error "Write to v1 $comp_file failed"
@@ -289,7 +289,7 @@ test_6() {
                error "Migrate(composite -> v1) $comp_file failed"
 
        comp_cnt=$($LFS getstripe --component-count $comp_file)
-       [ ! -z "$comp_cnt" ] && error "$comp_cnt isn't empty"
+       [ $comp_cnt -ne 0 ] && error "$comp_cnt isn't 0"
 
        chksum=$(md5sum $comp_file)
        [ "$old_chksum" != "$chksum" ] &&
@@ -300,7 +300,7 @@ test_6() {
 run_test 6 "Migrate composite file"
 
 test_7() {
-       test_mkdir -p $DIR/$tdir || error "mkdir failed"
+       test_mkdir $DIR/$tdir
        chmod 0777 $DIR/$tdir || error "chmod $tdir failed"
 
        local comp_file=$DIR/$tdir/$tfile
@@ -324,7 +324,7 @@ test_8() {
        local parent=$DIR/$tdir
 
        rm -fr $parent
-       test_mkdir -p $parent || error "Create dir $parent failed"
+       test_mkdir $parent
 
        $LFS setstripe -E 2M -c 1 -S 1M -E 16M -c 2 -S 2M \
                -E -1 -c 4 -S 4M $parent ||
@@ -361,7 +361,7 @@ test_9() {
        local f2=$($LFS getstripe -I2 $comp_file |
                        awk '/l_fid:/ {print $7}')
        echo "after MDS recovery, the ost fid of 2nd component is $f2"
-       [ $f1 == $f2 ] || error "$f1 != $f2"
+       [ "x$f1" == "x$f2" ] || error "$f1 != $f2"
 }
 run_test 9 "Replay layout extend object instantiation"
 
@@ -374,7 +374,8 @@ component_dump() {
 
 test_10() {
        local parent=$DIR/$tdir
-       local root_layout=$(get_layout_param $MOUNT)
+
+       save_layout_restore_at_exit $MOUNT
 
        rm -rf $parent
        $LFS setstripe -d $MOUNT || error "clear root layout"
@@ -384,7 +385,7 @@ test_10() {
                -E -1 -c 4 -S 4M $MOUNT ||
                error "Set root layout failed"
 
-       test_mkdir -p $parent || error "Create dir $parent failed"
+       test_mkdir $parent
        # set a different layout for parent
        $LFS setstripe -E -1 -c 1 -S 1M $parent ||
                error "set $parent layout failed"
@@ -413,7 +414,6 @@ test_10() {
        [  x$f2_expect != x$f2_entry ] &&
                error "$parent/file2 does not inherite root layout"
 
-       $LFS setstripe $root_layout $MOUNT
        return 0
 }
 run_test 10 "Inherit composite template from root"
@@ -451,7 +451,7 @@ test_11() {
        $TRUNCATE $comp_file $((1024*1024*1+1))
 
        f2=$($LFS getstripe -I2 $comp_file | grep "l_fid")
-       [[ -z $f2 ]] && error "2: 2nd component uninstantiated"
+       [[ -z $f2 ]] && error "3: 2nd component uninstantiated"
        f3=$($LFS getstripe -I3 $comp_file | grep "l_fid")
        [[ -z $f3 ]] && error "3: 3rd component uninstantiated"
        f4=$($LFS getstripe -I4 $comp_file | grep "l_fid")
@@ -479,8 +479,14 @@ test_12() {
 
        # specify ost list for component
        $LFS setstripe -E1m -c2 -o0,1 -E2m -c2 -o1,2 -E3m -c2 -o2,1 \
-               -E4m -c2 -o2,0 -E-1 $file ||
+               -E4m -c1 -i2 -E-1 $file ||
                error "Create $file failed"
+
+       # clear lod component cache
+       stop $SINGLEMDS || error "stop MDS"
+       local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
+       start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || error "start MDS"
+
        # instantiate all components
        $TRUNCATE $file $((1024*1024*4+1))
 
@@ -499,7 +505,7 @@ test_12() {
 
        local o4=$($LFS getstripe -I4 $file |
                        awk '/l_ost_idx:/ {printf("%d",$5)}')
-       [[ $o4 != "20" ]] && error "$o4 is not 20"
+       [[ $o4 != "2" ]] && error "$o4 is not 2"
 
        return 0
 }
@@ -570,13 +576,13 @@ test_15() {
        local parent=$DIR/$tdir
 
        rm -fr $parent
-       test_mkdir -p $parent || error "Create dir $parent failed"
+       test_mkdir $parent
 
        $LFS setstripe -d $parent || error "delete default layout"
 
        $LFS setstripe -E 1M -E 10M -E eof $parent/f1 || error "create f1"
        $LFS setstripe -E 4M -E 20M -E eof $parent/f2 || error "create f2"
-       test_mkdir -p $parent/subdir || error "create subdir"
+       test_mkdir $parent/subdir
        $LFS setstripe -E 6M -E 30M -E eof $parent/subdir ||
                error "setstripe to subdir"
        $LFS setstripe -E 8M -E eof $parent/subdir/f3 || error "create f3"
@@ -609,9 +615,9 @@ test_15() {
                error "after write: start=1M, end=10M, flag=init, $found != 1"
 
        local ext_opts="--component-start -1M -E +5M"
-       # subdir, f3
+       # parent, subdir, f3, f4
        found=$($LFS find $ext_opts $parent | wc -l)
-       [ $found -eq 2 ] || error "start-1M, end+5M, $found != 2"
+       [ $found -eq 4 ] || error "start-1M, end+5M, $found != 4"
 
        local cnt_opts="--component-count +2"
        # subdir
@@ -623,13 +629,49 @@ test_15() {
        [ $found -eq 0 ] ||
                error "start-1M, end+5M, count+2, flag=init, $found != 0"
 
-       # f3
+       # f3, f4
        found=$($LFS find $ext_opts ! $cnt_opts $flg_opts $parent | wc -l)
-       [ $found -eq 1 ] ||
-               error "start-1M, end+5M, !count+2, flag=init, $found != 1"
+       [ $found -eq 2 ] ||
+               error "start-1M, end+5M, !count+2, flag=init, $found != 2"
 }
 run_test 15 "Verify component options for lfs find"
 
+test_17() {
+       [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
+       local file=$DIR/$tdir/$tfile
+       test_mkdir -p $DIR/$tdir
+       rm -f $file
+
+       $LFS setstripe -E1m -E2m -c2 -E-1 -c-1 $file ||
+               error "Create $file failed"
+
+       local s1=$($LFS getstripe -I1 -v $file | awk '/lcme_size:/{print $2}')
+       local s2=$($LFS getstripe -I2 -v $file | awk '/lcme_size:/{print $2}')
+       local s3=$($LFS getstripe -I3 -v $file | awk '/lcme_size:/{print $2}')
+       echo "1st init: comp size 1:$s1 2:$s2 3:$s3"
+
+       # init 2nd component
+       $TRUNCATE $file $((1024*1024+1))
+       local s1n=$($LFS getstripe -I1 -v $file | awk '/lcme_size:/{print $2}')
+       local s2n=$($LFS getstripe -I2 -v $file | awk '/lcme_size:/{print $2}')
+       echo "2nd init: comp size 1:$s1n 2:$s2n 3:$s3"
+
+       [ $s1 -eq $s1n ] || error "1st comp size $s1 should == $s1n"
+       [ $s2 -lt $s2n ] || error "2nd comp size $s2 should < $s2n"
+
+       # init 3rd component
+       $TRUNCATE $file $((1024*1024*2+1))
+       s1n=$($LFS getstripe -I1 -v $file | awk '/lcme_size:/{print $2}')
+       s2n=$($LFS getstripe -I2 -v $file | awk '/lcme_size:/{print $2}')
+       local s3n=$($LFS getstripe -I3 -v $file | awk '/lcme_size:/{print $2}')
+       echo "3rd init: comp size 1:$s1n 2:$s2n 3:$s3n"
+
+       [ $s1 -eq $s1n ] || error "1st comp size $s1 should == $s1n"
+       [ $s2 -lt $s2n ] || error "2nd comp size $s2 should < $s2n"
+       [ $s3 -lt $s3n ] || error "3rd comp size $s3 should < $s3n"
+}
+run_test 17 "Verify LOVEA grows with more component inited"
+
 complete $SECONDS
 check_and_cleanup_lustre
 exit_status