3 # Run select tests by setting ONLY, or as arguments to the script.
4 # Skip specific tests by setting EXCEPT.
9 LUSTRE=${LUSTRE:-$(dirname $0)/..}
10 . $LUSTRE/tests/test-framework.sh
14 # bug number for skipped test:
15 ALWAYS_EXCEPT="$SANITY_PFL_EXCEPT "
16 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
18 # Skip tests for PPC that fail frequently
19 if [[ $(uname -m) = ppc64 ]]; then
20 # bug number: LU-13186 LU-13205 LU-13207 LU-13186
21 ALWAYS_EXCEPT+=" 14 16a 16b 17"
24 if [[ "$ost1_FSTYPE" == "zfs" ]]; then
30 check_and_setup_lustre
32 if [[ "$MDS1_VERSION" -lt $(version_code 2.9.51) ]]; then
33 skip_env "Need MDS version at least 2.9.51"
36 [ $UID -eq 0 -a $RUNAS_ID -eq 0 ] &&
37 error "\$RUNAS_ID set to 0, but \$UID is also 0!"
38 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
41 rm -rf $DIR/[Rdfs][0-9]*
46 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
48 local comp_file=$DIR/$tdir/$tfile
49 local rw_len=$((3 * 1024 * 1024)) # 3M
54 $LFS setstripe -E 1m -S 1M -c 1 -E -1 -c 1 $comp_file ||
55 error "Create $comp_file failed"
57 #instantiate all components, so that objs are allocted
58 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=2k
60 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
61 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
63 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
65 small_write $comp_file $rw_len || error "Verify RW failed"
67 rm -f $comp_file || error "Delete $comp_file failed"
69 run_test 0a "Create full components file, no reused OSTs"
72 [[ $($LCTL get_param mdc.*.import |
73 grep "connect_flags:.*overstriping") ]] ||
74 skip "server does not support overstriping"
75 large_xattr_enabled || skip_env "no large xattr support"
79 local comp_file=$DIR/$tdir/$tfile
83 $LFS setstripe -E -1 -C $LOV_MAX_STRIPE_COUNT $comp_file ||
84 error "Create $comp_file failed"
86 local count=$($LFS getstripe -I1 -c $comp_file)
87 [ $count -eq $LOV_MAX_STRIPE_COUNT ] ||
88 error "stripe count of first component is shrinked to $count"
90 rm -f $comp_file || error "Delete $comp_file failed"
92 # Create file with 1.1*LOV_MAX_STRIPE_COUNT stripes should succeed
93 $LFS setstripe -E 1m -C $((LOV_MAX_STRIPE_COUNT / 10)) -E -1 \
94 -C $LOV_MAX_STRIPE_COUNT $comp_file ||
95 error "Create $comp_file failed"
97 local count=$($LFS getstripe -I2 -c $comp_file)
98 [ $count -eq $LOV_MAX_STRIPE_COUNT ] ||
99 error "stripe count of second component is shrinked to $count"
101 rm -f $comp_file || error "Delete $comp_file failed"
103 # Create file with 3*LOV_MAX_STRIPE_COUNT stripes should fail
104 $LFS setstripe -E 200G -C $LOV_MAX_STRIPE_COUNT \
105 -E 500G -C $LOV_MAX_STRIPE_COUNT \
106 -E -1 -C $LOV_MAX_STRIPE_COUNT $comp_file &&
107 error "Create $comp_file succeeded"
109 rm -f $comp_file || error "Delete $comp_file failed"
111 run_test 0b "Verify comp stripe count limits"
114 [[ $($LCTL get_param mdc.*.import |
115 grep "connect_flags:.*overstriping") ]] ||
116 skip "server does not support overstriping"
117 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
118 skip "skipped for lustre < $SEL_VER"
120 large_xattr_enabled || skip_env "no large xattr support"
124 local comp_file=$DIR/$tdir/$tfile
126 test_mkdir $DIR/$tdir
128 # extension size aligned to 64M and limit to 1G
129 $LFS setstripe -E-1 -S64K -C $LOV_MAX_STRIPE_COUNT \
130 -z $((64*1024*((LOV_MAX_STRIPE_COUNT+1023)>>10<<10))) \
131 $comp_file || error "Create $comp_file failed"
133 local count=$($LFS getstripe -I1 -c $comp_file)
134 [ $count -eq $LOV_MAX_STRIPE_COUNT ] ||
135 error "stripe count is shrinked to $count"
137 run_test 0c "Verify SEL comp stripe count limits"
140 (( $MDS1_VERSION > $(version_code 2.14.50.115) )) ||
141 skip_env "Need MDS version at least 2.14.50.115"
148 # Create parent directory
151 # Component end must be a multiple of stripe size
152 # and a multiple of 64KiB to align with the minimum
154 # Values below 4096 are assumed to be in KiB units.
155 $LFS setstripe -E 127 $tf-1 > /dev/null 2>&1 &&
156 error "creating $tf-1 with '-E 127' should fail"
158 $LFS setstripe -E 128 -S 512 $tf-1 > /dev/null 2>&1 &&
159 error "creating $tf-1 with '-E 128 -S 512' should fail"
161 $LFS setstripe -E 128 $tf-1 ||
162 error "creating $tf-1 failed"
164 yes | dd bs=1K count=129 iflag=fullblock of=$tf-1 &&
165 error "writing to $tf-1 should fail"
167 yes | dd bs=1K count=128 iflag=fullblock of=$tf-1 ||
168 error "writing to $tf-1 failed"
170 comp_end=$($LFS getstripe -I1 -E $tf-1)
171 stripe_size=$($LFS getstripe -I1 -S $tf-1)
173 [[ $comp_end == $((128 * 1024)) ]] ||
174 error "incorrect component end '$comp_end' for $tf-1"
176 [[ $stripe_size == $((128 * 1024)) ]] ||
177 error "incorrect stripe size '$stripe_size' for $tf-1"
179 rm $tf-1 || error "removing $tf-1 failed"
181 # The stripe size must be a multiple of 64KiB.
182 # Values below 4096 are assumed to be in KiB units.
183 $LFS setstripe -E -1 -S 2047 $tf-2 > /dev/null 2>&1 &&
184 error "creating $tf-2 with '-S 2047' should fail"
186 $LFS setstripe -E -1 -S 2048 $tf-2 ||
187 error "creating $tf-2 failed"
189 stripe_size=$($LFS getstripe -I1 -S $tf-2)
190 [[ $stripe_size == $((2048 * 1024)) ]] ||
191 error "incorrect stripe size '$stripe_size' for $tf-2"
193 rm $tf-2 || error "removing $tf-2 failed"
195 run_test 0d "Verify comp end and stripe size"
198 (( $MDS1_VERSION >= $(version_code 2.15.56.112) )) ||
199 skip "Need MDS version at least 2.15.56.112"
201 (( OSTCOUNT >= 2 )) || skip "needs >= 2 OSTs"
208 # component size 1M can only utilize 1 stripe
209 $LFS setstripe -E1M -S1M -c2 -Eeof -S1M -c2 $tf ||
210 error "failed to setstripe $tf"
212 local sc=$($LFS getstripe -I1 -c $tf)
215 error "expect 1 stripe count instread of $sc"
217 sc=$($LFS getstripe -I2 -c $tf)
220 error "expect 2 stripe count instread of $sc"
223 (( OSTCOUNT >= 3 )) || skip "needs >= 3 OSTs"
226 # component size 2M can only utilize 2 stripes
227 $LFS setstripe -E2M -S1M -c3 -Eeof -S1M -c3 $tf ||
228 error "failed to setstripe $tf"
229 sc=$($LFS getstripe -I1 -c $tf)
232 error "expect 2 stripe count instread of $sc"
234 sc=$($LFS getstripe -I2 -c $tf)
237 error "expect 3 stripe count instread of $sc"
241 # 2nd component size 11M and stripe_size 4M should cross 3 stripes
242 $LFS setstripe -E1M -S1M -c3 -E12M -S4M -c3 $tf ||
243 error "failed to setstripe $tf"
244 sc=$($LFS getstripe -I1 -c $tf)
247 error "expect 1 stripe count instread of $sc"
249 sc=$($LFS getstripe -I2 -c $tf)
252 error "expect 3 stripe count instread of $sc"
255 run_test 0e "lfs setstripe should limite stripe count for component size"
258 local comp_file=$DIR/$tdir/$tfile
259 local rw_len=$((3 * 1024 * 1024)) # 3M
261 test_mkdir $DIR/$tdir
264 $LFS setstripe -E 1m -S 1m -o 0 -E -1 -o 0 $comp_file ||
265 error "Create $comp_file failed"
267 #instantiate all components, so that objs are allocted
268 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=2k
270 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
271 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
273 [ $ost_idx1 -ne $ost_idx2 ] && error "$ost_idx1 != $ost_idx2"
275 small_write $comp_file $rw_len || error "Verify RW failed"
277 rm -f $comp_file || error "Delete $comp_file failed"
279 run_test 1a "Create full components file, reused OSTs"
281 # test overstriping (>1 stripe/OST within a component)
283 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
284 [[ $($LCTL get_param mdc.*.import |
285 grep "connect_flags:.*overstriping") ]] ||
286 skip "server does not support overstriping"
288 local comp_file=$DIR/$tdir/$tfile
289 local rw_len=$((3 * 1024 * 1024)) # 3M
291 test_mkdir $DIR/$tdir
293 $LFS setstripe -E 2m -S 1m -o 0,0 -E -1 -o 1,1,0,0 $comp_file ||
294 error "Create $comp_file failed"
296 #instantiate all components, so that objs are allocted
297 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=1M
299 $LFS getstripe $comp_file
300 local OSTS_1=$($LFS getstripe -I1 $comp_file | grep -o 'l_ost_idx.*' |
301 awk -e '{print $2}' | tr "\n" "\0")
302 local OSTS_2=$($LFS getstripe -I2 $comp_file | grep -o 'l_ost_idx.*' |
303 awk -e '{print $2}' | tr "\n" "\0")
307 [ "$OSTS_1" = "0,0," ] || error "incorrect OSTs($OSTS_1) in component 1"
308 [ "$OSTS_2" = "1,1,0,0," ] ||
309 error "incorrect OSTs($OSTS_2) in component 2"
311 small_write $comp_file $rw_len || error "Verify RW failed"
313 rm -f $comp_file || error "Delete $comp_file failed"
315 run_test 1b "Create full components file, overstriping in components"
317 # test overstriping with max stripe count
319 [[ $($LCTL get_param mdc.*.import |
320 grep "connect_flags:.*overstriping") ]] ||
321 skip "server does not support overstriping"
322 large_xattr_enabled || skip_env "no large xattr support"
326 local comp_file=$DIR/$tdir/$tfile
327 local rw_len=$((3 * 1024 * 1024)) # 3M
329 test_mkdir $DIR/$tdir
331 $LFS setstripe -E 10m -C 10 -E 110M -C 100 -E -1 \
332 -C $LOV_MAX_STRIPE_COUNT $comp_file ||
333 error "Create $comp_file failed"
335 # Seek & write in to last component so all objects are allocated
336 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=20000
338 local count=$($LFS getstripe -c -I1 $DIR/$tdir/$tfile)
339 [ $count -eq 10 ] || error "comp1 stripe count $count, should be 10"
340 count=$($LFS getstripe -c -I2 $DIR/$tdir/$tfile)
341 [ $count -eq 100 ] || error "comp2 stripe count $count, should be 100"
342 count=$($LFS getstripe -c -I3 $DIR/$tdir/$tfile)
343 [ $count -eq $LOV_MAX_STRIPE_COUNT ] ||
344 error "comp4 stripe count $count != $LOV_MAX_STRIPE_COUNT"
346 small_write $comp_file $rw_len || error "Verify RW failed"
348 rm -f $comp_file || error "Delete $comp_file failed"
350 run_test 1c "Test overstriping w/max stripe count"
353 local comp_file=$DIR/$tdir/$tfile
354 local rw_len=$((5 * 1024 * 1024)) # 5M
357 test_mkdir $DIR/$tdir
360 multiop $comp_file oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
361 error "create failed $comp_file"
363 $LFS setstripe --component-add $params $comp_file ||
364 error "Add component to $comp_file failed"
366 check_component_count $comp_file 1
368 dd if=/dev/zero of=$comp_file bs=1M count=1 > /dev/null 2>&1 ||
369 error "Write first component failed"
370 dd if=$comp_file of=/dev/null bs=1M count=1 > /dev/null 2>&1 ||
371 error "Read first component failed"
373 dd if=/dev/zero of=$comp_file bs=1M count=2 > /dev/null 2>&1 &&
374 error "Write beyond component should fail"
375 dd if=$comp_file of=/dev/null bs=1M count=2 > /dev/null 2>&1 ||
376 error "Read beyond component should short read, not fail"
378 $LFS setstripe --component-add -E 2M -S 1M -c 1 $comp_file ||
379 error "Add component to $comp_file failed"
381 check_component_count $comp_file 2
383 $LFS setstripe --component-add -E -1 -c 3 $comp_file ||
384 error "Add last component to $comp_file failed"
386 check_component_count $comp_file 3
388 small_write $comp_file $rw_len || error "Verify RW failed"
390 rm -f $comp_file || error "Delete $comp_file failed"
394 base_test_2 "-E 1m -S 1m"
396 run_test 2a "Add components to existing file"
399 base_test_2 "-E 1m -L mdt"
401 run_test 2b "Add components w/DOM to existing file"
403 del_comp_and_verify() {
410 if [ $id == "init" -o $id == "^init" ]; then
411 opt="--component-flags="
414 $LFS setstripe --component-del $opt$id $comp_file ||
415 error "Delete component $id from $comp_file failed"
417 local comp_cnt=$($LFS getstripe --component-count $comp_file)
418 if grep -q "has no stripe info" <<< "$comp_cnt" ; then
421 [ $comp_cnt -ne $left ] && error "$comp_cnt != $left"
423 $CHECKSTAT -s $size $comp_file || error "size != $size"
427 local comp_file=$DIR/$tdir/$tfile
430 test_mkdir $DIR/$tdir
433 $LFS setstripe $params $comp_file || error "Create $comp_file failed"
435 check_component_count $comp_file 3
437 dd if=/dev/zero of=$comp_file bs=1M count=2
439 $LFS setstripe --component-del -I 2 $comp_file &&
440 error "Component deletion makes hole"
442 del_comp_and_verify $comp_file 3 2 $((2 * 1024 * 1024))
443 del_comp_and_verify $comp_file 2 1 $((1 * 1024 * 1024))
444 del_comp_and_verify $comp_file 1 0 0
446 rm -f $comp_file || error "Delete $comp_file failed"
448 $LFS setstripe -E 1M -S 1M -E 16M -E -1 $comp_file ||
449 error "Create second $comp_file failed"
451 del_comp_and_verify $comp_file "^init" 1 0
452 del_comp_and_verify $comp_file "init" 0 0
453 rm -f $comp_file || error "Delete second $comp_file failed"
457 base_test_3 "-E 1M -S 1M -E 64M -c 2 -E -1 -c 3"
459 run_test 3a "Delete components from existing file"
462 base_test_3 "-E 1M -L mdt -E 64M -S 1M -c 2 -E -1 -c 3"
464 run_test 3b "Delete components w/DOM from existing file"
467 skip "Not supported in PFL"
468 # In PFL project, only LCME_FL_INIT is supported, and it can't
469 # be altered by application.
471 run_test 4 "Modify component flags in existing file"
474 local parent=$DIR/$tdir
475 local comp_file=$DIR/$tdir/$tfile
476 local subdir=$parent/subdir
481 # set default layout to parent directory
482 $LFS setstripe -E 64M -c 2 -i 0 -E -1 -c 4 -i 0 $parent ||
483 error "Set default layout to $parent failed"
485 # create file under parent
486 touch $comp_file || error "Create $comp_file failed"
487 check_component_count $comp_file 2
489 #instantiate all components, so that objs are allocted
490 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=65k
492 local ost_idx=$($LFS getstripe -I1 -i $comp_file)
493 [ $ost_idx -ne 0 ] &&
494 error "component 1 ost_idx $ost_idx != 0"
496 ost_idx=$($LFS getstripe -I2 -i $comp_file)
497 [ $ost_idx -ne 0 ] &&
498 error "component 2 ost_idx $ost_idx != 0"
500 # create subdir under parent
501 mkdir -p $subdir || error "Create subdir $subdir failed"
503 comp_cnt=$($LFS getstripe -d --component-count $subdir)
504 [ $comp_cnt -ne 2 ] && error "subdir $comp_cnt != 2"
506 # create file under subdir
507 touch $subdir/$tfile || error "Create $subdir/$tfile failed"
509 check_component_count $subdir/$tfile 2
511 # delete default layout setting from parent
512 $LFS setstripe -d $parent ||
513 error "Delete default layout from $parent failed"
515 comp_cnt=$($LFS getstripe -d --component-count $parent)
516 [ $comp_cnt -ne 0 ] && error "$comp_cnt isn't 0"
518 rm -f $comp_file || error "Delete $comp_file failed"
519 rm -f $subdir/$tfile || error "Delete $subdir/$tfile failed"
520 rm -r $subdir || error "Delete subdir $subdir failed"
521 rmdir $parent || error "Delete dir $parent failed"
523 run_test 5 "Inherit composite layout from parent directory"
526 local comp_file=$DIR/$tdir/$tfile
528 test_mkdir $DIR/$tdir
531 $LFS setstripe -c 1 -S 128K $comp_file ||
532 error "Create v1 $comp_file failed"
534 check_component_count $comp_file 0
536 dd if=/dev/urandom of=$comp_file bs=1M count=5 oflag=sync ||
537 error "Write to v1 $comp_file failed"
539 local old_chksum=$(md5sum $comp_file)
541 # Migrate v1 to composite
542 $LFS migrate -E 1M -S 512K -c 1 -E -1 -S 1M -c 2 $comp_file ||
543 error "Migrate(v1 -> composite) $comp_file failed"
545 check_component_count $comp_file 2
547 local chksum=$(md5sum $comp_file)
548 [ "$old_chksum" != "$chksum" ] &&
549 error "(v1 -> compsoite) $old_chksum != $chksum"
551 # Migrate composite to composite
552 $LFS migrate -E 1M -S 1M -c 2 -E 4M -S 1M -c 2 \
553 -E -1 -S 3M -c 3 $comp_file ||
554 error "Migrate(compsoite -> composite) $comp_file failed"
556 check_component_count $comp_file 3
558 chksum=$(md5sum $comp_file)
559 [ "$old_chksum" != "$chksum" ] &&
560 error "(composite -> compsoite) $old_chksum != $chksum"
562 # Migrate composite to v1
563 $LFS migrate -c 2 -S 2M $comp_file ||
564 error "Migrate(composite -> v1) $comp_file failed"
566 check_component_count $comp_file 0
568 chksum=$(md5sum $comp_file)
569 [ "$old_chksum" != "$chksum" ] &&
570 error "(composite -> v1) $old_chksum != $chksum"
572 rm -f $comp_file || error "Delete $comp_file failed"
574 run_test 6 "Migrate composite file"
577 test_mkdir $DIR/$tdir
578 chmod 0777 $DIR/$tdir || error "chmod $tdir failed"
580 local comp_file=$DIR/$tdir/$tfile
581 $RUNAS $LFS setstripe -E 1M -S 1M -c 1 $comp_file ||
582 error "Create composite file $comp_file failed"
584 $RUNAS $LFS setstripe --component-add -E 64M -c 4 $comp_file ||
585 error "Add component to $comp_file failed"
587 $RUNAS $LFS setstripe --component-del -I 2 $comp_file ||
588 error "Delete component from $comp_file failed"
590 $RUNAS $LFS setstripe --component-add -E -1 -c 5 $comp_file ||
591 error "Add last component to $comp_file failed"
593 rm $comp_file || error "Delete composite failed"
595 run_test 7 "Add/Delete/Create composite file by non-privileged user"
598 local parent=$DIR/$tdir
601 mkdir_on_mdt0 $parent
603 $LFS setstripe -E 2M -c 1 -S 1M -E 16M -c 2 -S 2M \
604 -E -1 -c 4 -S 4M $parent ||
605 error "Set default layout to $parent failed"
607 bash rundbench -C -D $parent 2 || error "dbench failed"
609 rm -fr $parent || error "Delete dir $parent failed"
611 run_test 8 "Run dbench over composite files"
614 local comp_file=$DIR/$tdir/$tfile
616 test_mkdir $DIR/$tdir
619 $LFS setstripe -E 1M -S 1M -E -1 -c 1 $comp_file ||
620 error "Create $comp_file failed"
622 check_component_count $comp_file 2
624 replay_barrier $SINGLEMDS
626 # instantiate the 2nd component
627 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=2k
629 local f1=$($LFS getstripe -I2 $comp_file |
630 awk '/l_fid:/ {print $7}')
631 echo "before MDS recovery, the ost fid of 2nd component is $f1"
634 local f2=$($LFS getstripe -I2 $comp_file |
635 awk '/l_fid:/ {print $7}')
636 echo "after MDS recovery, the ost fid of 2nd component is $f2"
637 [ "x$f1" == "x$f2" ] || error "$f1 != $f2"
639 run_test 9 "Replay layout extend object instantiation"
642 echo $($LFS getstripe $1 |
643 awk '$1 == "lcm_entry_count:" { printf("%d", $2) }
644 $1 == "lcme_extent.e_start:" { printf("[%#lx", $2) }
645 $1 == "lcme_extent.e_end:" { printf(",%s]", $2) }')
649 local parent=$DIR/$tdir
652 save_layout_restore_at_exit $MOUNT
656 # mount root on $MOUNT2 if FILESET is set
657 if [ -n "$FILESET" ]; then
658 FILESET="" mount_client $MOUNT2 ||
659 error "mount $MOUNT2 fail"
663 $LFS setstripe -d $root || error "clear root layout"
665 # set root composite layout
666 $LFS setstripe -E 2M -c 1 -S 1M -E 16M -c2 -S 2M \
667 -E -1 -c 4 -S 4M $root ||
668 error "Set root layout failed"
670 if [ "$root" == "$MOUNT2" ]; then
671 umount_client $MOUNT2 ||
672 error "umount $MOUNT2 fail"
676 # set a different layout for parent
677 $LFS setstripe -E -1 -c 1 -S 1M $parent ||
678 error "set $parent layout failed"
681 local f1_entry=$(component_dump $parent/file1)
683 # delete parent's layout
684 $LFS setstripe -d $parent || error "Clear $parent layout failed"
687 local f2_entry=$(component_dump $parent/file2)
689 # verify layout inheritance
691 local f1_expect="1[0,EOF]"
692 local f2_expect="3[0,2097152][0x200000,16777216][0x1000000,EOF]"
694 echo "f1 expect=$f1_expect"
695 echo "f1 get =$f1_entry"
696 echo "f2 expect=$f2_expect"
697 echo "f2 get =$f2_entry"
699 [ x$f1_expect != x$f1_entry ] &&
700 error "$parent/file1 does not inherite parent layout"
701 [ x$f2_expect != x$f2_entry ] &&
702 error "$parent/file2 does not inherite root layout"
706 run_test 10 "Inherit composite template from root"
709 local comp_file=$DIR/$tdir/$tfile
710 test_mkdir $DIR/$tdir
713 # only 1st component instantiated
714 $LFS setstripe -E 1M -S 1M -E 2M -E 3M -E -1 $comp_file ||
715 error "Create $comp_file failed"
717 local f1=$($LFS getstripe -I1 $comp_file | grep "l_fid")
718 [[ -z $f1 ]] && error "1: 1st component uninstantiated"
719 local f2=$($LFS getstripe -I2 $comp_file | grep "l_fid")
720 [[ -n $f2 ]] && error "1: 2nd component instantiated"
721 local f3=$($LFS getstripe -I3 $comp_file | grep "l_fid")
722 [[ -n $f3 ]] && error "1: 3rd component instantiated"
723 local f4=$($LFS getstripe -I4 $comp_file | grep "l_fid")
724 [[ -n $f4 ]] && error "1: 4th component instantiated"
726 # the first 2 components instantiated
727 # Truncate to exact start of new component - LU-12586
728 $TRUNCATE $comp_file $((1024*1024*1))
730 f2=$($LFS getstripe -I2 $comp_file | grep "l_fid")
731 [[ -z $f2 ]] && error "2: 2nd component uninstantiated"
732 f3=$($LFS getstripe -I3 $comp_file | grep "l_fid")
733 [[ -n $f3 ]] && error "2: 3rd component instantiated"
734 f4=$($LFS getstripe -I4 $comp_file | grep "l_fid")
735 [[ -n $f4 ]] && error "2: 4th component instantiated"
737 # the first 3 components instantiated
738 $TRUNCATE $comp_file $((1024*1024*3 - 1))
739 $TRUNCATE $comp_file $((1024*1024*1+1))
741 f2=$($LFS getstripe -I2 $comp_file | grep "l_fid")
742 [[ -z $f2 ]] && error "3: 2nd component uninstantiated"
743 f3=$($LFS getstripe -I3 $comp_file | grep "l_fid")
744 [[ -z $f3 ]] && error "3: 3rd component uninstantiated"
745 f4=$($LFS getstripe -I4 $comp_file | grep "l_fid")
746 [[ -n $f4 ]] && error "3: 4th component instantiated"
748 # all 4 components instantiated, using append write
749 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=2k
751 rwv -f $comp_file -w -a -n 2 $((1024*1023)) 1
754 f4=$($LFS getstripe -I4 $comp_file | grep "l_fid")
755 [[ -z $f4 ]] && error "4: 4th component uninstantiated"
759 run_test 11a "Verify component instantiation with write/truncate"
762 [ $OSTCOUNT -lt 4 ] && skip "needs >= 4 OSTs"
764 local file=$DIR/$tdir/$tfile
766 test_mkdir $DIR/$tdir
769 $LFS setstripe -E 1m -E 1g -c 4 -E eof $DIR/$tdir ||
770 error "setstripe dir $DIR/$tdir failed"
771 expand_truncate_test $file ||
772 error "expand_truncate_test failed on $file"
774 run_test 11b "truncate file set file size correctly"
777 [ $OSTCOUNT -lt 3 ] && skip "needs >= 3 OSTs"
779 local file=$DIR/$tdir/$tfile
780 test_mkdir $DIR/$tdir
783 # specify ost list for component
784 $LFS setstripe -E 2M -S 1M -c 2 -o 0,1 -E 4M -c 2 -o 1,2 \
785 -E 6M -c 2 -o 2,1 -E 8M -c 1 -i 2 -E -1 $file ||
786 error "Create $file failed"
788 # clear lod component cache
789 stop $SINGLEMDS || error "stop MDS"
790 local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
791 start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || error "start MDS"
793 # instantiate all components
794 $TRUNCATE $file $((1024*1024*8+1))
796 #verify object alloc order
797 local o1=$($LFS getstripe -I1 $file |
798 awk '/l_ost_idx:/ {printf("%d",$5)}')
799 [[ $o1 != "01" ]] && error "$o1 is not 01"
801 local o2=$($LFS getstripe -I2 $file |
802 awk '/l_ost_idx:/ {printf("%d",$5)}')
803 [[ $o2 != "12" ]] && error "$o2 is not 12"
805 local o3=$($LFS getstripe -I3 $file |
806 awk '/l_ost_idx:/ {printf("%d",$5)}')
807 [[ $o3 != "21" ]] && error "$o3 is not 21"
809 local o4=$($LFS getstripe -I4 $file |
810 awk '/l_ost_idx:/ {printf("%d",$5)}')
811 [[ $o4 != "2" ]] && error "$o4 is not 2"
815 run_test 12 "Verify ost list specification"
817 test_13() { # LU-9311
818 [ $OSTCOUNT -lt 8 ] && skip "needs >= 8 OSTs"
820 local file=$DIR/$tfile
822 local dd_size=$(($dd_count * 1024 * 1024))
826 $LFS setstripe -E 1M -S 1M -c 1 -E 2M -c 2 -E -1 -c -1 -i 1 $file ||
827 error "Create $file failed"
828 dd if=/dev/zero of=$file bs=1M count=$dd_count
829 real_size=$(stat -c %s $file)
830 [ $real_size -eq $dd_size ] ||
831 error "dd actually wrote $real_size != $dd_size bytes"
835 run_test 13 "shouldn't reprocess granted resent request"
838 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
839 local file=$DIR/$tdir/$tfile
840 test_mkdir -p $DIR/$tdir
843 $LFS setstripe -E1m -c1 -S1m --pool="pool1" -E2m \
844 -E4m -c2 -S2m --pool="pool2" -E-1 $file ||
845 error "Create $file failed"
847 # check --pool inheritance
849 pool="$($LFS getstripe -I2 --pool $file)"
850 [ x"$pool" != "xpool1" ] && $LFS getstripe -I2 $file &&
851 error "$file: component 2 doesn't have poolname pool1"
852 pool="$($LFS getstripe -I4 --pool $file)"
853 [ x"$pool" != "xpool2" ] && $LFS getstripe -I4 $file &&
854 error "$file: component 4 doesn't have poolname pool2"
856 #check --stripe-count inheritance
858 count="$($LFS getstripe -I2 -c $file)"
859 [ $count -ne 1 ] && $LFS getstripe -I2 $file &&
860 error "$file: component 2 doesn't have 1 stripe_count"
861 count="$($LFS getstripe -I4 -c $file)"
862 [ $count -ne 2 ] && $LFS getstripe -I4 $file &&
863 error "$file: component 4 doesn't have 2 stripe_count"
865 #check --stripe-size inheritance
867 size="$($LFS getstripe -I2 -S $file)"
868 [ $size -ne $((1024*1024)) ] && $LFS getstripe -I2 $file &&
869 error "$file: component 2 doesn't have 1M stripe_size"
870 size="$($LFS getstripe -I4 -S $file)"
871 [ $size -ne $((1024*1024*2)) ] && $LFS getstripe -I4 $file &&
872 error "$file: component 4 doesn't have 2M stripe_size"
876 run_test 14 "Verify setstripe poolname/stripe_count/stripe_size inheritance"
879 local parent=$DIR/$tdir
884 $LFS setstripe -d $parent || error "delete default layout"
886 $LFS setstripe -E 1M -S 1M -E 10M -E eof $parent/f1 || error "create f1"
887 $LFS setstripe -E 4M -E 20M -E eof $parent/f2 || error "create f2"
888 test_mkdir $parent/subdir
889 $LFS setstripe -E 6M -S 1M -c1 -E 30M -c4 -E eof -c $OSTCOUNT \
890 $parent/subdir || error "setstripe to subdir"
891 $LFS setstripe -E 8M -E eof $parent/subdir/f3 || error "create f3"
892 $LFS setstripe -c 1 $parent/subdir/f4 || error "create f4"
895 local found=$($LFS find --component-start +2M -E -15M $parent | wc -l)
896 [ $found -eq 0 ] || error "start+2M, end-15M, $found != 0"
899 found=$($LFS find --component-start +2M -E -35M $parent | wc -l)
900 [ $found -eq 2 ] || error "start+2M, end-35M, $found != 2"
903 found=$($LFS find --component-start +4M -E -eof $parent | wc -l)
904 [ $found -eq 1 ] || error "start+4M, end-eof, $found != 1"
906 local flg_opts="--component-flags init"
908 found=$($LFS find --component-start 1M -E 10M $flg_opts $parent | wc -l)
910 error "before write: start=1M, end=10M, flag=init, $found != 0"
912 dd if=/dev/zero of=$parent/f1 bs=1M count=2 ||
913 error "dd $parent/f1 failed"
916 found=$($LFS find --component-start 1M -E 10M $flg_opts $parent | wc -l)
918 error "after write: start=1M, end=10M, flag=init, $found != 1"
920 local ext_opts="--component-start -1M -E +5M"
921 # parent, subdir, f3, f4
922 found=$($LFS find $ext_opts $parent | wc -l)
923 [ $found -eq 4 ] || error "start-1M, end+5M, $found != 4"
925 local cnt_opts="--component-count +2"
927 found=$($LFS find $ext_opts $cnt_opts $parent | wc -l)
928 [ $found -eq 1 ] || error "start-1M, end+5M, count+2, $found != 1"
931 found=$($LFS find $ext_opts $cnt_opts $flg_opts $parent | wc -l)
933 error "start-1M, end+5M, count+2, flag=init, $found != 0"
936 found=$($LFS find $ext_opts ! $cnt_opts $flg_opts $parent | wc -l)
938 error "start-1M, end+5M, !count+2, flag=init, $found != 2"
940 # check last component stripe count
941 if [ $OSTCOUNT -gt 1 ]; then
942 touch $parent/subdir/f5
943 $TRUNCATE $parent/subdir/f5 $((32*1024*1024))
944 found=$($LFS find $parent/subdir -c $OSTCOUNT)
945 [[ "$found" == "$parent/subdir/f5" ]] ||
946 error "got '$found' with stripe_count=$OSTCOUNT, not f5"
949 run_test 15 "Verify component options for lfs find"
952 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
953 large_xattr_enabled || skip_env "ea_inode feature disabled"
955 local file=$DIR/$tdir/$tfile
956 local dir=$DIR/$tdir/dir
957 local temp=$DIR/$tdir/template
959 test_mkdir $DIR/$tdir
961 #####################################################################
963 # set stripe for source file
964 $LFS setstripe -E1m -S 1M -c2 -o0,1 -E2m -c2 -E3m -o1,0 -E4m -c1 -E-1 \
965 $file || error "Create $file failed"
968 verify_yaml_layout $file $file.copy $temp "1. PFL file"
970 #####################################################################
972 # set stripe for source file
974 $LFS setstripe -c2 -o0,1 -i1 $file || error "Create $file failed"
978 verify_yaml_layout $file $file.copy $temp "2. plain file"
980 #####################################################################
982 # set stripe for source dir
984 $LFS setstripe -E1m -S 1M -c2 -E2m -c1 -E-1 $dir ||
985 error "setstripe $dir failed"
989 verify_yaml_layout $dir $dir.copy $temp.dir "3. PFL dir"
991 #####################################################################
993 # set stripe for source dir
994 $LFS setstripe -c2 -i-1 $dir || error "setstripe $dir failed"
997 verify_yaml_layout $dir $dir.copy $temp.dir "4. plain dir"
999 run_test 16a "Verify setstripe/getstripe with YAML config file"
1002 [[ $($LCTL get_param mdc.*.import |
1003 grep "connect_flags:.*overstriping") ]] ||
1004 skip "server does not support overstriping"
1005 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1006 [[ $OSTCOUNT -ge $(($LOV_MAX_STRIPE_COUNT / 2)) ]] &&
1007 skip_env "too many osts, skipping"
1008 large_xattr_enabled || skip_env "ea_inode feature disabled"
1012 local file=$DIR/$tdir/$tfile
1013 local dir=$DIR/$tdir/dir
1014 local temp=$DIR/$tdir/template
1015 # We know OSTCOUNT < (LOV_MAX_STRIPE_COUNT / 2), so this is overstriping
1016 local large_count=$((LOV_MAX_STRIPE_COUNT / 2 + 10))
1019 test_mkdir $DIR/$tdir
1021 #####################################################################
1022 # 1. PFL file, overstriping in first comps
1023 # set stripe for source file
1024 $LFS setstripe -E1m -S 1M -o0,0 -E2m -o1,1 -E3m -C $large_count -E-1 \
1025 $file || error "Create $file failed"
1028 verify_yaml_layout $file $file.copy $temp "1. PFL file"
1030 #####################################################################
1031 # 2. plain file + overstriping
1032 # set stripe for source file
1034 $LFS setstripe -C $large_count -i1 $file || error "Create $file failed"
1037 echo "2. plain file"
1038 verify_yaml_layout $file $file.copy $temp "2. plain file"
1040 #####################################################################
1041 # 3. PFL dir + overstriping
1042 # set stripe for source dir
1044 $LFS setstripe -E1m -S 1M -o 0,0 -E2m -C $large_count -E-1 $dir ||
1045 error "setstripe $dir failed"
1047 test_mkdir $dir.copy
1049 verify_yaml_layout $dir $dir.copy $temp.dir "3. PFL dir"
1051 #####################################################################
1052 # 4. plain dir + overstriping
1053 # set stripe for source dir
1054 $LFS setstripe -C $large_count $dir || error "setstripe $dir failed"
1057 verify_yaml_layout $dir $dir.copy $temp.dir "4. plain dir"
1059 run_test 16b "Verify setstripe/getstripe with YAML config file + overstriping"
1062 (( $MDS1_VERSION >= $(version_code 2.13.53.205) )) ||
1063 skip "need MDS version at least 2.13.53.205"
1065 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1067 local file=$DIR/$tdir/$tfile
1068 local dir=$DIR/$tdir/dir
1069 local temp=$DIR/$tdir/template
1071 test_mkdir $DIR/$tdir
1073 #####################################################################
1075 # set stripe for source file
1076 $LFS setstripe -E256M -S 1M -c2 -o0,1 -z 64M -E-1 -o1,0 -z 128M \
1077 $file || error "Create $file failed"
1080 verify_yaml_layout $file $file.copy $temp "1. PFL file"
1082 #####################################################################
1084 # set stripe for source dir
1086 $LFS setstripe -E256M -S 1M -c2 -z 64M -E-1 -z 128M \
1087 $dir || error "setstripe $dir failed"
1089 test_mkdir $dir.copy
1090 echo "2. SEL template on dir"
1091 verify_yaml_layout $dir $dir.copy $temp.dir "2. PFL dir"
1093 run_test 16c "Verify setstripe/getstripe for SEL layout with YAML config file"
1096 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1098 local file=$DIR/$tdir/$tfile
1099 local dir=$DIR/$tdir/dir
1100 local temp=$DIR/$tdir/template
1102 test_mkdir $DIR/$tdir
1104 #####################################################################
1106 # set stripe for source file
1107 $LFS setstripe -E1m -L mdt -E-1 -o1,0 $file ||
1108 error "Create $file failed"
1111 verify_yaml_layout $file $file.copy $temp "1. DOM file"
1113 #####################################################################
1115 # set stripe for source dir
1117 $LFS setstripe -E1m -L mdt -E-1 -o1,0 $dir || error "Create $dir failed"
1119 test_mkdir $dir.copy
1121 verify_yaml_layout $dir $dir.copy $temp.dir "2. DOM dir"
1123 run_test 16d "Verify setstripe/getstripe for DOM layout with YAML config file"
1127 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1128 local file=$DIR/$tdir/$tfile
1129 test_mkdir -p $DIR/$tdir
1132 $LFS setstripe -E 1M -S 1M -E 3M -c 2 -E -1 -c -1 $file ||
1133 error "Create $file failed"
1135 local s1=$($LFS getstripe -I1 -v $file | awk '/lcme_size:/{print $2}')
1136 local s2=$($LFS getstripe -I2 -v $file | awk '/lcme_size:/{print $2}')
1137 local s3=$($LFS getstripe -I3 -v $file | awk '/lcme_size:/{print $2}')
1138 echo "1st init: comp size 1:$s1 2:$s2 3:$s3"
1140 # init 2nd component
1141 $TRUNCATE $file $((1024*1024+1))
1142 local s1n=$($LFS getstripe -I1 -v $file | awk '/lcme_size:/{print $2}')
1143 local s2n=$($LFS getstripe -I2 -v $file | awk '/lcme_size:/{print $2}')
1144 echo "2nd init: comp size 1:$s1n 2:$s2n 3:$s3"
1146 [ $s1 -eq $s1n ] || error "1st comp size $s1 should == $s1n"
1147 [ $s2 -lt $s2n ] || error "2nd comp size $s2 should < $s2n"
1149 # init 3rd component
1150 $TRUNCATE $file $((1024*1024*3+1))
1151 s1n=$($LFS getstripe -I1 -v $file | awk '/lcme_size:/{print $2}')
1152 s2n=$($LFS getstripe -I2 -v $file | awk '/lcme_size:/{print $2}')
1153 local s3n=$($LFS getstripe -I3 -v $file | awk '/lcme_size:/{print $2}')
1154 echo "3rd init: comp size 1:$s1n 2:$s2n 3:$s3n"
1156 [ $s1 -eq $s1n ] || error "1st comp size $s1 should == $s1n"
1157 [ $s2 -lt $s2n ] || error "2nd comp size $s2 should < $s2n"
1158 [ $s3 -lt $s3n ] || error "3rd comp size $s3 should < $s3n"
1160 run_test 17 "Verify LOVEA grows with more component inited"
1162 check_distribution() {
1166 local obj_min_one=$((OSTCOUNT - 1))
1168 objs=$($LFS getstripe $file |
1169 awk '/l_ost_idx:/ { print $5 }' | wc -l)
1170 let ave=$((objs / OSTCOUNT))
1172 # collect objects per OST distribution
1173 $LFS getstripe $file | awk '/l_ost_idx:/ { print $5 }' | tr -d "," |
1174 (inuse=( $(for i in $(seq 0 $obj_min_one); do echo 0; done) )
1176 let inuse[$O]=$((1 + ${inuse[$O]}))
1179 # verify object distribution varies no more than +-1
1180 for idx in $(seq 0 $obj_min_one); do
1181 let dif=$((${inuse[$idx]} - ave))
1183 if [ "$dif" -gt 1 ]; then
1184 echo "OST${idx}: ${inuse[$idx]} objects"
1185 error "bad distribution on OST${idx}"
1191 local file1=$DIR/${tfile}-1
1192 local file2=$DIR/${tfile}-2
1193 local file3=$DIR/${tfile}-3
1195 rm -f $file1 $file2 $file3
1197 $LFS setstripe -E 1m -S 1m $file1 ||
1198 error "Create $file1 failed"
1199 $LFS setstripe -E 1m -S 1m $file2 ||
1200 error "Create $file2 failed"
1201 $LFS setstripe -E 1m -S 1m $file3 ||
1202 error "Create $file3 failed"
1204 local objs=$((OSTCOUNT+1))
1205 for comp in $(seq 1 $OSTCOUNT); do
1206 $LFS setstripe --component-add -E $((comp+1))M -c 1 $file1 ||
1207 error "Add component to $file1 failed 2"
1208 $LFS setstripe --component-add -E $((comp+1))M -c 1 $file2 ||
1209 error "Add component to $file2 failed 2"
1210 $LFS setstripe --component-add -E $((comp+1))M -c 1 $file3 ||
1211 error "Add component to $file3 failed 2"
1214 $LFS setstripe --component-add -E -1 -c -1 $file1 ||
1215 error "Add component to $file1 failed 3"
1216 $LFS setstripe --component-add -E -1 -c -1 $file2 ||
1217 error "Add component to $file2 failed 3"
1218 $LFS setstripe --component-add -E -1 -c -1 $file3 ||
1219 error "Add component to $file3 failed 3"
1221 # Instantiate all components
1222 dd if=/dev/urandom of=$file1 bs=1M count=$((objs+1)) ||
1223 error "dd failed for $file1"
1224 dd if=/dev/urandom of=$file2 bs=1M count=$((objs+1)) ||
1225 error "dd failed for $file2"
1226 dd if=/dev/urandom of=$file3 bs=1M count=$((objs+1)) ||
1227 error "dd failed for $file3"
1229 check_distribution $file1
1230 check_distribution $file2
1231 check_distribution $file3
1234 run_test 18 "check component distribution"
1238 local already_created=${2:-0}
1239 local rw_len=$((3 * 1024 * 1024)) # 3M
1243 if [ $already_created != 1 ]; then
1244 test_mkdir -p $DIR/$tdir
1245 $LFS setstripe --extension-size 64M -c 1 -E -1 $comp_file ||
1246 error "Create $comp_file failed"
1249 # write past end of first component, so it is extended
1250 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=127 conv=notrunc ||
1251 error "dd to extend failed"
1253 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1254 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
1256 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
1257 [ $ost_idx2 -ne "-1" ] && error "second component init $ost_idx2"
1259 flg_opts="--comp-flags init"
1260 found=$($LFS find --comp-start 0 -E 128M $flg_opts $comp_file | wc -l)
1261 [ $found -eq 1 ] || error "Write: Extended first component not found"
1263 flg_opts="--comp-flags extension"
1264 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
1265 [ $found -eq 1 ] || error "Write: second component not found"
1267 found=$($LFS find -z 64M $comp_file | wc -l)
1268 [ $found -eq 1 ] || error "component not found by ext size"
1270 found=$($LFS find --extension-size +63M $comp_file | wc -l)
1271 [ $found -eq 1 ] || error "component not found by +ext size"
1273 found=$($LFS find --ext-size -65M $comp_file | wc -l)
1274 [ $found -eq 1 ] || error "component not found by -ext size"
1276 found=$($LFS find -z 65M $comp_file | wc -l)
1277 [ $found -eq 0 ] || error "component found by wrong ext size"
1279 found=$($LFS find -z +65M $comp_file | wc -l)
1280 [ $found -eq 0 ] || error "component found by wrong +ext size"
1282 found=$($LFS find -z -63M $comp_file | wc -l)
1283 [ $found -eq 0 ] || error "component found by wrong -ext size"
1285 found=$($LFS find ! -z 64M $comp_file | wc -l)
1286 [ $found -eq 0 ] || error "component found by negation of ext size"
1288 found=$($LFS find ! -z +63M $comp_file | wc -l)
1289 [ $found -eq 0 ] || error "component found by negation of +ext size"
1291 found=$($LFS find ! -z -65M $comp_file | wc -l)
1292 [ $found -eq 0 ] || error "component found by negation of -ext size"
1294 found=$($LFS find ! -z 65M $comp_file | wc -l)
1296 error "component not found by negation of wrong ext size"
1298 found=$($LFS find ! -z +65M $comp_file | wc -l)
1300 error "component not found by negation of wrong +ext size"
1302 found=$($LFS find ! -z -63M $comp_file | wc -l)
1304 error "component not found by negation of wrong -ext size"
1306 found=$($LFS find -S +1M $comp_file | wc -l)
1307 [ $found -eq 0 ] || error "component found by wrong +stripe size"
1309 found=$($LFS find -c 1 $comp_file | wc -l)
1310 [ $found -eq 1 ] || error "component not found by stripe count"
1312 small_write $comp_file $rw_len || error "Verify RW failed"
1314 sel_layout_sanity $comp_file 2
1317 # Self-extending PFL tests
1319 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1320 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1321 skip "skipped for lustre < $SEL_VER"
1323 test19_io_base $DIR/$tdir/$tfile
1325 run_test 19a "Simple test of extension behavior"
1327 # Same as 19a, but with default layout set on directory rather than on file
1329 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1330 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1331 skip "skipped for lustre < $SEL_VER"
1333 local comp_file=$DIR/$tdir/$tfile
1334 local comp_dir=$DIR/$tdir/$tdir
1338 test_mkdir -p $DIR/$tdir
1339 $LFS setstripe --ext-size 64M -c 1 -E -1 $DIR/$tdir ||
1340 error "Setstripe on $DIR/$tdir failed"
1342 # check inheritance for a sub-dir and a file
1343 test_mkdir $comp_dir
1344 found=$($LFS find --comp-start 0 -E 64M $comp_dir | wc -l)
1345 [ $found -eq 1 ] || error "Dir Inheritance: wrong first component size"
1347 flg_opts="--comp-flags extension"
1348 found=$($LFS find --comp-start 64M -E EOF $flg_opts $comp_dir | wc -l)
1349 [ $found -eq 1 ] || error "Dir Inheritance: Second component not found"
1353 flg_opts="--comp-flags init"
1354 found=$($LFS find --comp-start 0 -E 64M $flg_opts $comp_file | wc -l)
1355 [ $found -eq 1 ] || error "File Inheritance: wrong first component size"
1357 flg_opts="--comp-flags extension"
1358 found=$($LFS find --comp-start 64M -E EOF $flg_opts $comp_file | wc -l)
1359 [ $found -eq 1 ] || error "File Inheritance: Second component not found"
1361 test19_io_base $comp_file 1
1363 run_test 19b "Simple test of SEL as default layout"
1365 # Test behavior when seeking deep in a file
1367 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1368 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1369 skip "skipped for lustre < $SEL_VER"
1371 local comp_file=$DIR/$tdir/$tfile
1375 test_mkdir -p $DIR/$tdir
1377 $LFS setstripe -z 128M -E 1G -E -1 $comp_file ||
1378 error "Create $comp_file failed"
1380 # write past end of first component, so it is extended
1381 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=130 conv=notrunc ||
1382 error "dd to extend failed"
1384 flg_opts="--comp-flags init"
1385 found=$($LFS find --comp-start 0M -E 256M $flg_opts $comp_file | wc -l)
1386 [ $found -eq 1 ] || error "Write: first extension component not found"
1388 flg_opts="--comp-flags extension,^init"
1389 found=$($LFS find --comp-start 256M -E 1024M $flg_opts $comp_file |\
1391 [ $found -eq 1 ] || error "Write: second extension component not found"
1393 local end_1=$($LFS getstripe -I1 -E $comp_file)
1396 [ $end_1 -eq 268435456 ] ||
1397 error "end of first component $end_1 != 268435456"
1399 # Write past end of extension space component, in to normal component
1400 # should exhaust & remove extension component
1401 dd if=/dev/zero bs=1M count=1 seek=1100 of=$comp_file conv=notrunc ||
1402 error "dd distant seek failed"
1404 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1405 # the last component index is 3
1406 local ost_idx2=$($LFS getstripe -I3 -i $comp_file)
1408 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
1410 local start1=$($LFS getstripe -I1 --comp-start $comp_file)
1411 local end1=$($LFS getstripe -I1 -E $comp_file)
1412 local start2=$($LFS getstripe -I3 --comp-start $comp_file)
1413 local end2=$($LFS getstripe -I3 -E $comp_file)
1415 [ $start1 -eq 0 ] || error "start of first component incorrect"
1416 [ $end1 -eq 1073741824 ] || error "end of first component incorrect"
1417 [ $start2 -eq 1073741824 ] ||
1418 error "start of second component incorrect"
1419 [ "$end2" = "EOF" ] || error "end of second component incorrect"
1421 flg_opts="--comp-flags extension"
1422 found=$($LFS find $flg_opts $comp_file | wc -l)
1423 [ $found -eq 0 ] || error "Seek Write: extension component exists"
1425 sel_layout_sanity $comp_file 2
1427 run_test 19c "Test self-extending layout seeking behavior"
1430 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1431 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1432 skip "skipped for lustre < $SEL_VER"
1434 local comp_file=$DIR/$tdir/$tfile
1438 test_mkdir -p $DIR/$tdir
1440 $LFS setstripe -E 128M -c 1 -z 64M -E -1 $comp_file ||
1441 error "Create $comp_file failed"
1443 # This will cause component 1 to be extended to 128M, then the
1444 # extension space component will be removed
1445 dd if=/dev/zero of=$comp_file bs=130M count=1 ||
1446 error "dd to extend failed"
1448 flg_opts="--comp-flags init"
1449 found=$($LFS find --comp-start 0M -E 128M $flg_opts $comp_file | wc -l)
1450 [ $found -eq 1 ] || error "Write: first component not found"
1452 flg_opts="--comp-flags init"
1453 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
1454 [ $found -eq 1 ] || error "Write: second component not found"
1456 sel_layout_sanity $comp_file 2
1458 # always remove large files in case of DO_CLEANUP=false
1459 rm -f $comp_file || error "Delete $comp_file failed"
1461 run_test 19d "Test write which completely spans extension space component"
1466 local comp2_flags=$($LFS getstripe -I2 --comp-flags $comp_file)
1467 local comp3_flags=$($LFS getstripe -I3 --comp-flags $comp_file)
1469 [ "$comp2_flags" != "init" ] && error "$comp2_flags != init"
1470 [ "$comp3_flags" != "extension" ] && error "$comp3_flags != extension"
1472 local flg_opts=" --comp-start 2M -E 66M --comp-flags init"
1473 local found=$($LFS find $flg_opts $comp_file | wc -l)
1474 [ $found -eq 1 ] || error "Write: extended second component not found"
1476 flg_opts="--comp-start 66M -E EOF --comp-flags extension"
1477 found=$($LFS find $flg_opts $comp_file | wc -l)
1478 [ $found -eq 1 ] || error "Write: third component not found"
1480 sel_layout_sanity $comp_file 3
1484 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1485 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1486 skip "skipped for lustre < $SEL_VER"
1488 local comp_file=$DIR/$tdir/$tfile
1489 local rw_len=$((3 * 1024 * 1024)) # 3M
1493 test_mkdir -p $DIR/$tdir
1495 $LFS setstripe -E 2m -E -1 -z 64M $comp_file ||
1496 error "Create $comp_file failed"
1498 replay_barrier $SINGLEMDS
1500 #instantiate & extend second component
1501 dd if=/dev/zero of=$comp_file bs=4M count=1 ||
1502 error "dd to extend failed"
1504 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
1505 local ost_idx3=$($LFS getstripe -I3 -i $comp_file)
1507 [ $ost_idx2 -eq $ost_idx3 ] && error "$ost_idx2 == $ost_idx3"
1508 [ $ost_idx3 -ne "-1" ] && error "third component init $ost_idx3"
1510 test_19e_check $comp_file
1512 local f1=$($LFS getstripe -I2 $comp_file | awk '/l_fid:/ {print $7}')
1513 echo "before MDS recovery, the ost fid of 2nd component is $f1"
1517 local f2=$($LFS getstripe -I2 $comp_file | awk '/l_fid:/ {print $7}')
1518 echo "after MDS recovery, the ost fid of 2nd component is $f2"
1519 [ "x$f1" == "x$f2" ] || error "$f1 != $f2"
1521 # simply repeat all previous checks, but also verify components are on
1522 # the same OST as before
1524 local ost_idx2_2=$($LFS getstripe -I2 -i $comp_file)
1525 local ost_idx3_2=$($LFS getstripe -I3 -i $comp_file)
1527 [ $ost_idx2_2 -eq $ost_idx3_2 ] && error "$ost_idx2_2 == $ost_idx3_2"
1528 [ $ost_idx3_2 -ne "-1" ] && error "second component init $ost_idx3_2"
1530 # verify OST id is the same after failover
1531 [ $ost_idx2 -ne $ost_idx2_2 ] &&
1532 error "$ost_idx2 != $ost_idx2_2, changed after failover"
1534 test_19e_check $comp_file
1536 run_test 19e "Replay of layout instantiation & extension"
1539 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1540 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1541 skip "skipped for lustre < $SEL_VER"
1543 local comp_file=$DIR/$tdir/$tfile
1547 test_mkdir -p $DIR/$tdir
1549 $LFS setstripe -E 256M --comp-flags extension -E -1 $comp_file
1551 [ $? != 0 ] || error "should not be able to manually set extension flag"
1554 run_test 19f "Rejection of invalid layouts"
1557 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1558 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1559 skip "skipped for lustre < $SEL_VER"
1561 local file1=$DIR/${tfile}-1
1562 local file2=$DIR/${tfile}-2
1564 test_mkdir -p $DIR/$tdir
1565 multiop $file1 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
1566 error "create failed $file1"
1567 multiop $file2 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
1568 error "create failed $file2"
1570 $LFS setstripe --component-add -E 1G -c 1 $file1 ||
1571 error "comp-add [0,1G] failed $file1"
1572 $LFS setstripe --component-add -E 512M -z 128M $file1 &&
1573 error "comp-add [1G,1G],SEL[1G,512M] succeded $file1"
1574 $LFS setstripe --component-add -E 10G -z 128M $file1 ||
1575 error "comp-add [1G,1G],SEL[1G,10G] failed $file1"
1576 $LFS setstripe --component-add -E -1 $file1 ||
1577 error "comp-add [10G,-1] failed $file1"
1579 $LFS setstripe --component-add -E 1G -z 32M -c 1 $file2 &&
1580 error "comp-add with smal ext size succeeded $file1"
1581 $LFS setstripe --component-add -E 1G -z 100M -c 1 $file2 &&
1582 error "comp-add with not aligned ext size succeeded $file1"
1583 $LFS setstripe --component-add -E 1G -z 128M -c 1 $file2 ||
1584 error "comp-add [0,128M],SEL[128M,1G] failed $file1"
1585 $LFS setstripe --component-add -E 10G $file2 ||
1586 error "comp-add [1G,10G] failed $file1"
1587 $LFS setstripe --component-add -E -1 -z 128M -c 1 $file2 ||
1588 error "comp-add [10G,10G],SEL[10G,-1] failed $file1"
1589 $LFS setstripe --component-add -E -1 -z 128M -c 1 $file2 &&
1590 error "repeated comp-add [10G,10G],SEL[10G,-1] succeeded $file1"
1592 $LFS getstripe $file1
1593 flg_opts="--comp-flags init"
1594 found=$($LFS find --comp-start 0 -E 1G $flg_opts $file1 | wc -l)
1595 [ $found -eq 1 ] || error "First component not found $file1"
1597 flg_opts="--comp-flags ^init"
1598 found=$($LFS find --comp-start 1G -E 1G $flg_opts $file1 | wc -l)
1599 [ $found -eq 1 ] || error "Second component not found $file1"
1601 flg_opts="--comp-flags ^init,extension"
1602 found=$($LFS find --comp-start 1G -E 10G $flg_opts $file1 | wc -l)
1603 [ $found -eq 1 ] || error "Third component not found $file1"
1605 flg_opts="--comp-flags ^init"
1606 found=$($LFS find --comp-start 10G -E EOF $flg_opts $file1 | wc -l)
1607 [ $found -eq 1 ] || error "Fourth component not found $file1"
1609 $LFS getstripe $file2
1610 flg_opts="--comp-flags init"
1611 found=$($LFS find --comp-start 0 -E 128M $flg_opts $file2 | wc -l)
1612 [ $found -eq 1 ] || error "First component not found $file2"
1614 flg_opts="--comp-flags extension"
1615 found=$($LFS find --comp-start 128M -E 1G $flg_opts $file2 | wc -l)
1616 [ $found -eq 1 ] || error "Second component not found $file2"
1618 flg_opts="--comp-flags ^init"
1619 found=$($LFS find --comp-start 1G -E 10G $flg_opts $file2 | wc -l)
1620 [ $found -eq 1 ] || error "Third component not found $file2"
1622 flg_opts="--comp-flags ^init"
1623 found=$($LFS find --comp-start 10G -E 10G $flg_opts $file2 | wc -l)
1624 [ $found -eq 1 ] || error "Fourth component not found $file2"
1626 flg_opts="--comp-flags ^init,extension"
1627 found=$($LFS find --comp-start 10G -E EOF $flg_opts $file2 | wc -l)
1628 [ $found -eq 1 ] || error "Fifth component not found $file2"
1630 run_test 19g "component-add behaviour"
1632 # Test out of space behavior
1634 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1635 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1636 skip "skipped for lustre < $SEL_VER"
1638 local comp_file=$DIR/$tdir/$tfile
1642 test_mkdir -p $DIR/$tdir
1644 # without this, a previous delete can finish after we check free space
1645 wait_delete_completed
1648 # First component is on OST0
1649 $LFS setstripe -E 256M -i 0 -z 64M -E -1 -z 128M $comp_file ||
1650 error "Create $comp_file failed"
1652 # write past end of first component, so it is extended
1653 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=66 ||
1654 error "dd to extend failed"
1656 flg_opts="--comp-flags extension"
1657 found=$($LFS find --comp-start 128M -E 256M $flg_opts $comp_file |wc -l)
1658 [ $found -eq 1 ] || error "Write: Second component not found"
1660 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1661 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
1663 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
1665 flg_opts="--comp-flags extension"
1666 # Write past current init comp, but we won't extend (because no space)
1667 dd if=/dev/zero of=$comp_file bs=1M count=10 seek=200 ||
1668 error "dd write past current comp failed"
1670 $LFS getstripe $comp_file
1672 flg_opts="--comp-flags init"
1673 found=$($LFS find --comp-start 128M -E 256M $flg_opts $comp_file | \
1675 [ $found -eq 1 ] || error "Write: third component not found"
1677 flg_opts="--comp-flags extension"
1678 found=$($LFS find --comp-start 256M -E EOF $flg_opts $comp_file |wc -l)
1679 [ $found -eq 1 ] || error "Write: fourth extension component not found"
1681 sel_layout_sanity $comp_file 3
1683 run_test 20a "Test out of space, spillover to defined component"
1686 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1687 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1688 skip "skipped for lustre < $SEL_VER"
1690 local comp_file=$DIR/$tdir/$tfile
1694 test_mkdir -p $DIR/$tdir
1696 # Pool allows us to force use of only certain OSTs
1697 pool_add $TESTNAME || error "Pool creation failed"
1698 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
1700 # normal component to 10M, extendable component to 1G
1701 # further extendable to EOF
1702 $LFS setstripe -E 10M -E 1G -p $TESTNAME -z 64M -E -1 -p "" -z 128M \
1703 $comp_file || error "Create $comp_file failed"
1705 replay_barrier $SINGLEMDS
1707 found=$($LFS find --comp-start 10M -E 10M $flg_opts $comp_file | wc -l)
1708 [ $found -eq 1 ] || error "Zero length component not found"
1711 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
1713 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
1715 # write past end of first component
1716 # This should remove the next component, since OST0 is out of space
1717 # and it is striped there (pool contains only OST0)
1718 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=14 ||
1719 error "dd to extend/remove failed"
1721 $LFS getstripe $comp_file
1723 found=$($LFS find --comp-start 10M -E 10M $flg_opts $comp_file | wc -l)
1724 [ $found -eq 0 ] || error "Write: zero length component still present"
1726 flg_opts="--comp-flags init"
1727 found=$($LFS find --comp-start 10M -E 138M $flg_opts $comp_file | wc -l)
1728 [ $found -eq 1 ] || error "Write: second component not found"
1730 flg_opts="--comp-flags extension"
1731 found=$($LFS find --comp-start 138M -E EOF $flg_opts $comp_file | wc -l)
1732 [ $found -eq 1 ] || error "Write: third component not found"
1736 found=$($LFS find --comp-start 10M -E 10M $flg_opts $comp_file | wc -l)
1737 [ $found -eq 0 ] || error "Failover: 0-length component still present"
1739 flg_opts="--comp-flags init"
1740 found=$($LFS find --comp-start 10M -E 138M $flg_opts $comp_file | wc -l)
1741 [ $found -eq 1 ] || error "Failover: second component not found"
1743 flg_opts="--comp-flags extension"
1744 found=$($LFS find --comp-start 138M -E EOF $flg_opts $comp_file | wc -l)
1745 [ $found -eq 1 ] || error "Failover: third component not found"
1747 sel_layout_sanity $comp_file 3
1749 run_test 20b "Remove component without instantiation when there is no space"
1752 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1753 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1754 skip "skipped for lustre < $SEL_VER"
1756 local comp_file=$DIR/$tdir/$tfile
1760 test_mkdir -p $DIR/$tdir
1762 # pool is used to limit available OSTs to 0 and 1, so we can set all
1763 # available OSTs out of space
1764 pool_add $TESTNAME || error "Pool creation failed"
1765 pool_add_targets $TESTNAME 0 1 || error "Pool add targets failed"
1767 # without this, a previous delete can finish after we check free space
1768 wait_delete_completed
1771 $LFS setstripe -E 100M -E -1 -p $TESTNAME -z 64M $comp_file ||
1772 error "Create $comp_file failed"
1776 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
1778 local wms2=$(ost_watermarks_set_enospc $tfile $ost_idx2 |
1780 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
1781 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx2 $wms2" EXIT
1783 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=120 &&
1784 error "dd should fail with ENOSPC"
1786 flg_opts="--comp-flags init"
1787 found=$($LFS find --comp-start 0M -E 100M $flg_opts $comp_file | wc -l)
1788 [ $found -eq 1 ] || error "Write: First component not found"
1790 flg_opts="--comp-flags ^init"
1791 found=$($LFS find --comp-start 100M -E 100M $flg_opts $comp_file |wc -l)
1792 [ $found -eq 1 ] || error "Write: 0-length component not found"
1794 flg_opts="--comp-flags extension"
1795 found=$($LFS find --comp-start 100M -E EOF $flg_opts $comp_file | wc -l)
1796 [ $found -eq 1 ] || error "Write: third extension component not found"
1798 sel_layout_sanity $comp_file 3
1800 run_test 20c "Test inability to stripe new extension component"
1803 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1804 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1805 skip "skipped for lustre < $SEL_VER"
1807 local comp_file=$DIR/$tdir/$tfile
1808 test_mkdir -p $DIR/$tdir
1810 wait_delete_completed
1813 pool_add $TESTNAME || error "Pool creation failed"
1814 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
1815 $LFS setstripe -E 64m -E -1 -p $TESTNAME -z 64M $comp_file ||
1816 error "Create $comp_file failed"
1818 replay_barrier $SINGLEMDS
1820 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
1821 dd if=/dev/zero bs=1M count=1 seek=100 of=$comp_file
1824 ost_watermarks_clear_enospc $tfile 0 $wms
1825 [ $RC -eq 0 ] || error "dd failed: $RC"
1827 $LFS getstripe $comp_file
1828 local flg_opts="--comp-start 64M -E 128M --comp-flags init"
1829 local found=$($LFS find $flg_opts $comp_file | wc -l)
1830 [ $found -eq 1 ] || error "Write: component (64M-128M) not found"
1832 local ost_idx=$($LFS getstripe -I3 -i $comp_file)
1833 [ "$ost_idx" != "-1" ] && error "Write: EXT component disappeared"
1837 found=$($LFS find $flg_opts $comp_file | wc -l)
1838 [ $found -eq 1 ] || error "Failover: component (64M-128M) not found"
1840 ost_idx=$($LFS getstripe -I3 -i $comp_file)
1841 [ "$ost_idx" != "-1" ] && error "Failover: EXT component disappeared"
1843 sel_layout_sanity $comp_file 3
1845 run_test 20d "Low on space + 0-length comp: force extension"
1848 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1849 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1850 skip "skipped for lustre < $SEL_VER"
1852 local comp_file=$DIR/$tdir/$tfile
1853 test_mkdir -p $DIR/$tdir
1855 wait_delete_completed
1858 pool_add $TESTNAME || error "Pool creation failed"
1859 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
1861 $LFS setstripe -E 64m -E 640M -z 64M -p $TESTNAME -E -1 $comp_file ||
1862 error "Create $comp_file failed"
1864 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
1866 dd if=/dev/zero bs=1M count=1 seek=100 of=$comp_file
1869 ost_watermarks_clear_enospc $tfile 0 $wms
1870 [ $RC -eq 0 ] || error "dd failed $RC"
1872 $LFS getstripe $comp_file
1873 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
1874 local found=$($LFS find $flg_opts $comp_file | wc -l)
1875 [ $found -eq 1 ] || error "Write: component (64M-EOF) not found"
1877 local ost_idx=$($LFS getstripe -I2 -i $comp_file)
1878 [ "$ost_idx" != "" ] && error "Write: 0-length component still exists"
1879 ost_idx=$($LFS getstripe -I3 -i $comp_file)
1880 [ "$ost_idx" != "" ] && error "Write: extension component still exists"
1882 sel_layout_sanity $comp_file 2
1884 run_test 20e "ENOSPC with next real comp: spillover and backward extension"
1886 # Simple DoM interaction test
1888 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1889 skip "skipped for lustre < $SEL_VER"
1891 local comp_file=$DIR/$tdir/$tfile
1895 test_mkdir -p $DIR/$tdir
1897 # simple, correct self-extending layout after DoM component
1898 $LFS setstripe -E 1M -L mdt -E -1 -z 64m $comp_file || \
1899 error "Create $comp_file failed"
1901 # Write to DoM component & to self-extending comp after it
1902 dd if=/dev/zero bs=1M count=12 of=$comp_file ||
1903 error "dd to extend failed"
1905 flg_opts="--comp-flags init"
1906 found=$($LFS find --comp-start 1M -E 65M $flg_opts $comp_file | wc -l)
1907 [ $found -eq 1 ] || error "Write: extended component not found"
1909 flg_opts="--comp-flags extension"
1910 found=$($LFS find --comp-start 65M $flg_opts $comp_file | wc -l)
1911 [ $found -eq 1 ] || error "Write: extension component not found"
1913 sel_layout_sanity $comp_file 3
1915 run_test 21a "Simple DoM interaction tests"
1917 # DoM + extension + removal
1919 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1920 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1921 skip "skipped for lustre < $SEL_VER"
1923 local comp_file=$DIR/$tdir/$tfile
1924 local ost_name=$(ostname_from_index 0)
1928 test_mkdir -p $DIR/$tdir
1930 # DoM, extendable component, further extendable component
1931 $LFS setstripe -E 1M -L mdt -E 256M -i 0 -z 64M -E -1 -z 128M \
1932 $comp_file || error "Create $comp_file failed"
1934 found=$($LFS find --comp-start 1M -E 1M $flg_opts $comp_file | wc -l)
1935 [ $found -eq 1 ] || error "Write: Zero length component not found"
1937 # This also demonstrates that we will avoid degraded OSTs
1938 do_facet ost1 $LCTL set_param -n obdfilter.$ost_name.degraded=1
1939 # sleep to guarantee we see the degradation
1942 # un-degrade on exit
1943 stack_trap "do_facet ost1 $LCTL set_param -n \
1944 obdfilter.$ost_name.degraded=0; sleep_maxage" EXIT
1946 # This should remove the first component after DoM and spill over to
1948 dd if=/dev/zero bs=1M count=2 of=$comp_file ||
1949 error "dd to remove+spill over failed"
1951 found=$($LFS find --comp-start 1M -E 1M $flg_opts $comp_file | wc -l)
1952 [ $found -eq 0 ] || error "Write: Zero length component still present"
1954 flg_opts="--comp-flags init"
1955 found=$($LFS find --comp-start 1M -E 129M $flg_opts $comp_file | wc -l)
1956 [ $found -eq 1 ] || error "Write: extended component not found"
1958 flg_opts="--comp-flags extension"
1959 found=$($LFS find --comp-start 129M -E EOF $flg_opts $comp_file |wc -l)
1960 [ $found -eq 1 ] || error "Write: extension component not found"
1962 sel_layout_sanity $comp_file 3
1964 run_test 21b "DoM followed by extendable component with removal"
1966 # Test of repeat component behavior with OOS/degraded OST
1968 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1969 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1970 skip "skipped for lustre < $SEL_VER"
1972 local comp_file=$DIR/$tdir/$tfile
1976 test_mkdir -p $DIR/$tdir
1978 $LFS setstripe -E -1 -c 1 -z 128M $comp_file ||
1979 error "Create $comp_file failed"
1981 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1982 local ost_name=$(ostname_from_index $ost_idx1)
1984 # write past end of first component, so it is extended
1985 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=130 ||
1986 error "dd to extend failed"
1988 flg_opts="--comp-flags extension"
1989 found=$($LFS find --comp-start 256M -E EOF $flg_opts $comp_file | wc -l)
1990 [ $found -eq 1 ] || error "Write: second component not found"
1992 # degrade OST for component 1
1993 do_facet ost$((ost_idx1+1)) $LCTL set_param -n \
1994 obdfilter.$ost_name.degraded=1
1995 # sleep to guarantee we see the degradation
1998 # un-degrade on exit
1999 stack_trap "do_facet ost$((ost_idx1+1)) $LCTL set_param -n \
2000 obdfilter.$ost_name.degraded=0; sleep_maxage" EXIT
2002 replay_barrier $SINGLEMDS
2004 # seek past the end of current comp & write, should cause a new comp
2005 # to be created (ie repeat previous comp)
2006 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=300 ||
2007 error "dd to repeat failed"
2009 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
2011 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
2013 flg_opts="--comp-flags init"
2014 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
2015 [ $found -eq 1 ] || error "Write: second component not found"
2017 flg_opts="--comp-flags extension"
2018 found=$($LFS find --comp-start 384M -E EOF $flg_opts $comp_file | wc -l)
2019 [ $found -eq 1 ] || error "Write: extension component not found"
2023 local ost_idx2_2=$($LFS getstripe -I2 -i $comp_file)
2024 [ $ost_idx2_2 -ne $ost_idx2 ] && error "$ost_idx2_2 != $ost_idx2"
2026 flg_opts="--comp-flags init"
2027 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
2028 [ $found -eq 1 ] || error "Failover: second component not found"
2030 flg_opts="--comp-flags extension"
2031 found=$($LFS find --comp-start 384M -E EOF $flg_opts $comp_file | wc -l)
2032 [ $found -eq 1 ] || error "Failover: extension component not found"
2034 sel_layout_sanity $comp_file 3
2036 run_test 22a "Test repeat component behavior with degraded OST"
2038 # Test repeat behavior with low space
2040 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2041 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2042 skip "skipped for lustre < $SEL_VER"
2044 local comp_file=$DIR/$tdir/$tfile
2048 test_mkdir -p $DIR/$tdir
2050 # without this, a previous delete can finish after we check free space
2051 wait_delete_completed
2054 $LFS setstripe -E -1 -c 1 -z 128M \
2055 $comp_file || error "Create $comp_file failed"
2057 # write past end of first component, so it is extended
2058 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=130 ||
2059 error "dd to extend failed"
2061 flg_opts="--comp-flags extension"
2062 found=$($LFS find --comp-start 256M -E EOF $flg_opts $comp_file | wc -l)
2063 [ $found -eq 1 ] || error "Write: Second component not found"
2065 # set our OST low on space
2066 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
2067 local wms=$(ost_watermarks_set_low_space $ost_idx1 | grep "watermarks")
2069 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
2071 # Write past end of current space, fail to extend, causing repeat
2072 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=300 ||
2073 error "dd to repeat failed"
2075 $LFS getstripe $comp_file
2077 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
2079 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
2081 flg_opts="--comp-flags init"
2082 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
2083 [ $found -eq 1 ] || error "Write: Second component not found"
2085 flg_opts="--comp-flags extension"
2086 found=$($LFS find --comp-start 384M -E EOF $flg_opts $comp_file | wc -l)
2087 [ $found -eq 1 ] || error "Write: Extension component not found"
2089 sel_layout_sanity $comp_file 3
2091 run_test 22b "Test simple 'out of space' condition with repeat"
2093 # This tests both "repeat" and "extend in place when repeat fails" aspects
2094 # of repeating components
2096 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2097 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2098 skip "skipped for lustre < $SEL_VER"
2100 local comp_file=$DIR/$tdir/$tfile
2104 test_mkdir -p $DIR/$tdir
2106 # pool is used to limit available OSTs to 0 and 1, so we can set all
2107 # available OSTs out of space
2108 pool_add $TESTNAME || error "Pool creation failed"
2109 pool_add_targets $TESTNAME 0 1 || error "Pool add targets failed"
2111 # without this, a previous delete can finish after we check free space
2112 wait_delete_completed
2115 $LFS setstripe -E -1 -z 64M -c 1 -p "$TESTNAME" $comp_file || \
2116 error "Create $comp_file failed"
2118 # write past end of first component, so it is extended
2119 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=80 conv=notrunc ||
2120 error "dd to extend failed"
2122 $LFS getstripe $comp_file
2124 flg_opts="--comp-flags extension"
2125 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
2126 [ $found -eq 1 ] || error "Write: second component not found"
2128 # set our OST out of space
2129 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
2130 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
2132 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
2134 # This should create a repeat component on a new OST
2135 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=180 conv=notrunc ||
2136 error "dd to repeat failed"
2138 $LFS getstripe $comp_file
2140 local comp_cnt=$($LFS getstripe --component-count $comp_file)
2141 [ $comp_cnt -ne 3 ] && error "component count: $comp_cnt, should be 3"
2143 # New second component should be on a different OST
2144 local ost_idx2=$($LFS getstripe --comp-start=128m \
2145 --comp-end=192m --comp-flags=init -i $comp_file)
2147 [ $ost_idx1 -eq $ost_idx2 ] && error "2nd comp: same OST $ost_idx1"
2149 local wms2=$(ost_watermarks_set_enospc $tfile $ost_idx2 |
2151 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx2 $wms2" EXIT
2153 # now that the second OST is out of space (as is the first OST), we
2154 # attempt to extend. This should result in an extension of the
2155 # existing component, rather than a new component.
2156 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=240 conv=notrunc ||
2157 error "dd for forced extension failed"
2159 $LFS getstripe $comp_file
2161 # clear out of space on first OST
2162 ost_watermarks_clear_enospc $tfile $ost_idx1 $wms
2164 # finally, now that the first OST has space again, we attempt to
2165 # extend one last time. This should create a new component on the
2167 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=300 conv=notrunc ||
2168 error "dd for repeat on first OST failed"
2170 $LFS getstripe $comp_file
2172 flg_opts="--comp-flags init"
2173 found=$($LFS find --comp-start 128M $flg_opts $comp_file | wc -l)
2174 [ $found -eq 1 ] || error "Write: second component not found"
2176 flg_opts="--comp-flags init"
2177 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
2178 [ $found -eq 1 ] || error "Write: third component not found"
2180 flg_opts="--comp-flags extension"
2181 found=$($LFS find --comp-start 320M -E EOF $flg_opts $comp_file | wc -l)
2182 [ $found -eq 1 ] || error "Write: extension component not found"
2184 sel_layout_sanity $comp_file 4
2186 run_test 22c "Test repeat with out of space on > 1 OST"
2188 test_22d_post_check() {
2191 local flg_opts="--comp-flags init"
2192 local found=$($LFS find --comp-start 0M -E 128M $flg_opts $comp_file |
2194 [ $found -eq 1 ] || {
2195 $LFS getstripe $comp_file
2196 error "$name: second component not found"
2199 flg_opts="--comp-flags extension"
2200 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
2201 [ $found -eq 1 ] || error "$name: third extension component not found"
2203 sel_layout_sanity $comp_file 2
2211 # write past end of first component
2212 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=70
2215 ost_watermarks_clear_enospc $tfile 0 $wms
2216 [ $RC -eq 0 ] || error "dd to force extend failed"
2218 test_22d_post_check $comp_file "Write"
2222 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2223 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2224 skip "skipped for lustre < $SEL_VER"
2226 local comp_file=$DIR/$tdir/$tfile
2230 test_mkdir -p $DIR/$tdir
2232 # without this, a previous delete can finish after we check free space
2233 wait_delete_completed
2236 # Pool allows us to force use of only certain OSTs
2237 pool_add $TESTNAME || error "Pool creation failed"
2238 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
2240 # 1. Fail to extend due to OOS, try to repeat within the same pool,
2241 # fail to stripe (again OOS) the 0-length component, remove the
2242 # repeated one, force the extension on the original one.
2243 $LFS setstripe -E -1 -p $TESTNAME -z 64M $comp_file ||
2244 error "Create $comp_file failed"
2246 replay_barrier $SINGLEMDS
2248 # set our OST out of space
2249 local wms=$(ost_watermarks_set_enospc $tfile 0 | grep "watermarks")
2251 test_22d_pre $comp_file "$wms"
2253 test_22d_post_check $comp_file "Failover"
2255 # 2. repeat with low on space: 0-length repeated component will be
2256 # striped, but still fails to be extended; otherwise the same as (1).
2258 $LFS setstripe -E -1 -p $TESTNAME -z 64M $comp_file ||
2259 error "Create $comp_file failed"
2261 replay_barrier $SINGLEMDS
2263 # set our OST low on space
2264 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
2266 test_22d_pre $comp_file "$wms"
2268 test_22d_post_check $comp_file "Failover"
2270 run_test 22d "out of/low on space + failed to repeat + forced extension"
2273 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2274 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2275 skip "skipped for lustre < $SEL_VER"
2277 local comp_file=$DIR/$tdir/$tfile
2278 test_mkdir -p $DIR/$tdir
2280 $LFS setstripe -z 64M -c 1 -E -1 $comp_file ||
2281 error "Create $comp_file failed"
2283 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file ||
2284 error "dd append failed"
2286 local flg_opts="--comp-start 0 -E EOF --comp-flags init"
2287 local found=$($LFS find $flg_opts $comp_file | wc -l)
2288 [ $found -eq 1 ] || error "Append: first component (0-EOF) not found"
2290 local ost_idx=$($LFS getstripe -I2 -i $comp_file)
2291 [ "$ost_idx" != "" ] && error "Append: second component still exists"
2293 sel_layout_sanity $comp_file 1
2295 run_test 23a "Append: remove EXT comp"
2298 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2299 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2300 skip "skipped for lustre < $SEL_VER"
2302 local comp_file=$DIR/$tdir/$tfile
2303 test_mkdir -p $DIR/$tdir
2305 $LFS setstripe -E 64m -E -1 -z 64M $comp_file ||
2306 error "Create $comp_file failed"
2308 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file ||
2309 error "dd append failed"
2311 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2312 local found=$($LFS find $flg_opts $comp_file | wc -l)
2313 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2315 local ost_idx=$($LFS getstripe -I3 -i $comp_file)
2316 [ "$ost_idx" != "" ] && error "Append: third component still exists"
2318 sel_layout_sanity $comp_file 2
2320 run_test 23b "Append with 0-length comp: remove EXT comp"
2323 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2324 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2325 skip "skipped for lustre < $SEL_VER"
2327 local comp_file=$DIR/$tdir/$tfile
2328 test_mkdir -p $DIR/$tdir
2330 wait_delete_completed
2333 pool_add $TESTNAME || error "Pool creation failed"
2334 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
2335 $LFS setstripe -E 64m -E -1 -p $TESTNAME -z 64M $comp_file ||
2336 error "Create $comp_file failed"
2338 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
2339 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file
2342 ost_watermarks_clear_enospc $tfile 0 $wms
2343 [ $RC -eq 0 ] || error "dd append failed: $RC"
2345 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2346 local found=$($LFS find $flg_opts $comp_file | wc -l)
2347 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2349 local ost_idx=$($LFS getstripe -I3 -i $comp_file)
2350 [ "$ost_idx" != "" ] && error "Append: EXT component still exists"
2352 sel_layout_sanity $comp_file 2
2354 run_test 23c "Append with low on space + 0-length comp: force extension"
2357 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2358 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2359 skip "skipped for lustre < $SEL_VER"
2361 local comp_file=$DIR/$tdir/$tfile
2362 test_mkdir -p $DIR/$tdir
2364 $LFS setstripe -E 64m -E 640M -z 64M -E -1 $comp_file ||
2365 error "Create $comp_file failed"
2367 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file ||
2368 error "dd append failed"
2370 flg_opts="--comp-start 64M -E 640M --comp-flags init"
2371 found=$($LFS find $flg_opts $comp_file | wc -l)
2372 [ $found -eq 1 ] || error "Append: component (64M-640M) not found"
2374 ost_idx=$($LFS getstripe -I3 -i $comp_file)
2375 [ "$ost_idx" != "" ] && error "Append: third component still exists"
2377 sel_layout_sanity $comp_file 3
2379 run_test 23d "Append with 0-length comp + next real comp: remove EXT comp"
2382 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2383 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2384 skip "skipped for lustre < $SEL_VER"
2386 local comp_file=$DIR/$tdir/$tfile
2387 test_mkdir -p $DIR/$tdir
2389 wait_delete_completed
2392 pool_add $TESTNAME || error "Pool creation failed"
2393 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
2395 $LFS setstripe -E 64m -E 640M -z 64M -p $TESTNAME -E -1 $comp_file ||
2396 error "Create $comp_file failed"
2398 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
2400 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file
2403 ost_watermarks_clear_enospc $tfile 0 $wms
2404 [ $RC -eq 0 ] || error "dd append failed $RC"
2406 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2407 local found=$($LFS find $flg_opts $comp_file | wc -l)
2408 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2410 local ost_idx=$($LFS getstripe -I2 -i $comp_file)
2411 [ "$ost_idx" != "" ] && error "Append: 0-length component still exists"
2412 ost_idx=$($LFS getstripe -I3 -i $comp_file)
2413 [ "$ost_idx" != "" ] && error "Append: extension component still exists"
2415 sel_layout_sanity $comp_file 2
2417 run_test 23e "Append with next real comp: spillover and backward extension"
2420 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2421 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2422 skip "skipped for lustre < $SEL_VER"
2424 local comp_file=$DIR/$tdir/$tfile
2425 test_mkdir -p $DIR/$tdir
2427 $LFS setstripe -z 64M -c 1 -E -1 $comp_file ||
2428 error "Create $comp_file failed"
2430 local ost_idx=$($LFS getstripe -I1 -i $comp_file)
2431 local wms=$(ost_watermarks_set_low_space $ost_idx | grep "watermarks")
2433 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file
2436 ost_watermarks_clear_enospc $tfile $ost_idx $wms
2437 [ $RC -eq 0 ] || error "dd append failed"
2439 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2440 local found=$($LFS find $flg_opts $comp_file | wc -l)
2441 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2443 ost_idx=$($LFS getstripe -I2 -i $comp_file)
2444 [ "$ost_idx" != "" ] && error "Append: extension component still exists"
2446 sel_layout_sanity $comp_file 2
2448 run_test 23f "Append with low on space: repeat and remove EXT comp"
2457 [ "$OSTCOUNT" -lt "3" ] && skip_env "needs >= 3 OSTs"
2459 trap cleanup_24 EXIT RETURN
2461 local file=$DIR/$tfile
2463 $LFS setstripe -E 1m -c1 -o0 -E eof -c2 -o1,2 $file ||
2464 error "setstripe on $file"
2466 dd if=/dev/zero of=$file bs=1M count=3 || error "dd failed for $file"
2469 filefrag -ves $file || error "filefrag $file failed"
2470 filefrag_op=$(filefrag -ve -k $file |
2471 sed -n '/ext:/,/found/{/ext:/d; /found/d; p}')
2473 #Filesystem type is: bd00bd0
2474 #File size of /mnt/lustre/f24a.sanity-pfl is 3145728 (3072 blocks of 1024 bytes)
2475 # ext: device_logical: physical_offset: length: dev: flags:
2476 # 0: 0.. 1023: 1572864.. 1573887: 1024: 0000: net
2477 # 1: 0.. 1023: 1572864.. 1573887: 1024: 0002: net
2478 # 2: 1024.. 2047: 1573888.. 1574911: 1024: 0001: last,net
2479 #/mnt/lustre/f24a.sanity-pfl: 3 extents found
2481 last_lun=$(echo $filefrag_op | cut -d: -f5)
2486 for line in $filefrag_op; do
2487 frag_lun=$(echo $line | cut -d: -f5)
2488 ext_len=$(echo $line | cut -d: -f4)
2489 if [[ "$frag_lun" != "$last_lun" ]]; then
2490 if (( tot_len != 1024 )); then
2492 error "$file: OST$last_lun $tot_len != 1024"
2498 (( tot_len += ext_len ))
2501 if (( num_luns != 3 || tot_len != 1024 )); then
2503 error "$file: $num_luns != 3, $tot_len != 1024 on OST$last_lun"
2506 echo "FIEMAP on $file succeeded"
2508 run_test 24a "FIEMAP upon PFL file"
2511 local pfl_f=$DIR/$tdir/"$tfile"_pfl
2512 local dom_f=$DIR/$tdir/"$tfile"_dom
2513 local common_f=$DIR/$tdir/"$tfile"_common
2517 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2518 $LFS setstripe -E 10M -S 64k -c -1 -E 20M -S 1M -E -1 -S 2M -c 1 \
2519 $pfl_f || error "setstripe $pfl_f failed"
2520 $LFS setstripe -E 256k -L mdt -E -1 -S 1M $dom_f ||
2521 error "setstripe $dom_f failed"
2522 $LFS setstripe -S 512K -c -1 $common_f ||
2523 error "setstripe $common_f failed"
2525 #verify lov_getstripe_old with PFL file
2526 stripe_count=$(lov_getstripe_old $pfl_f |
2527 awk '/stripe_count/ { print $2 }')
2528 stripe_size=$(lov_getstripe_old $pfl_f |
2529 awk '/stripe_size/ { print $2 }')
2530 [ $stripe_count -eq 1 ] ||
2531 error "stripe_count $stripe_count !=1 for $pfl_f"
2532 [ $stripe_size -eq 2097152 ] ||
2533 error "stripe_size $stripe_size != 2097152 for $pfl_f"
2535 #verify lov_getstripe_old with DoM file
2536 stripe_count=$(lov_getstripe_old $dom_f |
2537 awk '/stripe_count/ { print $2 }')
2538 stripe_size=$(lov_getstripe_old $dom_f |
2539 awk '/stripe_size/ { print $2 }')
2540 [ $stripe_count -eq 1 ] ||
2541 error "stripe_count $stripe_count !=1 for $dom_f"
2542 [ $stripe_size -eq 1048576 ] ||
2543 error "stripe_size $stripe_size != 1048576 for $dom_f"
2545 #verify lov_getstripe_old with common file
2546 stripe_count=$(lov_getstripe_old $common_f |
2547 awk '/stripe_count/ { print $2 }')
2548 stripe_size=$(lov_getstripe_old $common_f |
2549 awk '/stripe_size/ { print $2 }')
2550 [ $stripe_count -eq $OSTCOUNT ] ||
2551 error "stripe_count $stripe_count !=$OSTCOUNT for $common_f"
2552 [ $stripe_size -eq 524288 ] ||
2553 error "stripe_size $stripe_size != 524288 for $common_f"
2555 run_test 25 "Verify old lov stripe API with PFL files"
2558 $LFS setstripe -E 1m -S 1M -c 1 $DIR/$tfile
2559 dd if=/dev/urandom bs=1M count=10 >> $DIR/$tfile
2560 [ $? != 0 ] || error "append must return an error"
2562 run_test 26a "Append to not-existent component"
2565 $LFS setstripe -E 1m -S 1M -c 1 $DIR/$tfile
2566 dd if=/dev/urandom bs=1M count=1 > $DIR/$tfile
2567 dd if=/dev/urandom bs=1M count=1 >> $DIR/$tfile
2568 [ $? != 0 ] || error "append must return an error"
2570 run_test 26b "Append to not-existend component, file size is unknown"
2573 $LFS setstripe -E 1m -S 1M -c 1 $DIR/$tfile
2574 dd if=/dev/urandom bs=2M count=1 >> $DIR/$tfile
2575 [ $? != 0 ] || error "append must return an error"
2577 run_test 26c "Append to not-existend component, crossing the component border"
2580 [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] ||
2581 skip "server does not support overstriping"
2582 (( $MDS1_VERSION >= $(version_code 2.15.55.102) )) ||
2583 skip "need MDS >= 2.12.55.102 for mdt_dump_lmm fix"
2585 stack_trap "rm -f $DIR/$tfile"
2586 # start_full_debug_logging
2587 $LFS setstripe -S 64K -C -1 $DIR/$tfile || error "create $tfile failed"
2588 $LFS getstripe -c $DIR/$tfile || error "getstripe $tfile failed"
2590 $LFS getstripe -c $DIR/$tfile || error "getstripe failed after clear"
2592 test_mkdir $DIR/$tdir
2593 stack_trap "rm -rf $DIR/$tdir/$tfile"
2594 $LFS setstripe -S 64K -C -1 $DIR/$tdir || error "mkdir $tdir failed"
2595 $LFS getstripe -y $DIR/$tdir || error "getstripe $tdir failed"
2596 touch $DIR/$tdir/$tfile || error "create $tdir/$tfile failed"
2598 $LFS getstripe -c $DIR/$tdir/$tfile ||
2599 error "getstripe $tdir/$tfile failed"
2600 #stop_full_debug_logging
2602 run_test 27 "overstriping with -C -1 in mdt_dump_lmm"
2604 complete_test $SECONDS
2605 check_and_cleanup_lustre