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 (( OSTCOUNT >= 2 )) || skip "needs >= 2 OSTs"
205 # component size 1M can only utilize 1 stripe
206 $LFS setstripe -E1M -S1M -c2 -Eeof -S1M -c2 $tf ||
207 error "failed to setstripe $tf"
209 local sc=$($LFS getstripe -I1 -c $tf)
212 error "expect 1 stripe count instread of $sc"
214 sc=$($LFS getstripe -I2 -c $tf)
217 error "expect 2 stripe count instread of $sc"
220 (( OSTCOUNT >= 3 )) || skip "needs >= 3 OSTs"
223 # component size 2M can only utilize 2 stripes
224 $LFS setstripe -E2M -S1M -c3 -Eeof -S1M -c3 $tf ||
225 error "failed to setstripe $tf"
226 sc=$($LFS getstripe -I1 -c $tf)
229 error "expect 2 stripe count instread of $sc"
231 sc=$($LFS getstripe -I2 -c $tf)
234 error "expect 3 stripe count instread of $sc"
238 # 2nd component size 11M and stripe_size 4M should cross 3 stripes
239 $LFS setstripe -E1M -S1M -c3 -E12M -S4M -c3 $tf ||
240 error "failed to setstripe $tf"
241 sc=$($LFS getstripe -I1 -c $tf)
244 error "expect 1 stripe count instread of $sc"
246 sc=$($LFS getstripe -I2 -c $tf)
249 error "expect 3 stripe count instread of $sc"
252 run_test 0e "lfs setstripe should limite stripe count for component size"
255 local comp_file=$DIR/$tdir/$tfile
256 local rw_len=$((3 * 1024 * 1024)) # 3M
258 test_mkdir $DIR/$tdir
261 $LFS setstripe -E 1m -S 1m -o 0 -E -1 -o 0 $comp_file ||
262 error "Create $comp_file failed"
264 #instantiate all components, so that objs are allocted
265 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=2k
267 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
268 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
270 [ $ost_idx1 -ne $ost_idx2 ] && error "$ost_idx1 != $ost_idx2"
272 small_write $comp_file $rw_len || error "Verify RW failed"
274 rm -f $comp_file || error "Delete $comp_file failed"
276 run_test 1a "Create full components file, reused OSTs"
278 # test overstriping (>1 stripe/OST within a component)
280 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
281 [[ $($LCTL get_param mdc.*.import |
282 grep "connect_flags:.*overstriping") ]] ||
283 skip "server does not support overstriping"
285 local comp_file=$DIR/$tdir/$tfile
286 local rw_len=$((3 * 1024 * 1024)) # 3M
288 test_mkdir $DIR/$tdir
290 $LFS setstripe -E 2m -S 1m -o 0,0 -E -1 -o 1,1,0,0 $comp_file ||
291 error "Create $comp_file failed"
293 #instantiate all components, so that objs are allocted
294 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=1M
296 $LFS getstripe $comp_file
297 local OSTS_1=$($LFS getstripe -I1 $comp_file | grep -o 'l_ost_idx.*' |
298 awk -e '{print $2}' | tr "\n" "\0")
299 local OSTS_2=$($LFS getstripe -I2 $comp_file | grep -o 'l_ost_idx.*' |
300 awk -e '{print $2}' | tr "\n" "\0")
304 [ "$OSTS_1" = "0,0," ] || error "incorrect OSTs($OSTS_1) in component 1"
305 [ "$OSTS_2" = "1,1,0,0," ] ||
306 error "incorrect OSTs($OSTS_2) in component 2"
308 small_write $comp_file $rw_len || error "Verify RW failed"
310 rm -f $comp_file || error "Delete $comp_file failed"
312 run_test 1b "Create full components file, overstriping in components"
314 # test overstriping with max stripe count
316 [[ $($LCTL get_param mdc.*.import |
317 grep "connect_flags:.*overstriping") ]] ||
318 skip "server does not support overstriping"
319 large_xattr_enabled || skip_env "no large xattr support"
323 local comp_file=$DIR/$tdir/$tfile
324 local rw_len=$((3 * 1024 * 1024)) # 3M
326 test_mkdir $DIR/$tdir
328 $LFS setstripe -E 10m -C 10 -E 110M -C 100 -E -1 \
329 -C $LOV_MAX_STRIPE_COUNT $comp_file ||
330 error "Create $comp_file failed"
332 # Seek & write in to last component so all objects are allocated
333 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=20000
335 local count=$($LFS getstripe -c -I1 $DIR/$tdir/$tfile)
336 [ $count -eq 10 ] || error "comp1 stripe count $count, should be 10"
337 count=$($LFS getstripe -c -I2 $DIR/$tdir/$tfile)
338 [ $count -eq 100 ] || error "comp2 stripe count $count, should be 100"
339 count=$($LFS getstripe -c -I3 $DIR/$tdir/$tfile)
340 [ $count -eq $LOV_MAX_STRIPE_COUNT ] ||
341 error "comp4 stripe count $count != $LOV_MAX_STRIPE_COUNT"
343 small_write $comp_file $rw_len || error "Verify RW failed"
345 rm -f $comp_file || error "Delete $comp_file failed"
347 run_test 1c "Test overstriping w/max stripe count"
350 local comp_file=$DIR/$tdir/$tfile
351 local rw_len=$((5 * 1024 * 1024)) # 5M
354 test_mkdir $DIR/$tdir
357 multiop $comp_file oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
358 error "create failed $comp_file"
360 $LFS setstripe --component-add $params $comp_file ||
361 error "Add component to $comp_file failed"
363 check_component_count $comp_file 1
365 dd if=/dev/zero of=$comp_file bs=1M count=1 > /dev/null 2>&1 ||
366 error "Write first component failed"
367 dd if=$comp_file of=/dev/null bs=1M count=1 > /dev/null 2>&1 ||
368 error "Read first component failed"
370 dd if=/dev/zero of=$comp_file bs=1M count=2 > /dev/null 2>&1 &&
371 error "Write beyond component should fail"
372 dd if=$comp_file of=/dev/null bs=1M count=2 > /dev/null 2>&1 ||
373 error "Read beyond component should short read, not fail"
375 $LFS setstripe --component-add -E 2M -S 1M -c 1 $comp_file ||
376 error "Add component to $comp_file failed"
378 check_component_count $comp_file 2
380 $LFS setstripe --component-add -E -1 -c 3 $comp_file ||
381 error "Add last component to $comp_file failed"
383 check_component_count $comp_file 3
385 small_write $comp_file $rw_len || error "Verify RW failed"
387 rm -f $comp_file || error "Delete $comp_file failed"
391 base_test_2 "-E 1m -S 1m"
393 run_test 2a "Add components to existing file"
396 base_test_2 "-E 1m -L mdt"
398 run_test 2b "Add components w/DOM to existing file"
400 del_comp_and_verify() {
407 if [ $id == "init" -o $id == "^init" ]; then
408 opt="--component-flags="
411 $LFS setstripe --component-del $opt$id $comp_file ||
412 error "Delete component $id from $comp_file failed"
414 local comp_cnt=$($LFS getstripe --component-count $comp_file)
415 if grep -q "has no stripe info" <<< "$comp_cnt" ; then
418 [ $comp_cnt -ne $left ] && error "$comp_cnt != $left"
420 $CHECKSTAT -s $size $comp_file || error "size != $size"
424 local comp_file=$DIR/$tdir/$tfile
427 test_mkdir $DIR/$tdir
430 $LFS setstripe $params $comp_file || error "Create $comp_file failed"
432 check_component_count $comp_file 3
434 dd if=/dev/zero of=$comp_file bs=1M count=2
436 $LFS setstripe --component-del -I 2 $comp_file &&
437 error "Component deletion makes hole"
439 del_comp_and_verify $comp_file 3 2 $((2 * 1024 * 1024))
440 del_comp_and_verify $comp_file 2 1 $((1 * 1024 * 1024))
441 del_comp_and_verify $comp_file 1 0 0
443 rm -f $comp_file || error "Delete $comp_file failed"
445 $LFS setstripe -E 1M -S 1M -E 16M -E -1 $comp_file ||
446 error "Create second $comp_file failed"
448 del_comp_and_verify $comp_file "^init" 1 0
449 del_comp_and_verify $comp_file "init" 0 0
450 rm -f $comp_file || error "Delete second $comp_file failed"
454 base_test_3 "-E 1M -S 1M -E 64M -c 2 -E -1 -c 3"
456 run_test 3a "Delete components from existing file"
459 base_test_3 "-E 1M -L mdt -E 64M -S 1M -c 2 -E -1 -c 3"
461 run_test 3b "Delete components w/DOM from existing file"
464 skip "Not supported in PFL"
465 # In PFL project, only LCME_FL_INIT is supported, and it can't
466 # be altered by application.
468 run_test 4 "Modify component flags in existing file"
471 local parent=$DIR/$tdir
472 local comp_file=$DIR/$tdir/$tfile
473 local subdir=$parent/subdir
478 # set default layout to parent directory
479 $LFS setstripe -E 64M -c 2 -i 0 -E -1 -c 4 -i 0 $parent ||
480 error "Set default layout to $parent failed"
482 # create file under parent
483 touch $comp_file || error "Create $comp_file failed"
484 check_component_count $comp_file 2
486 #instantiate all components, so that objs are allocted
487 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=65k
489 local ost_idx=$($LFS getstripe -I1 -i $comp_file)
490 [ $ost_idx -ne 0 ] &&
491 error "component 1 ost_idx $ost_idx != 0"
493 ost_idx=$($LFS getstripe -I2 -i $comp_file)
494 [ $ost_idx -ne 0 ] &&
495 error "component 2 ost_idx $ost_idx != 0"
497 # create subdir under parent
498 mkdir -p $subdir || error "Create subdir $subdir failed"
500 comp_cnt=$($LFS getstripe -d --component-count $subdir)
501 [ $comp_cnt -ne 2 ] && error "subdir $comp_cnt != 2"
503 # create file under subdir
504 touch $subdir/$tfile || error "Create $subdir/$tfile failed"
506 check_component_count $subdir/$tfile 2
508 # delete default layout setting from parent
509 $LFS setstripe -d $parent ||
510 error "Delete default layout from $parent failed"
512 comp_cnt=$($LFS getstripe -d --component-count $parent)
513 [ $comp_cnt -ne 0 ] && error "$comp_cnt isn't 0"
515 rm -f $comp_file || error "Delete $comp_file failed"
516 rm -f $subdir/$tfile || error "Delete $subdir/$tfile failed"
517 rm -r $subdir || error "Delete subdir $subdir failed"
518 rmdir $parent || error "Delete dir $parent failed"
520 run_test 5 "Inherit composite layout from parent directory"
523 local comp_file=$DIR/$tdir/$tfile
525 test_mkdir $DIR/$tdir
528 $LFS setstripe -c 1 -S 128K $comp_file ||
529 error "Create v1 $comp_file failed"
531 check_component_count $comp_file 0
533 dd if=/dev/urandom of=$comp_file bs=1M count=5 oflag=sync ||
534 error "Write to v1 $comp_file failed"
536 local old_chksum=$(md5sum $comp_file)
538 # Migrate v1 to composite
539 $LFS migrate -E 1M -S 512K -c 1 -E -1 -S 1M -c 2 $comp_file ||
540 error "Migrate(v1 -> composite) $comp_file failed"
542 check_component_count $comp_file 2
544 local chksum=$(md5sum $comp_file)
545 [ "$old_chksum" != "$chksum" ] &&
546 error "(v1 -> compsoite) $old_chksum != $chksum"
548 # Migrate composite to composite
549 $LFS migrate -E 1M -S 1M -c 2 -E 4M -S 1M -c 2 \
550 -E -1 -S 3M -c 3 $comp_file ||
551 error "Migrate(compsoite -> composite) $comp_file failed"
553 check_component_count $comp_file 3
555 chksum=$(md5sum $comp_file)
556 [ "$old_chksum" != "$chksum" ] &&
557 error "(composite -> compsoite) $old_chksum != $chksum"
559 # Migrate composite to v1
560 $LFS migrate -c 2 -S 2M $comp_file ||
561 error "Migrate(composite -> v1) $comp_file failed"
563 check_component_count $comp_file 0
565 chksum=$(md5sum $comp_file)
566 [ "$old_chksum" != "$chksum" ] &&
567 error "(composite -> v1) $old_chksum != $chksum"
569 rm -f $comp_file || error "Delete $comp_file failed"
571 run_test 6 "Migrate composite file"
574 test_mkdir $DIR/$tdir
575 chmod 0777 $DIR/$tdir || error "chmod $tdir failed"
577 local comp_file=$DIR/$tdir/$tfile
578 $RUNAS $LFS setstripe -E 1M -S 1M -c 1 $comp_file ||
579 error "Create composite file $comp_file failed"
581 $RUNAS $LFS setstripe --component-add -E 64M -c 4 $comp_file ||
582 error "Add component to $comp_file failed"
584 $RUNAS $LFS setstripe --component-del -I 2 $comp_file ||
585 error "Delete component from $comp_file failed"
587 $RUNAS $LFS setstripe --component-add -E -1 -c 5 $comp_file ||
588 error "Add last component to $comp_file failed"
590 rm $comp_file || error "Delete composite failed"
592 run_test 7 "Add/Delete/Create composite file by non-privileged user"
595 local parent=$DIR/$tdir
598 mkdir_on_mdt0 $parent
600 $LFS setstripe -E 2M -c 1 -S 1M -E 16M -c 2 -S 2M \
601 -E -1 -c 4 -S 4M $parent ||
602 error "Set default layout to $parent failed"
604 bash rundbench -C -D $parent 2 || error "dbench failed"
606 rm -fr $parent || error "Delete dir $parent failed"
608 run_test 8 "Run dbench over composite files"
611 local comp_file=$DIR/$tdir/$tfile
613 test_mkdir $DIR/$tdir
616 $LFS setstripe -E 1M -S 1M -E -1 -c 1 $comp_file ||
617 error "Create $comp_file failed"
619 check_component_count $comp_file 2
621 replay_barrier $SINGLEMDS
623 # instantiate the 2nd component
624 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=2k
626 local f1=$($LFS getstripe -I2 $comp_file |
627 awk '/l_fid:/ {print $7}')
628 echo "before MDS recovery, the ost fid of 2nd component is $f1"
631 local f2=$($LFS getstripe -I2 $comp_file |
632 awk '/l_fid:/ {print $7}')
633 echo "after MDS recovery, the ost fid of 2nd component is $f2"
634 [ "x$f1" == "x$f2" ] || error "$f1 != $f2"
636 run_test 9 "Replay layout extend object instantiation"
639 echo $($LFS getstripe $1 |
640 awk '$1 == "lcm_entry_count:" { printf("%d", $2) }
641 $1 == "lcme_extent.e_start:" { printf("[%#lx", $2) }
642 $1 == "lcme_extent.e_end:" { printf(",%s]", $2) }')
646 local parent=$DIR/$tdir
649 save_layout_restore_at_exit $MOUNT
653 # mount root on $MOUNT2 if FILESET is set
654 if [ -n "$FILESET" ]; then
655 FILESET="" mount_client $MOUNT2 ||
656 error "mount $MOUNT2 fail"
660 $LFS setstripe -d $root || error "clear root layout"
662 # set root composite layout
663 $LFS setstripe -E 2M -c 1 -S 1M -E 16M -c2 -S 2M \
664 -E -1 -c 4 -S 4M $root ||
665 error "Set root layout failed"
667 if [ "$root" == "$MOUNT2" ]; then
668 umount_client $MOUNT2 ||
669 error "umount $MOUNT2 fail"
673 # set a different layout for parent
674 $LFS setstripe -E -1 -c 1 -S 1M $parent ||
675 error "set $parent layout failed"
678 local f1_entry=$(component_dump $parent/file1)
680 # delete parent's layout
681 $LFS setstripe -d $parent || error "Clear $parent layout failed"
684 local f2_entry=$(component_dump $parent/file2)
686 # verify layout inheritance
688 local f1_expect="1[0,EOF]"
689 local f2_expect="3[0,2097152][0x200000,16777216][0x1000000,EOF]"
691 echo "f1 expect=$f1_expect"
692 echo "f1 get =$f1_entry"
693 echo "f2 expect=$f2_expect"
694 echo "f2 get =$f2_entry"
696 [ x$f1_expect != x$f1_entry ] &&
697 error "$parent/file1 does not inherite parent layout"
698 [ x$f2_expect != x$f2_entry ] &&
699 error "$parent/file2 does not inherite root layout"
703 run_test 10 "Inherit composite template from root"
706 local comp_file=$DIR/$tdir/$tfile
707 test_mkdir $DIR/$tdir
710 # only 1st component instantiated
711 $LFS setstripe -E 1M -S 1M -E 2M -E 3M -E -1 $comp_file ||
712 error "Create $comp_file failed"
714 local f1=$($LFS getstripe -I1 $comp_file | grep "l_fid")
715 [[ -z $f1 ]] && error "1: 1st component uninstantiated"
716 local f2=$($LFS getstripe -I2 $comp_file | grep "l_fid")
717 [[ -n $f2 ]] && error "1: 2nd component instantiated"
718 local f3=$($LFS getstripe -I3 $comp_file | grep "l_fid")
719 [[ -n $f3 ]] && error "1: 3rd component instantiated"
720 local f4=$($LFS getstripe -I4 $comp_file | grep "l_fid")
721 [[ -n $f4 ]] && error "1: 4th component instantiated"
723 # the first 2 components instantiated
724 # Truncate to exact start of new component - LU-12586
725 $TRUNCATE $comp_file $((1024*1024*1))
727 f2=$($LFS getstripe -I2 $comp_file | grep "l_fid")
728 [[ -z $f2 ]] && error "2: 2nd component uninstantiated"
729 f3=$($LFS getstripe -I3 $comp_file | grep "l_fid")
730 [[ -n $f3 ]] && error "2: 3rd component instantiated"
731 f4=$($LFS getstripe -I4 $comp_file | grep "l_fid")
732 [[ -n $f4 ]] && error "2: 4th component instantiated"
734 # the first 3 components instantiated
735 $TRUNCATE $comp_file $((1024*1024*3 - 1))
736 $TRUNCATE $comp_file $((1024*1024*1+1))
738 f2=$($LFS getstripe -I2 $comp_file | grep "l_fid")
739 [[ -z $f2 ]] && error "3: 2nd component uninstantiated"
740 f3=$($LFS getstripe -I3 $comp_file | grep "l_fid")
741 [[ -z $f3 ]] && error "3: 3rd component uninstantiated"
742 f4=$($LFS getstripe -I4 $comp_file | grep "l_fid")
743 [[ -n $f4 ]] && error "3: 4th component instantiated"
745 # all 4 components instantiated, using append write
746 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=2k
748 rwv -f $comp_file -w -a -n 2 $((1024*1023)) 1
751 f4=$($LFS getstripe -I4 $comp_file | grep "l_fid")
752 [[ -z $f4 ]] && error "4: 4th component uninstantiated"
756 run_test 11a "Verify component instantiation with write/truncate"
759 [ $OSTCOUNT -lt 4 ] && skip "needs >= 4 OSTs"
761 local file=$DIR/$tdir/$tfile
763 test_mkdir $DIR/$tdir
766 $LFS setstripe -E 1m -E 1g -c 4 -E eof $DIR/$tdir ||
767 error "setstripe dir $DIR/$tdir failed"
768 expand_truncate_test $file ||
769 error "expand_truncate_test failed on $file"
771 run_test 11b "truncate file set file size correctly"
774 [ $OSTCOUNT -lt 3 ] && skip "needs >= 3 OSTs"
776 local file=$DIR/$tdir/$tfile
777 test_mkdir $DIR/$tdir
780 # specify ost list for component
781 $LFS setstripe -E 2M -S 1M -c 2 -o 0,1 -E 4M -c 2 -o 1,2 \
782 -E 6M -c 2 -o 2,1 -E 8M -c 1 -i 2 -E -1 $file ||
783 error "Create $file failed"
785 # clear lod component cache
786 stop $SINGLEMDS || error "stop MDS"
787 local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
788 start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || error "start MDS"
790 # instantiate all components
791 $TRUNCATE $file $((1024*1024*8+1))
793 #verify object alloc order
794 local o1=$($LFS getstripe -I1 $file |
795 awk '/l_ost_idx:/ {printf("%d",$5)}')
796 [[ $o1 != "01" ]] && error "$o1 is not 01"
798 local o2=$($LFS getstripe -I2 $file |
799 awk '/l_ost_idx:/ {printf("%d",$5)}')
800 [[ $o2 != "12" ]] && error "$o2 is not 12"
802 local o3=$($LFS getstripe -I3 $file |
803 awk '/l_ost_idx:/ {printf("%d",$5)}')
804 [[ $o3 != "21" ]] && error "$o3 is not 21"
806 local o4=$($LFS getstripe -I4 $file |
807 awk '/l_ost_idx:/ {printf("%d",$5)}')
808 [[ $o4 != "2" ]] && error "$o4 is not 2"
812 run_test 12 "Verify ost list specification"
814 test_13() { # LU-9311
815 [ $OSTCOUNT -lt 8 ] && skip "needs >= 8 OSTs"
817 local file=$DIR/$tfile
819 local dd_size=$(($dd_count * 1024 * 1024))
823 $LFS setstripe -E 1M -S 1M -c 1 -E 2M -c 2 -E -1 -c -1 -i 1 $file ||
824 error "Create $file failed"
825 dd if=/dev/zero of=$file bs=1M count=$dd_count
826 real_size=$(stat -c %s $file)
827 [ $real_size -eq $dd_size ] ||
828 error "dd actually wrote $real_size != $dd_size bytes"
832 run_test 13 "shouldn't reprocess granted resent request"
835 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
836 local file=$DIR/$tdir/$tfile
837 test_mkdir -p $DIR/$tdir
840 $LFS setstripe -E1m -c1 -S1m --pool="pool1" -E2m \
841 -E4m -c2 -S2m --pool="pool2" -E-1 $file ||
842 error "Create $file failed"
844 # check --pool inheritance
846 pool="$($LFS getstripe -I2 --pool $file)"
847 [ x"$pool" != "xpool1" ] && $LFS getstripe -I2 $file &&
848 error "$file: component 2 doesn't have poolname pool1"
849 pool="$($LFS getstripe -I4 --pool $file)"
850 [ x"$pool" != "xpool2" ] && $LFS getstripe -I4 $file &&
851 error "$file: component 4 doesn't have poolname pool2"
853 #check --stripe-count inheritance
855 count="$($LFS getstripe -I2 -c $file)"
856 [ $count -ne 1 ] && $LFS getstripe -I2 $file &&
857 error "$file: component 2 doesn't have 1 stripe_count"
858 count="$($LFS getstripe -I4 -c $file)"
859 [ $count -ne 2 ] && $LFS getstripe -I4 $file &&
860 error "$file: component 4 doesn't have 2 stripe_count"
862 #check --stripe-size inheritance
864 size="$($LFS getstripe -I2 -S $file)"
865 [ $size -ne $((1024*1024)) ] && $LFS getstripe -I2 $file &&
866 error "$file: component 2 doesn't have 1M stripe_size"
867 size="$($LFS getstripe -I4 -S $file)"
868 [ $size -ne $((1024*1024*2)) ] && $LFS getstripe -I4 $file &&
869 error "$file: component 4 doesn't have 2M stripe_size"
873 run_test 14 "Verify setstripe poolname/stripe_count/stripe_size inheritance"
876 local parent=$DIR/$tdir
881 $LFS setstripe -d $parent || error "delete default layout"
883 $LFS setstripe -E 1M -S 1M -E 10M -E eof $parent/f1 || error "create f1"
884 $LFS setstripe -E 4M -E 20M -E eof $parent/f2 || error "create f2"
885 test_mkdir $parent/subdir
886 $LFS setstripe -E 6M -S 1M -c1 -E 30M -c4 -E eof -c $OSTCOUNT \
887 $parent/subdir || error "setstripe to subdir"
888 $LFS setstripe -E 8M -E eof $parent/subdir/f3 || error "create f3"
889 $LFS setstripe -c 1 $parent/subdir/f4 || error "create f4"
892 local found=$($LFS find --component-start +2M -E -15M $parent | wc -l)
893 [ $found -eq 0 ] || error "start+2M, end-15M, $found != 0"
896 found=$($LFS find --component-start +2M -E -35M $parent | wc -l)
897 [ $found -eq 2 ] || error "start+2M, end-35M, $found != 2"
900 found=$($LFS find --component-start +4M -E -eof $parent | wc -l)
901 [ $found -eq 1 ] || error "start+4M, end-eof, $found != 1"
903 local flg_opts="--component-flags init"
905 found=$($LFS find --component-start 1M -E 10M $flg_opts $parent | wc -l)
907 error "before write: start=1M, end=10M, flag=init, $found != 0"
909 dd if=/dev/zero of=$parent/f1 bs=1M count=2 ||
910 error "dd $parent/f1 failed"
913 found=$($LFS find --component-start 1M -E 10M $flg_opts $parent | wc -l)
915 error "after write: start=1M, end=10M, flag=init, $found != 1"
917 local ext_opts="--component-start -1M -E +5M"
918 # parent, subdir, f3, f4
919 found=$($LFS find $ext_opts $parent | wc -l)
920 [ $found -eq 4 ] || error "start-1M, end+5M, $found != 4"
922 local cnt_opts="--component-count +2"
924 found=$($LFS find $ext_opts $cnt_opts $parent | wc -l)
925 [ $found -eq 1 ] || error "start-1M, end+5M, count+2, $found != 1"
928 found=$($LFS find $ext_opts $cnt_opts $flg_opts $parent | wc -l)
930 error "start-1M, end+5M, count+2, flag=init, $found != 0"
933 found=$($LFS find $ext_opts ! $cnt_opts $flg_opts $parent | wc -l)
935 error "start-1M, end+5M, !count+2, flag=init, $found != 2"
937 # check last component stripe count
938 if [ $OSTCOUNT -gt 1 ]; then
939 touch $parent/subdir/f5
940 $TRUNCATE $parent/subdir/f5 $((32*1024*1024))
941 found=$($LFS find $parent/subdir -c $OSTCOUNT)
942 [[ "$found" == "$parent/subdir/f5" ]] ||
943 error "got '$found' with stripe_count=$OSTCOUNT, not f5"
946 run_test 15 "Verify component options for lfs find"
949 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
950 large_xattr_enabled || skip_env "ea_inode feature disabled"
952 local file=$DIR/$tdir/$tfile
953 local dir=$DIR/$tdir/dir
954 local temp=$DIR/$tdir/template
956 test_mkdir $DIR/$tdir
958 #####################################################################
960 # set stripe for source file
961 $LFS setstripe -E1m -S 1M -c2 -o0,1 -E2m -c2 -E3m -o1,0 -E4m -c1 -E-1 \
962 $file || error "Create $file failed"
965 verify_yaml_layout $file $file.copy $temp "1. PFL file"
967 #####################################################################
969 # set stripe for source file
971 $LFS setstripe -c2 -o0,1 -i1 $file || error "Create $file failed"
975 verify_yaml_layout $file $file.copy $temp "2. plain file"
977 #####################################################################
979 # set stripe for source dir
981 $LFS setstripe -E1m -S 1M -c2 -E2m -c1 -E-1 $dir ||
982 error "setstripe $dir failed"
986 verify_yaml_layout $dir $dir.copy $temp.dir "3. PFL dir"
988 #####################################################################
990 # set stripe for source dir
991 $LFS setstripe -c2 -i-1 $dir || error "setstripe $dir failed"
994 verify_yaml_layout $dir $dir.copy $temp.dir "4. plain dir"
996 run_test 16a "Verify setstripe/getstripe with YAML config file"
999 [[ $($LCTL get_param mdc.*.import |
1000 grep "connect_flags:.*overstriping") ]] ||
1001 skip "server does not support overstriping"
1002 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1003 [[ $OSTCOUNT -ge $(($LOV_MAX_STRIPE_COUNT / 2)) ]] &&
1004 skip_env "too many osts, skipping"
1005 large_xattr_enabled || skip_env "ea_inode feature disabled"
1009 local file=$DIR/$tdir/$tfile
1010 local dir=$DIR/$tdir/dir
1011 local temp=$DIR/$tdir/template
1012 # We know OSTCOUNT < (LOV_MAX_STRIPE_COUNT / 2), so this is overstriping
1013 local large_count=$((LOV_MAX_STRIPE_COUNT / 2 + 10))
1016 test_mkdir $DIR/$tdir
1018 #####################################################################
1019 # 1. PFL file, overstriping in first comps
1020 # set stripe for source file
1021 $LFS setstripe -E1m -S 1M -o0,0 -E2m -o1,1 -E3m -C $large_count -E-1 \
1022 $file || error "Create $file failed"
1025 verify_yaml_layout $file $file.copy $temp "1. PFL file"
1027 #####################################################################
1028 # 2. plain file + overstriping
1029 # set stripe for source file
1031 $LFS setstripe -C $large_count -i1 $file || error "Create $file failed"
1034 echo "2. plain file"
1035 verify_yaml_layout $file $file.copy $temp "2. plain file"
1037 #####################################################################
1038 # 3. PFL dir + overstriping
1039 # set stripe for source dir
1041 $LFS setstripe -E1m -S 1M -o 0,0 -E2m -C $large_count -E-1 $dir ||
1042 error "setstripe $dir failed"
1044 test_mkdir $dir.copy
1046 verify_yaml_layout $dir $dir.copy $temp.dir "3. PFL dir"
1048 #####################################################################
1049 # 4. plain dir + overstriping
1050 # set stripe for source dir
1051 $LFS setstripe -C $large_count $dir || error "setstripe $dir failed"
1054 verify_yaml_layout $dir $dir.copy $temp.dir "4. plain dir"
1056 run_test 16b "Verify setstripe/getstripe with YAML config file + overstriping"
1059 (( $MDS1_VERSION >= $(version_code 2.13.53.205) )) ||
1060 skip "need MDS version at least 2.13.53.205"
1062 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1064 local file=$DIR/$tdir/$tfile
1065 local dir=$DIR/$tdir/dir
1066 local temp=$DIR/$tdir/template
1068 test_mkdir $DIR/$tdir
1070 #####################################################################
1072 # set stripe for source file
1073 $LFS setstripe -E256M -S 1M -c2 -o0,1 -z 64M -E-1 -o1,0 -z 128M \
1074 $file || error "Create $file failed"
1077 verify_yaml_layout $file $file.copy $temp "1. PFL file"
1079 #####################################################################
1081 # set stripe for source dir
1083 $LFS setstripe -E256M -S 1M -c2 -z 64M -E-1 -z 128M \
1084 $dir || error "setstripe $dir failed"
1086 test_mkdir $dir.copy
1087 echo "2. SEL template on dir"
1088 verify_yaml_layout $dir $dir.copy $temp.dir "2. PFL dir"
1090 run_test 16c "Verify setstripe/getstripe for SEL layout with YAML config file"
1093 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1095 local file=$DIR/$tdir/$tfile
1096 local dir=$DIR/$tdir/dir
1097 local temp=$DIR/$tdir/template
1099 test_mkdir $DIR/$tdir
1101 #####################################################################
1103 # set stripe for source file
1104 $LFS setstripe -E1m -L mdt -E-1 -o1,0 $file ||
1105 error "Create $file failed"
1108 verify_yaml_layout $file $file.copy $temp "1. DOM file"
1110 #####################################################################
1112 # set stripe for source dir
1114 $LFS setstripe -E1m -L mdt -E-1 -o1,0 $dir || error "Create $dir failed"
1116 test_mkdir $dir.copy
1118 verify_yaml_layout $dir $dir.copy $temp.dir "2. DOM dir"
1120 run_test 16d "Verify setstripe/getstripe for DOM layout with YAML config file"
1124 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1125 local file=$DIR/$tdir/$tfile
1126 test_mkdir -p $DIR/$tdir
1129 $LFS setstripe -E 1M -S 1M -E 3M -c 2 -E -1 -c -1 $file ||
1130 error "Create $file failed"
1132 local s1=$($LFS getstripe -I1 -v $file | awk '/lcme_size:/{print $2}')
1133 local s2=$($LFS getstripe -I2 -v $file | awk '/lcme_size:/{print $2}')
1134 local s3=$($LFS getstripe -I3 -v $file | awk '/lcme_size:/{print $2}')
1135 echo "1st init: comp size 1:$s1 2:$s2 3:$s3"
1137 # init 2nd component
1138 $TRUNCATE $file $((1024*1024+1))
1139 local s1n=$($LFS getstripe -I1 -v $file | awk '/lcme_size:/{print $2}')
1140 local s2n=$($LFS getstripe -I2 -v $file | awk '/lcme_size:/{print $2}')
1141 echo "2nd init: comp size 1:$s1n 2:$s2n 3:$s3"
1143 [ $s1 -eq $s1n ] || error "1st comp size $s1 should == $s1n"
1144 [ $s2 -lt $s2n ] || error "2nd comp size $s2 should < $s2n"
1146 # init 3rd component
1147 $TRUNCATE $file $((1024*1024*3+1))
1148 s1n=$($LFS getstripe -I1 -v $file | awk '/lcme_size:/{print $2}')
1149 s2n=$($LFS getstripe -I2 -v $file | awk '/lcme_size:/{print $2}')
1150 local s3n=$($LFS getstripe -I3 -v $file | awk '/lcme_size:/{print $2}')
1151 echo "3rd init: comp size 1:$s1n 2:$s2n 3:$s3n"
1153 [ $s1 -eq $s1n ] || error "1st comp size $s1 should == $s1n"
1154 [ $s2 -lt $s2n ] || error "2nd comp size $s2 should < $s2n"
1155 [ $s3 -lt $s3n ] || error "3rd comp size $s3 should < $s3n"
1157 run_test 17 "Verify LOVEA grows with more component inited"
1159 check_distribution() {
1163 local obj_min_one=$((OSTCOUNT - 1))
1165 objs=$($LFS getstripe $file |
1166 awk '/l_ost_idx:/ { print $5 }' | wc -l)
1167 let ave=$((objs / OSTCOUNT))
1169 # collect objects per OST distribution
1170 $LFS getstripe $file | awk '/l_ost_idx:/ { print $5 }' | tr -d "," |
1171 (inuse=( $(for i in $(seq 0 $obj_min_one); do echo 0; done) )
1173 let inuse[$O]=$((1 + ${inuse[$O]}))
1176 # verify object distribution varies no more than +-1
1177 for idx in $(seq 0 $obj_min_one); do
1178 let dif=$((${inuse[$idx]} - ave))
1180 if [ "$dif" -gt 1 ]; then
1181 echo "OST${idx}: ${inuse[$idx]} objects"
1182 error "bad distribution on OST${idx}"
1188 local file1=$DIR/${tfile}-1
1189 local file2=$DIR/${tfile}-2
1190 local file3=$DIR/${tfile}-3
1192 rm -f $file1 $file2 $file3
1194 $LFS setstripe -E 1m -S 1m $file1 ||
1195 error "Create $file1 failed"
1196 $LFS setstripe -E 1m -S 1m $file2 ||
1197 error "Create $file2 failed"
1198 $LFS setstripe -E 1m -S 1m $file3 ||
1199 error "Create $file3 failed"
1201 local objs=$((OSTCOUNT+1))
1202 for comp in $(seq 1 $OSTCOUNT); do
1203 $LFS setstripe --component-add -E $((comp+1))M -c 1 $file1 ||
1204 error "Add component to $file1 failed 2"
1205 $LFS setstripe --component-add -E $((comp+1))M -c 1 $file2 ||
1206 error "Add component to $file2 failed 2"
1207 $LFS setstripe --component-add -E $((comp+1))M -c 1 $file3 ||
1208 error "Add component to $file3 failed 2"
1211 $LFS setstripe --component-add -E -1 -c -1 $file1 ||
1212 error "Add component to $file1 failed 3"
1213 $LFS setstripe --component-add -E -1 -c -1 $file2 ||
1214 error "Add component to $file2 failed 3"
1215 $LFS setstripe --component-add -E -1 -c -1 $file3 ||
1216 error "Add component to $file3 failed 3"
1218 # Instantiate all components
1219 dd if=/dev/urandom of=$file1 bs=1M count=$((objs+1)) ||
1220 error "dd failed for $file1"
1221 dd if=/dev/urandom of=$file2 bs=1M count=$((objs+1)) ||
1222 error "dd failed for $file2"
1223 dd if=/dev/urandom of=$file3 bs=1M count=$((objs+1)) ||
1224 error "dd failed for $file3"
1226 check_distribution $file1
1227 check_distribution $file2
1228 check_distribution $file3
1231 run_test 18 "check component distribution"
1235 local already_created=${2:-0}
1236 local rw_len=$((3 * 1024 * 1024)) # 3M
1240 if [ $already_created != 1 ]; then
1241 test_mkdir -p $DIR/$tdir
1242 $LFS setstripe --extension-size 64M -c 1 -E -1 $comp_file ||
1243 error "Create $comp_file failed"
1246 # write past end of first component, so it is extended
1247 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=127 conv=notrunc ||
1248 error "dd to extend failed"
1250 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1251 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
1253 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
1254 [ $ost_idx2 -ne "-1" ] && error "second component init $ost_idx2"
1256 flg_opts="--comp-flags init"
1257 found=$($LFS find --comp-start 0 -E 128M $flg_opts $comp_file | wc -l)
1258 [ $found -eq 1 ] || error "Write: Extended first component not found"
1260 flg_opts="--comp-flags extension"
1261 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
1262 [ $found -eq 1 ] || error "Write: second component not found"
1264 found=$($LFS find -z 64M $comp_file | wc -l)
1265 [ $found -eq 1 ] || error "component not found by ext size"
1267 found=$($LFS find --extension-size +63M $comp_file | wc -l)
1268 [ $found -eq 1 ] || error "component not found by +ext size"
1270 found=$($LFS find --ext-size -65M $comp_file | wc -l)
1271 [ $found -eq 1 ] || error "component not found by -ext size"
1273 found=$($LFS find -z 65M $comp_file | wc -l)
1274 [ $found -eq 0 ] || error "component found by wrong 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 -63M $comp_file | wc -l)
1280 [ $found -eq 0 ] || error "component found by wrong -ext size"
1282 found=$($LFS find ! -z 64M $comp_file | wc -l)
1283 [ $found -eq 0 ] || error "component found by negation of ext size"
1285 found=$($LFS find ! -z +63M $comp_file | wc -l)
1286 [ $found -eq 0 ] || error "component found by negation of +ext size"
1288 found=$($LFS find ! -z -65M $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)
1293 error "component not found by negation of wrong ext size"
1295 found=$($LFS find ! -z +65M $comp_file | wc -l)
1297 error "component not found by negation of wrong +ext size"
1299 found=$($LFS find ! -z -63M $comp_file | wc -l)
1301 error "component not found by negation of wrong -ext size"
1303 found=$($LFS find -S +1M $comp_file | wc -l)
1304 [ $found -eq 0 ] || error "component found by wrong +stripe size"
1306 found=$($LFS find -c 1 $comp_file | wc -l)
1307 [ $found -eq 1 ] || error "component not found by stripe count"
1309 small_write $comp_file $rw_len || error "Verify RW failed"
1311 sel_layout_sanity $comp_file 2
1314 # Self-extending PFL tests
1316 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1317 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1318 skip "skipped for lustre < $SEL_VER"
1320 test19_io_base $DIR/$tdir/$tfile
1322 run_test 19a "Simple test of extension behavior"
1324 # Same as 19a, but with default layout set on directory rather than on file
1326 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1327 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1328 skip "skipped for lustre < $SEL_VER"
1330 local comp_file=$DIR/$tdir/$tfile
1331 local comp_dir=$DIR/$tdir/$tdir
1335 test_mkdir -p $DIR/$tdir
1336 $LFS setstripe --ext-size 64M -c 1 -E -1 $DIR/$tdir ||
1337 error "Setstripe on $DIR/$tdir failed"
1339 # check inheritance for a sub-dir and a file
1340 test_mkdir $comp_dir
1341 found=$($LFS find --comp-start 0 -E 64M $comp_dir | wc -l)
1342 [ $found -eq 1 ] || error "Dir Inheritance: wrong first component size"
1344 flg_opts="--comp-flags extension"
1345 found=$($LFS find --comp-start 64M -E EOF $flg_opts $comp_dir | wc -l)
1346 [ $found -eq 1 ] || error "Dir Inheritance: Second component not found"
1350 flg_opts="--comp-flags init"
1351 found=$($LFS find --comp-start 0 -E 64M $flg_opts $comp_file | wc -l)
1352 [ $found -eq 1 ] || error "File Inheritance: wrong first component size"
1354 flg_opts="--comp-flags extension"
1355 found=$($LFS find --comp-start 64M -E EOF $flg_opts $comp_file | wc -l)
1356 [ $found -eq 1 ] || error "File Inheritance: Second component not found"
1358 test19_io_base $comp_file 1
1360 run_test 19b "Simple test of SEL as default layout"
1362 # Test behavior when seeking deep in a file
1364 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1365 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1366 skip "skipped for lustre < $SEL_VER"
1368 local comp_file=$DIR/$tdir/$tfile
1372 test_mkdir -p $DIR/$tdir
1374 $LFS setstripe -z 128M -E 1G -E -1 $comp_file ||
1375 error "Create $comp_file failed"
1377 # write past end of first component, so it is extended
1378 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=130 conv=notrunc ||
1379 error "dd to extend failed"
1381 flg_opts="--comp-flags init"
1382 found=$($LFS find --comp-start 0M -E 256M $flg_opts $comp_file | wc -l)
1383 [ $found -eq 1 ] || error "Write: first extension component not found"
1385 flg_opts="--comp-flags extension,^init"
1386 found=$($LFS find --comp-start 256M -E 1024M $flg_opts $comp_file |\
1388 [ $found -eq 1 ] || error "Write: second extension component not found"
1390 local end_1=$($LFS getstripe -I1 -E $comp_file)
1393 [ $end_1 -eq 268435456 ] ||
1394 error "end of first component $end_1 != 268435456"
1396 # Write past end of extension space component, in to normal component
1397 # should exhaust & remove extension component
1398 dd if=/dev/zero bs=1M count=1 seek=1100 of=$comp_file conv=notrunc ||
1399 error "dd distant seek failed"
1401 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1402 # the last component index is 3
1403 local ost_idx2=$($LFS getstripe -I3 -i $comp_file)
1405 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
1407 local start1=$($LFS getstripe -I1 --comp-start $comp_file)
1408 local end1=$($LFS getstripe -I1 -E $comp_file)
1409 local start2=$($LFS getstripe -I3 --comp-start $comp_file)
1410 local end2=$($LFS getstripe -I3 -E $comp_file)
1412 [ $start1 -eq 0 ] || error "start of first component incorrect"
1413 [ $end1 -eq 1073741824 ] || error "end of first component incorrect"
1414 [ $start2 -eq 1073741824 ] ||
1415 error "start of second component incorrect"
1416 [ "$end2" = "EOF" ] || error "end of second component incorrect"
1418 flg_opts="--comp-flags extension"
1419 found=$($LFS find $flg_opts $comp_file | wc -l)
1420 [ $found -eq 0 ] || error "Seek Write: extension component exists"
1422 sel_layout_sanity $comp_file 2
1424 run_test 19c "Test self-extending layout seeking behavior"
1427 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1428 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1429 skip "skipped for lustre < $SEL_VER"
1431 local comp_file=$DIR/$tdir/$tfile
1435 test_mkdir -p $DIR/$tdir
1437 $LFS setstripe -E 128M -c 1 -z 64M -E -1 $comp_file ||
1438 error "Create $comp_file failed"
1440 # This will cause component 1 to be extended to 128M, then the
1441 # extension space component will be removed
1442 dd if=/dev/zero of=$comp_file bs=130M count=1 ||
1443 error "dd to extend failed"
1445 flg_opts="--comp-flags init"
1446 found=$($LFS find --comp-start 0M -E 128M $flg_opts $comp_file | wc -l)
1447 [ $found -eq 1 ] || error "Write: first component not found"
1449 flg_opts="--comp-flags init"
1450 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
1451 [ $found -eq 1 ] || error "Write: second component not found"
1453 sel_layout_sanity $comp_file 2
1455 # always remove large files in case of DO_CLEANUP=false
1456 rm -f $comp_file || error "Delete $comp_file failed"
1458 run_test 19d "Test write which completely spans extension space component"
1463 local comp2_flags=$($LFS getstripe -I2 --comp-flags $comp_file)
1464 local comp3_flags=$($LFS getstripe -I3 --comp-flags $comp_file)
1466 [ "$comp2_flags" != "init" ] && error "$comp2_flags != init"
1467 [ "$comp3_flags" != "extension" ] && error "$comp3_flags != extension"
1469 local flg_opts=" --comp-start 2M -E 66M --comp-flags init"
1470 local found=$($LFS find $flg_opts $comp_file | wc -l)
1471 [ $found -eq 1 ] || error "Write: extended second component not found"
1473 flg_opts="--comp-start 66M -E EOF --comp-flags extension"
1474 found=$($LFS find $flg_opts $comp_file | wc -l)
1475 [ $found -eq 1 ] || error "Write: third component not found"
1477 sel_layout_sanity $comp_file 3
1481 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1482 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1483 skip "skipped for lustre < $SEL_VER"
1485 local comp_file=$DIR/$tdir/$tfile
1486 local rw_len=$((3 * 1024 * 1024)) # 3M
1490 test_mkdir -p $DIR/$tdir
1492 $LFS setstripe -E 2m -E -1 -z 64M $comp_file ||
1493 error "Create $comp_file failed"
1495 replay_barrier $SINGLEMDS
1497 #instantiate & extend second component
1498 dd if=/dev/zero of=$comp_file bs=4M count=1 ||
1499 error "dd to extend failed"
1501 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
1502 local ost_idx3=$($LFS getstripe -I3 -i $comp_file)
1504 [ $ost_idx2 -eq $ost_idx3 ] && error "$ost_idx2 == $ost_idx3"
1505 [ $ost_idx3 -ne "-1" ] && error "third component init $ost_idx3"
1507 test_19e_check $comp_file
1509 local f1=$($LFS getstripe -I2 $comp_file | awk '/l_fid:/ {print $7}')
1510 echo "before MDS recovery, the ost fid of 2nd component is $f1"
1514 local f2=$($LFS getstripe -I2 $comp_file | awk '/l_fid:/ {print $7}')
1515 echo "after MDS recovery, the ost fid of 2nd component is $f2"
1516 [ "x$f1" == "x$f2" ] || error "$f1 != $f2"
1518 # simply repeat all previous checks, but also verify components are on
1519 # the same OST as before
1521 local ost_idx2_2=$($LFS getstripe -I2 -i $comp_file)
1522 local ost_idx3_2=$($LFS getstripe -I3 -i $comp_file)
1524 [ $ost_idx2_2 -eq $ost_idx3_2 ] && error "$ost_idx2_2 == $ost_idx3_2"
1525 [ $ost_idx3_2 -ne "-1" ] && error "second component init $ost_idx3_2"
1527 # verify OST id is the same after failover
1528 [ $ost_idx2 -ne $ost_idx2_2 ] &&
1529 error "$ost_idx2 != $ost_idx2_2, changed after failover"
1531 test_19e_check $comp_file
1533 run_test 19e "Replay of layout instantiation & extension"
1536 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1537 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1538 skip "skipped for lustre < $SEL_VER"
1540 local comp_file=$DIR/$tdir/$tfile
1544 test_mkdir -p $DIR/$tdir
1546 $LFS setstripe -E 256M --comp-flags extension -E -1 $comp_file
1548 [ $? != 0 ] || error "should not be able to manually set extension flag"
1551 run_test 19f "Rejection of invalid layouts"
1554 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1555 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1556 skip "skipped for lustre < $SEL_VER"
1558 local file1=$DIR/${tfile}-1
1559 local file2=$DIR/${tfile}-2
1561 test_mkdir -p $DIR/$tdir
1562 multiop $file1 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
1563 error "create failed $file1"
1564 multiop $file2 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
1565 error "create failed $file2"
1567 $LFS setstripe --component-add -E 1G -c 1 $file1 ||
1568 error "comp-add [0,1G] failed $file1"
1569 $LFS setstripe --component-add -E 512M -z 128M $file1 &&
1570 error "comp-add [1G,1G],SEL[1G,512M] succeded $file1"
1571 $LFS setstripe --component-add -E 10G -z 128M $file1 ||
1572 error "comp-add [1G,1G],SEL[1G,10G] failed $file1"
1573 $LFS setstripe --component-add -E -1 $file1 ||
1574 error "comp-add [10G,-1] failed $file1"
1576 $LFS setstripe --component-add -E 1G -z 32M -c 1 $file2 &&
1577 error "comp-add with smal ext size succeeded $file1"
1578 $LFS setstripe --component-add -E 1G -z 100M -c 1 $file2 &&
1579 error "comp-add with not aligned ext size succeeded $file1"
1580 $LFS setstripe --component-add -E 1G -z 128M -c 1 $file2 ||
1581 error "comp-add [0,128M],SEL[128M,1G] failed $file1"
1582 $LFS setstripe --component-add -E 10G $file2 ||
1583 error "comp-add [1G,10G] failed $file1"
1584 $LFS setstripe --component-add -E -1 -z 128M -c 1 $file2 ||
1585 error "comp-add [10G,10G],SEL[10G,-1] failed $file1"
1586 $LFS setstripe --component-add -E -1 -z 128M -c 1 $file2 &&
1587 error "repeated comp-add [10G,10G],SEL[10G,-1] succeeded $file1"
1589 $LFS getstripe $file1
1590 flg_opts="--comp-flags init"
1591 found=$($LFS find --comp-start 0 -E 1G $flg_opts $file1 | wc -l)
1592 [ $found -eq 1 ] || error "First component not found $file1"
1594 flg_opts="--comp-flags ^init"
1595 found=$($LFS find --comp-start 1G -E 1G $flg_opts $file1 | wc -l)
1596 [ $found -eq 1 ] || error "Second component not found $file1"
1598 flg_opts="--comp-flags ^init,extension"
1599 found=$($LFS find --comp-start 1G -E 10G $flg_opts $file1 | wc -l)
1600 [ $found -eq 1 ] || error "Third component not found $file1"
1602 flg_opts="--comp-flags ^init"
1603 found=$($LFS find --comp-start 10G -E EOF $flg_opts $file1 | wc -l)
1604 [ $found -eq 1 ] || error "Fourth component not found $file1"
1606 $LFS getstripe $file2
1607 flg_opts="--comp-flags init"
1608 found=$($LFS find --comp-start 0 -E 128M $flg_opts $file2 | wc -l)
1609 [ $found -eq 1 ] || error "First component not found $file2"
1611 flg_opts="--comp-flags extension"
1612 found=$($LFS find --comp-start 128M -E 1G $flg_opts $file2 | wc -l)
1613 [ $found -eq 1 ] || error "Second component not found $file2"
1615 flg_opts="--comp-flags ^init"
1616 found=$($LFS find --comp-start 1G -E 10G $flg_opts $file2 | wc -l)
1617 [ $found -eq 1 ] || error "Third component not found $file2"
1619 flg_opts="--comp-flags ^init"
1620 found=$($LFS find --comp-start 10G -E 10G $flg_opts $file2 | wc -l)
1621 [ $found -eq 1 ] || error "Fourth component not found $file2"
1623 flg_opts="--comp-flags ^init,extension"
1624 found=$($LFS find --comp-start 10G -E EOF $flg_opts $file2 | wc -l)
1625 [ $found -eq 1 ] || error "Fifth component not found $file2"
1627 run_test 19g "component-add behaviour"
1629 # Test out of space behavior
1631 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1632 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1633 skip "skipped for lustre < $SEL_VER"
1635 local comp_file=$DIR/$tdir/$tfile
1639 test_mkdir -p $DIR/$tdir
1641 # without this, a previous delete can finish after we check free space
1642 wait_delete_completed
1645 # First component is on OST0
1646 $LFS setstripe -E 256M -i 0 -z 64M -E -1 -z 128M $comp_file ||
1647 error "Create $comp_file failed"
1649 # write past end of first component, so it is extended
1650 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=66 ||
1651 error "dd to extend failed"
1653 flg_opts="--comp-flags extension"
1654 found=$($LFS find --comp-start 128M -E 256M $flg_opts $comp_file |wc -l)
1655 [ $found -eq 1 ] || error "Write: Second component not found"
1657 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1658 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
1660 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
1662 flg_opts="--comp-flags extension"
1663 # Write past current init comp, but we won't extend (because no space)
1664 dd if=/dev/zero of=$comp_file bs=1M count=10 seek=200 ||
1665 error "dd write past current comp failed"
1667 $LFS getstripe $comp_file
1669 flg_opts="--comp-flags init"
1670 found=$($LFS find --comp-start 128M -E 256M $flg_opts $comp_file | \
1672 [ $found -eq 1 ] || error "Write: third component not found"
1674 flg_opts="--comp-flags extension"
1675 found=$($LFS find --comp-start 256M -E EOF $flg_opts $comp_file |wc -l)
1676 [ $found -eq 1 ] || error "Write: fourth extension component not found"
1678 sel_layout_sanity $comp_file 3
1680 run_test 20a "Test out of space, spillover to defined component"
1683 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1684 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1685 skip "skipped for lustre < $SEL_VER"
1687 local comp_file=$DIR/$tdir/$tfile
1691 test_mkdir -p $DIR/$tdir
1693 # Pool allows us to force use of only certain OSTs
1694 pool_add $TESTNAME || error "Pool creation failed"
1695 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
1697 # normal component to 10M, extendable component to 1G
1698 # further extendable to EOF
1699 $LFS setstripe -E 10M -E 1G -p $TESTNAME -z 64M -E -1 -p "" -z 128M \
1700 $comp_file || error "Create $comp_file failed"
1702 replay_barrier $SINGLEMDS
1704 found=$($LFS find --comp-start 10M -E 10M $flg_opts $comp_file | wc -l)
1705 [ $found -eq 1 ] || error "Zero length component not found"
1708 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
1710 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
1712 # write past end of first component
1713 # This should remove the next component, since OST0 is out of space
1714 # and it is striped there (pool contains only OST0)
1715 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=14 ||
1716 error "dd to extend/remove failed"
1718 $LFS getstripe $comp_file
1720 found=$($LFS find --comp-start 10M -E 10M $flg_opts $comp_file | wc -l)
1721 [ $found -eq 0 ] || error "Write: zero length component still present"
1723 flg_opts="--comp-flags init"
1724 found=$($LFS find --comp-start 10M -E 138M $flg_opts $comp_file | wc -l)
1725 [ $found -eq 1 ] || error "Write: second component not found"
1727 flg_opts="--comp-flags extension"
1728 found=$($LFS find --comp-start 138M -E EOF $flg_opts $comp_file | wc -l)
1729 [ $found -eq 1 ] || error "Write: third component not found"
1733 found=$($LFS find --comp-start 10M -E 10M $flg_opts $comp_file | wc -l)
1734 [ $found -eq 0 ] || error "Failover: 0-length component still present"
1736 flg_opts="--comp-flags init"
1737 found=$($LFS find --comp-start 10M -E 138M $flg_opts $comp_file | wc -l)
1738 [ $found -eq 1 ] || error "Failover: second component not found"
1740 flg_opts="--comp-flags extension"
1741 found=$($LFS find --comp-start 138M -E EOF $flg_opts $comp_file | wc -l)
1742 [ $found -eq 1 ] || error "Failover: third component not found"
1744 sel_layout_sanity $comp_file 3
1746 run_test 20b "Remove component without instantiation when there is no space"
1749 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1750 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1751 skip "skipped for lustre < $SEL_VER"
1753 local comp_file=$DIR/$tdir/$tfile
1757 test_mkdir -p $DIR/$tdir
1759 # pool is used to limit available OSTs to 0 and 1, so we can set all
1760 # available OSTs out of space
1761 pool_add $TESTNAME || error "Pool creation failed"
1762 pool_add_targets $TESTNAME 0 1 || error "Pool add targets failed"
1764 # without this, a previous delete can finish after we check free space
1765 wait_delete_completed
1768 $LFS setstripe -E 100M -E -1 -p $TESTNAME -z 64M $comp_file ||
1769 error "Create $comp_file failed"
1773 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
1775 local wms2=$(ost_watermarks_set_enospc $tfile $ost_idx2 |
1777 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
1778 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx2 $wms2" EXIT
1780 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=120 &&
1781 error "dd should fail with ENOSPC"
1783 flg_opts="--comp-flags init"
1784 found=$($LFS find --comp-start 0M -E 100M $flg_opts $comp_file | wc -l)
1785 [ $found -eq 1 ] || error "Write: First component not found"
1787 flg_opts="--comp-flags ^init"
1788 found=$($LFS find --comp-start 100M -E 100M $flg_opts $comp_file |wc -l)
1789 [ $found -eq 1 ] || error "Write: 0-length component not found"
1791 flg_opts="--comp-flags extension"
1792 found=$($LFS find --comp-start 100M -E EOF $flg_opts $comp_file | wc -l)
1793 [ $found -eq 1 ] || error "Write: third extension component not found"
1795 sel_layout_sanity $comp_file 3
1797 run_test 20c "Test inability to stripe new extension component"
1800 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1801 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1802 skip "skipped for lustre < $SEL_VER"
1804 local comp_file=$DIR/$tdir/$tfile
1805 test_mkdir -p $DIR/$tdir
1807 wait_delete_completed
1810 pool_add $TESTNAME || error "Pool creation failed"
1811 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
1812 $LFS setstripe -E 64m -E -1 -p $TESTNAME -z 64M $comp_file ||
1813 error "Create $comp_file failed"
1815 replay_barrier $SINGLEMDS
1817 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
1818 dd if=/dev/zero bs=1M count=1 seek=100 of=$comp_file
1821 ost_watermarks_clear_enospc $tfile 0 $wms
1822 [ $RC -eq 0 ] || error "dd failed: $RC"
1824 $LFS getstripe $comp_file
1825 local flg_opts="--comp-start 64M -E 128M --comp-flags init"
1826 local found=$($LFS find $flg_opts $comp_file | wc -l)
1827 [ $found -eq 1 ] || error "Write: component (64M-128M) not found"
1829 local ost_idx=$($LFS getstripe -I3 -i $comp_file)
1830 [ "$ost_idx" != "-1" ] && error "Write: EXT component disappeared"
1834 found=$($LFS find $flg_opts $comp_file | wc -l)
1835 [ $found -eq 1 ] || error "Failover: component (64M-128M) not found"
1837 ost_idx=$($LFS getstripe -I3 -i $comp_file)
1838 [ "$ost_idx" != "-1" ] && error "Failover: EXT component disappeared"
1840 sel_layout_sanity $comp_file 3
1842 run_test 20d "Low on space + 0-length comp: force extension"
1845 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1846 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1847 skip "skipped for lustre < $SEL_VER"
1849 local comp_file=$DIR/$tdir/$tfile
1850 test_mkdir -p $DIR/$tdir
1852 wait_delete_completed
1855 pool_add $TESTNAME || error "Pool creation failed"
1856 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
1858 $LFS setstripe -E 64m -E 640M -z 64M -p $TESTNAME -E -1 $comp_file ||
1859 error "Create $comp_file failed"
1861 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
1863 dd if=/dev/zero bs=1M count=1 seek=100 of=$comp_file
1866 ost_watermarks_clear_enospc $tfile 0 $wms
1867 [ $RC -eq 0 ] || error "dd failed $RC"
1869 $LFS getstripe $comp_file
1870 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
1871 local found=$($LFS find $flg_opts $comp_file | wc -l)
1872 [ $found -eq 1 ] || error "Write: component (64M-EOF) not found"
1874 local ost_idx=$($LFS getstripe -I2 -i $comp_file)
1875 [ "$ost_idx" != "" ] && error "Write: 0-length component still exists"
1876 ost_idx=$($LFS getstripe -I3 -i $comp_file)
1877 [ "$ost_idx" != "" ] && error "Write: extension component still exists"
1879 sel_layout_sanity $comp_file 2
1881 run_test 20e "ENOSPC with next real comp: spillover and backward extension"
1883 # Simple DoM interaction test
1885 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1886 skip "skipped for lustre < $SEL_VER"
1888 local comp_file=$DIR/$tdir/$tfile
1892 test_mkdir -p $DIR/$tdir
1894 # simple, correct self-extending layout after DoM component
1895 $LFS setstripe -E 1M -L mdt -E -1 -z 64m $comp_file || \
1896 error "Create $comp_file failed"
1898 # Write to DoM component & to self-extending comp after it
1899 dd if=/dev/zero bs=1M count=12 of=$comp_file ||
1900 error "dd to extend failed"
1902 flg_opts="--comp-flags init"
1903 found=$($LFS find --comp-start 1M -E 65M $flg_opts $comp_file | wc -l)
1904 [ $found -eq 1 ] || error "Write: extended component not found"
1906 flg_opts="--comp-flags extension"
1907 found=$($LFS find --comp-start 65M $flg_opts $comp_file | wc -l)
1908 [ $found -eq 1 ] || error "Write: extension component not found"
1910 sel_layout_sanity $comp_file 3
1912 run_test 21a "Simple DoM interaction tests"
1914 # DoM + extension + removal
1916 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1917 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1918 skip "skipped for lustre < $SEL_VER"
1920 local comp_file=$DIR/$tdir/$tfile
1921 local ost_name=$(ostname_from_index 0)
1925 test_mkdir -p $DIR/$tdir
1927 # DoM, extendable component, further extendable component
1928 $LFS setstripe -E 1M -L mdt -E 256M -i 0 -z 64M -E -1 -z 128M \
1929 $comp_file || error "Create $comp_file failed"
1931 found=$($LFS find --comp-start 1M -E 1M $flg_opts $comp_file | wc -l)
1932 [ $found -eq 1 ] || error "Write: Zero length component not found"
1934 # This also demonstrates that we will avoid degraded OSTs
1935 do_facet ost1 $LCTL set_param -n obdfilter.$ost_name.degraded=1
1936 # sleep to guarantee we see the degradation
1939 # un-degrade on exit
1940 stack_trap "do_facet ost1 $LCTL set_param -n \
1941 obdfilter.$ost_name.degraded=0; sleep_maxage" EXIT
1943 # This should remove the first component after DoM and spill over to
1945 dd if=/dev/zero bs=1M count=2 of=$comp_file ||
1946 error "dd to remove+spill over failed"
1948 found=$($LFS find --comp-start 1M -E 1M $flg_opts $comp_file | wc -l)
1949 [ $found -eq 0 ] || error "Write: Zero length component still present"
1951 flg_opts="--comp-flags init"
1952 found=$($LFS find --comp-start 1M -E 129M $flg_opts $comp_file | wc -l)
1953 [ $found -eq 1 ] || error "Write: extended component not found"
1955 flg_opts="--comp-flags extension"
1956 found=$($LFS find --comp-start 129M -E EOF $flg_opts $comp_file |wc -l)
1957 [ $found -eq 1 ] || error "Write: extension component not found"
1959 sel_layout_sanity $comp_file 3
1961 run_test 21b "DoM followed by extendable component with removal"
1963 # Test of repeat component behavior with OOS/degraded OST
1965 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1966 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1967 skip "skipped for lustre < $SEL_VER"
1969 local comp_file=$DIR/$tdir/$tfile
1973 test_mkdir -p $DIR/$tdir
1975 $LFS setstripe -E -1 -c 1 -z 128M $comp_file ||
1976 error "Create $comp_file failed"
1978 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1979 local ost_name=$(ostname_from_index $ost_idx1)
1981 # write past end of first component, so it is extended
1982 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=130 ||
1983 error "dd to extend failed"
1985 flg_opts="--comp-flags extension"
1986 found=$($LFS find --comp-start 256M -E EOF $flg_opts $comp_file | wc -l)
1987 [ $found -eq 1 ] || error "Write: second component not found"
1989 # degrade OST for component 1
1990 do_facet ost$((ost_idx1+1)) $LCTL set_param -n \
1991 obdfilter.$ost_name.degraded=1
1992 # sleep to guarantee we see the degradation
1995 # un-degrade on exit
1996 stack_trap "do_facet ost$((ost_idx1+1)) $LCTL set_param -n \
1997 obdfilter.$ost_name.degraded=0; sleep_maxage" EXIT
1999 replay_barrier $SINGLEMDS
2001 # seek past the end of current comp & write, should cause a new comp
2002 # to be created (ie repeat previous comp)
2003 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=300 ||
2004 error "dd to repeat failed"
2006 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
2008 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
2010 flg_opts="--comp-flags init"
2011 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
2012 [ $found -eq 1 ] || error "Write: second component not found"
2014 flg_opts="--comp-flags extension"
2015 found=$($LFS find --comp-start 384M -E EOF $flg_opts $comp_file | wc -l)
2016 [ $found -eq 1 ] || error "Write: extension component not found"
2020 local ost_idx2_2=$($LFS getstripe -I2 -i $comp_file)
2021 [ $ost_idx2_2 -ne $ost_idx2 ] && error "$ost_idx2_2 != $ost_idx2"
2023 flg_opts="--comp-flags init"
2024 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
2025 [ $found -eq 1 ] || error "Failover: second component not found"
2027 flg_opts="--comp-flags extension"
2028 found=$($LFS find --comp-start 384M -E EOF $flg_opts $comp_file | wc -l)
2029 [ $found -eq 1 ] || error "Failover: extension component not found"
2031 sel_layout_sanity $comp_file 3
2033 run_test 22a "Test repeat component behavior with degraded OST"
2035 # Test repeat behavior with low space
2037 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2038 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2039 skip "skipped for lustre < $SEL_VER"
2041 local comp_file=$DIR/$tdir/$tfile
2045 test_mkdir -p $DIR/$tdir
2047 # without this, a previous delete can finish after we check free space
2048 wait_delete_completed
2051 $LFS setstripe -E -1 -c 1 -z 128M \
2052 $comp_file || error "Create $comp_file failed"
2054 # write past end of first component, so it is extended
2055 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=130 ||
2056 error "dd to extend failed"
2058 flg_opts="--comp-flags extension"
2059 found=$($LFS find --comp-start 256M -E EOF $flg_opts $comp_file | wc -l)
2060 [ $found -eq 1 ] || error "Write: Second component not found"
2062 # set our OST low on space
2063 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
2064 local wms=$(ost_watermarks_set_low_space $ost_idx1 | grep "watermarks")
2066 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
2068 # Write past end of current space, fail to extend, causing repeat
2069 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=300 ||
2070 error "dd to repeat failed"
2072 $LFS getstripe $comp_file
2074 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
2076 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
2078 flg_opts="--comp-flags init"
2079 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
2080 [ $found -eq 1 ] || error "Write: Second component not found"
2082 flg_opts="--comp-flags extension"
2083 found=$($LFS find --comp-start 384M -E EOF $flg_opts $comp_file | wc -l)
2084 [ $found -eq 1 ] || error "Write: Extension component not found"
2086 sel_layout_sanity $comp_file 3
2088 run_test 22b "Test simple 'out of space' condition with repeat"
2090 # This tests both "repeat" and "extend in place when repeat fails" aspects
2091 # of repeating components
2093 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2094 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2095 skip "skipped for lustre < $SEL_VER"
2097 local comp_file=$DIR/$tdir/$tfile
2101 test_mkdir -p $DIR/$tdir
2103 # pool is used to limit available OSTs to 0 and 1, so we can set all
2104 # available OSTs out of space
2105 pool_add $TESTNAME || error "Pool creation failed"
2106 pool_add_targets $TESTNAME 0 1 || error "Pool add targets failed"
2108 # without this, a previous delete can finish after we check free space
2109 wait_delete_completed
2112 $LFS setstripe -E -1 -z 64M -c 1 -p "$TESTNAME" $comp_file || \
2113 error "Create $comp_file failed"
2115 # write past end of first component, so it is extended
2116 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=80 conv=notrunc ||
2117 error "dd to extend failed"
2119 $LFS getstripe $comp_file
2121 flg_opts="--comp-flags extension"
2122 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
2123 [ $found -eq 1 ] || error "Write: second component not found"
2125 # set our OST out of space
2126 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
2127 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
2129 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
2131 # This should create a repeat component on a new OST
2132 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=180 conv=notrunc ||
2133 error "dd to repeat failed"
2135 $LFS getstripe $comp_file
2137 local comp_cnt=$($LFS getstripe --component-count $comp_file)
2138 [ $comp_cnt -ne 3 ] && error "component count: $comp_cnt, should be 3"
2140 # New second component should be on a different OST
2141 local ost_idx2=$($LFS getstripe --comp-start=128m \
2142 --comp-end=192m --comp-flags=init -i $comp_file)
2144 [ $ost_idx1 -eq $ost_idx2 ] && error "2nd comp: same OST $ost_idx1"
2146 local wms2=$(ost_watermarks_set_enospc $tfile $ost_idx2 |
2148 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx2 $wms2" EXIT
2150 # now that the second OST is out of space (as is the first OST), we
2151 # attempt to extend. This should result in an extension of the
2152 # existing component, rather than a new component.
2153 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=240 conv=notrunc ||
2154 error "dd for forced extension failed"
2156 $LFS getstripe $comp_file
2158 # clear out of space on first OST
2159 ost_watermarks_clear_enospc $tfile $ost_idx1 $wms
2161 # finally, now that the first OST has space again, we attempt to
2162 # extend one last time. This should create a new component on the
2164 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=300 conv=notrunc ||
2165 error "dd for repeat on first OST failed"
2167 $LFS getstripe $comp_file
2169 flg_opts="--comp-flags init"
2170 found=$($LFS find --comp-start 128M $flg_opts $comp_file | wc -l)
2171 [ $found -eq 1 ] || error "Write: second component not found"
2173 flg_opts="--comp-flags init"
2174 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
2175 [ $found -eq 1 ] || error "Write: third component not found"
2177 flg_opts="--comp-flags extension"
2178 found=$($LFS find --comp-start 320M -E EOF $flg_opts $comp_file | wc -l)
2179 [ $found -eq 1 ] || error "Write: extension component not found"
2181 sel_layout_sanity $comp_file 4
2183 run_test 22c "Test repeat with out of space on > 1 OST"
2185 test_22d_post_check() {
2188 local flg_opts="--comp-flags init"
2189 local found=$($LFS find --comp-start 0M -E 128M $flg_opts $comp_file |
2191 [ $found -eq 1 ] || {
2192 $LFS getstripe $comp_file
2193 error "$name: second component not found"
2196 flg_opts="--comp-flags extension"
2197 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
2198 [ $found -eq 1 ] || error "$name: third extension component not found"
2200 sel_layout_sanity $comp_file 2
2208 # write past end of first component
2209 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=70
2212 ost_watermarks_clear_enospc $tfile 0 $wms
2213 [ $RC -eq 0 ] || error "dd to force extend failed"
2215 test_22d_post_check $comp_file "Write"
2219 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2220 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2221 skip "skipped for lustre < $SEL_VER"
2223 local comp_file=$DIR/$tdir/$tfile
2227 test_mkdir -p $DIR/$tdir
2229 # without this, a previous delete can finish after we check free space
2230 wait_delete_completed
2233 # Pool allows us to force use of only certain OSTs
2234 pool_add $TESTNAME || error "Pool creation failed"
2235 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
2237 # 1. Fail to extend due to OOS, try to repeat within the same pool,
2238 # fail to stripe (again OOS) the 0-length component, remove the
2239 # repeated one, force the extension on the original one.
2240 $LFS setstripe -E -1 -p $TESTNAME -z 64M $comp_file ||
2241 error "Create $comp_file failed"
2243 replay_barrier $SINGLEMDS
2245 # set our OST out of space
2246 local wms=$(ost_watermarks_set_enospc $tfile 0 | grep "watermarks")
2248 test_22d_pre $comp_file "$wms"
2250 test_22d_post_check $comp_file "Failover"
2252 # 2. repeat with low on space: 0-length repeated component will be
2253 # striped, but still fails to be extended; otherwise the same as (1).
2255 $LFS setstripe -E -1 -p $TESTNAME -z 64M $comp_file ||
2256 error "Create $comp_file failed"
2258 replay_barrier $SINGLEMDS
2260 # set our OST low on space
2261 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
2263 test_22d_pre $comp_file "$wms"
2265 test_22d_post_check $comp_file "Failover"
2267 run_test 22d "out of/low on space + failed to repeat + forced extension"
2270 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2271 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2272 skip "skipped for lustre < $SEL_VER"
2274 local comp_file=$DIR/$tdir/$tfile
2275 test_mkdir -p $DIR/$tdir
2277 $LFS setstripe -z 64M -c 1 -E -1 $comp_file ||
2278 error "Create $comp_file failed"
2280 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file ||
2281 error "dd append failed"
2283 local flg_opts="--comp-start 0 -E EOF --comp-flags init"
2284 local found=$($LFS find $flg_opts $comp_file | wc -l)
2285 [ $found -eq 1 ] || error "Append: first component (0-EOF) not found"
2287 local ost_idx=$($LFS getstripe -I2 -i $comp_file)
2288 [ "$ost_idx" != "" ] && error "Append: second component still exists"
2290 sel_layout_sanity $comp_file 1
2292 run_test 23a "Append: remove EXT comp"
2295 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2296 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2297 skip "skipped for lustre < $SEL_VER"
2299 local comp_file=$DIR/$tdir/$tfile
2300 test_mkdir -p $DIR/$tdir
2302 $LFS setstripe -E 64m -E -1 -z 64M $comp_file ||
2303 error "Create $comp_file failed"
2305 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file ||
2306 error "dd append failed"
2308 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2309 local found=$($LFS find $flg_opts $comp_file | wc -l)
2310 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2312 local ost_idx=$($LFS getstripe -I3 -i $comp_file)
2313 [ "$ost_idx" != "" ] && error "Append: third component still exists"
2315 sel_layout_sanity $comp_file 2
2317 run_test 23b "Append with 0-length comp: remove EXT comp"
2320 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2321 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2322 skip "skipped for lustre < $SEL_VER"
2324 local comp_file=$DIR/$tdir/$tfile
2325 test_mkdir -p $DIR/$tdir
2327 wait_delete_completed
2330 pool_add $TESTNAME || error "Pool creation failed"
2331 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
2332 $LFS setstripe -E 64m -E -1 -p $TESTNAME -z 64M $comp_file ||
2333 error "Create $comp_file failed"
2335 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
2336 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file
2339 ost_watermarks_clear_enospc $tfile 0 $wms
2340 [ $RC -eq 0 ] || error "dd append failed: $RC"
2342 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2343 local found=$($LFS find $flg_opts $comp_file | wc -l)
2344 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2346 local ost_idx=$($LFS getstripe -I3 -i $comp_file)
2347 [ "$ost_idx" != "" ] && error "Append: EXT component still exists"
2349 sel_layout_sanity $comp_file 2
2351 run_test 23c "Append with low on space + 0-length comp: force extension"
2354 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2355 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2356 skip "skipped for lustre < $SEL_VER"
2358 local comp_file=$DIR/$tdir/$tfile
2359 test_mkdir -p $DIR/$tdir
2361 $LFS setstripe -E 64m -E 640M -z 64M -E -1 $comp_file ||
2362 error "Create $comp_file failed"
2364 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file ||
2365 error "dd append failed"
2367 flg_opts="--comp-start 64M -E 640M --comp-flags init"
2368 found=$($LFS find $flg_opts $comp_file | wc -l)
2369 [ $found -eq 1 ] || error "Append: component (64M-640M) not found"
2371 ost_idx=$($LFS getstripe -I3 -i $comp_file)
2372 [ "$ost_idx" != "" ] && error "Append: third component still exists"
2374 sel_layout_sanity $comp_file 3
2376 run_test 23d "Append with 0-length comp + next real comp: remove EXT comp"
2379 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2380 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2381 skip "skipped for lustre < $SEL_VER"
2383 local comp_file=$DIR/$tdir/$tfile
2384 test_mkdir -p $DIR/$tdir
2386 wait_delete_completed
2389 pool_add $TESTNAME || error "Pool creation failed"
2390 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
2392 $LFS setstripe -E 64m -E 640M -z 64M -p $TESTNAME -E -1 $comp_file ||
2393 error "Create $comp_file failed"
2395 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
2397 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file
2400 ost_watermarks_clear_enospc $tfile 0 $wms
2401 [ $RC -eq 0 ] || error "dd append failed $RC"
2403 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2404 local found=$($LFS find $flg_opts $comp_file | wc -l)
2405 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2407 local ost_idx=$($LFS getstripe -I2 -i $comp_file)
2408 [ "$ost_idx" != "" ] && error "Append: 0-length component still exists"
2409 ost_idx=$($LFS getstripe -I3 -i $comp_file)
2410 [ "$ost_idx" != "" ] && error "Append: extension component still exists"
2412 sel_layout_sanity $comp_file 2
2414 run_test 23e "Append with next real comp: spillover and backward extension"
2417 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2418 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2419 skip "skipped for lustre < $SEL_VER"
2421 local comp_file=$DIR/$tdir/$tfile
2422 test_mkdir -p $DIR/$tdir
2424 $LFS setstripe -z 64M -c 1 -E -1 $comp_file ||
2425 error "Create $comp_file failed"
2427 local ost_idx=$($LFS getstripe -I1 -i $comp_file)
2428 local wms=$(ost_watermarks_set_low_space $ost_idx | grep "watermarks")
2430 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file
2433 ost_watermarks_clear_enospc $tfile $ost_idx $wms
2434 [ $RC -eq 0 ] || error "dd append failed"
2436 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2437 local found=$($LFS find $flg_opts $comp_file | wc -l)
2438 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2440 ost_idx=$($LFS getstripe -I2 -i $comp_file)
2441 [ "$ost_idx" != "" ] && error "Append: extension component still exists"
2443 sel_layout_sanity $comp_file 2
2445 run_test 23f "Append with low on space: repeat and remove EXT comp"
2454 [ "$OSTCOUNT" -lt "3" ] && skip_env "needs >= 3 OSTs"
2456 trap cleanup_24 EXIT RETURN
2458 local file=$DIR/$tfile
2460 $LFS setstripe -E 1m -c1 -o0 -E eof -c2 -o1,2 $file ||
2461 error "setstripe on $file"
2463 dd if=/dev/zero of=$file bs=1M count=3 || error "dd failed for $file"
2466 filefrag -ves $file || error "filefrag $file failed"
2467 filefrag_op=$(filefrag -ve -k $file |
2468 sed -n '/ext:/,/found/{/ext:/d; /found/d; p}')
2470 #Filesystem type is: bd00bd0
2471 #File size of /mnt/lustre/f24a.sanity-pfl is 3145728 (3072 blocks of 1024 bytes)
2472 # ext: device_logical: physical_offset: length: dev: flags:
2473 # 0: 0.. 1023: 1572864.. 1573887: 1024: 0000: net
2474 # 1: 0.. 1023: 1572864.. 1573887: 1024: 0002: net
2475 # 2: 1024.. 2047: 1573888.. 1574911: 1024: 0001: last,net
2476 #/mnt/lustre/f24a.sanity-pfl: 3 extents found
2478 last_lun=$(echo $filefrag_op | cut -d: -f5)
2483 for line in $filefrag_op; do
2484 frag_lun=$(echo $line | cut -d: -f5)
2485 ext_len=$(echo $line | cut -d: -f4)
2486 if [[ "$frag_lun" != "$last_lun" ]]; then
2487 if (( tot_len != 1024 )); then
2489 error "$file: OST$last_lun $tot_len != 1024"
2495 (( tot_len += ext_len ))
2498 if (( num_luns != 3 || tot_len != 1024 )); then
2500 error "$file: $num_luns != 3, $tot_len != 1024 on OST$last_lun"
2503 echo "FIEMAP on $file succeeded"
2505 run_test 24a "FIEMAP upon PFL file"
2508 local pfl_f=$DIR/$tdir/"$tfile"_pfl
2509 local dom_f=$DIR/$tdir/"$tfile"_dom
2510 local common_f=$DIR/$tdir/"$tfile"_common
2514 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2515 $LFS setstripe -E 10M -S 64k -c -1 -E 20M -S 1M -E -1 -S 2M -c 1 \
2516 $pfl_f || error "setstripe $pfl_f failed"
2517 $LFS setstripe -E 256k -L mdt -E -1 -S 1M $dom_f ||
2518 error "setstripe $dom_f failed"
2519 $LFS setstripe -S 512K -c -1 $common_f ||
2520 error "setstripe $common_f failed"
2522 #verify lov_getstripe_old with PFL file
2523 stripe_count=$(lov_getstripe_old $pfl_f |
2524 awk '/stripe_count/ { print $2 }')
2525 stripe_size=$(lov_getstripe_old $pfl_f |
2526 awk '/stripe_size/ { print $2 }')
2527 [ $stripe_count -eq 1 ] ||
2528 error "stripe_count $stripe_count !=1 for $pfl_f"
2529 [ $stripe_size -eq 2097152 ] ||
2530 error "stripe_size $stripe_size != 2097152 for $pfl_f"
2532 #verify lov_getstripe_old with DoM file
2533 stripe_count=$(lov_getstripe_old $dom_f |
2534 awk '/stripe_count/ { print $2 }')
2535 stripe_size=$(lov_getstripe_old $dom_f |
2536 awk '/stripe_size/ { print $2 }')
2537 [ $stripe_count -eq 1 ] ||
2538 error "stripe_count $stripe_count !=1 for $dom_f"
2539 [ $stripe_size -eq 1048576 ] ||
2540 error "stripe_size $stripe_size != 1048576 for $dom_f"
2542 #verify lov_getstripe_old with common file
2543 stripe_count=$(lov_getstripe_old $common_f |
2544 awk '/stripe_count/ { print $2 }')
2545 stripe_size=$(lov_getstripe_old $common_f |
2546 awk '/stripe_size/ { print $2 }')
2547 [ $stripe_count -eq $OSTCOUNT ] ||
2548 error "stripe_count $stripe_count !=$OSTCOUNT for $common_f"
2549 [ $stripe_size -eq 524288 ] ||
2550 error "stripe_size $stripe_size != 524288 for $common_f"
2552 run_test 25 "Verify old lov stripe API with PFL files"
2555 $LFS setstripe -E 1m -S 1M -c 1 $DIR/$tfile
2556 dd if=/dev/urandom bs=1M count=10 >> $DIR/$tfile
2557 [ $? != 0 ] || error "append must return an error"
2559 run_test 26a "Append to not-existent component"
2562 $LFS setstripe -E 1m -S 1M -c 1 $DIR/$tfile
2563 dd if=/dev/urandom bs=1M count=1 > $DIR/$tfile
2564 dd if=/dev/urandom bs=1M count=1 >> $DIR/$tfile
2565 [ $? != 0 ] || error "append must return an error"
2567 run_test 26b "Append to not-existend component, file size is unknown"
2570 $LFS setstripe -E 1m -S 1M -c 1 $DIR/$tfile
2571 dd if=/dev/urandom bs=2M count=1 >> $DIR/$tfile
2572 [ $? != 0 ] || error "append must return an error"
2574 run_test 26c "Append to not-existend component, crossing the component border"
2577 [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] ||
2578 skip "server does not support overstriping"
2579 (( $MDS1_VERSION >= $(version_code 2.15.55.102) )) ||
2580 skip "need MDS >= 2.12.55.102 for mdt_dump_lmm fix"
2582 stack_trap "rm -f $DIR/$tfile"
2583 # start_full_debug_logging
2584 $LFS setstripe -S 64K -C -1 $DIR/$tfile || error "create $tfile failed"
2585 $LFS getstripe -c $DIR/$tfile || error "getstripe $tfile failed"
2587 $LFS getstripe -c $DIR/$tfile || error "getstripe failed after clear"
2589 test_mkdir $DIR/$tdir
2590 stack_trap "rm -rf $DIR/$tdir/$tfile"
2591 $LFS setstripe -S 64K -C -1 $DIR/$tdir || error "mkdir $tdir failed"
2592 $LFS getstripe -y $DIR/$tdir || error "getstripe $tdir failed"
2593 touch $DIR/$tdir/$tfile || error "create $tdir/$tfile failed"
2595 $LFS getstripe -c $DIR/$tdir/$tfile ||
2596 error "getstripe $tdir/$tfile failed"
2597 #stop_full_debug_logging
2599 run_test 27 "overstriping with -C -1 in mdt_dump_lmm"
2601 complete_test $SECONDS
2602 check_and_cleanup_lustre