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 ssize=$($LFS getstripe -S -I1 $DIR/$tdir/$tfile)
339 local count=$($LFS getstripe -c -I1 $DIR/$tdir/$tfile)
340 count=$((count * ssize / 1048576))
341 [ $count -eq 10 ] || error "comp1 stripe count $count, should be 10"
342 ssize=$($LFS getstripe -S -I2 $DIR/$tdir/$tfile)
343 count=$($LFS getstripe -c -I2 $DIR/$tdir/$tfile)
344 count=$((count * ssize / 1048576))
345 [ $count -eq 100 ] || error "comp2 stripe count $count, should be 100"
346 ssize=$($LFS getstripe -S -I3 $DIR/$tdir/$tfile)
347 count=$($LFS getstripe -c -I3 $DIR/$tdir/$tfile)
348 [ $count -eq $LOV_MAX_STRIPE_COUNT ] ||
349 echo "comp4 stripe count $count != $LOV_MAX_STRIPE_COUNT"
351 small_write $comp_file $rw_len || error "Verify RW failed"
353 rm -f $comp_file || error "Delete $comp_file failed"
355 run_test 1c "Test overstriping w/max stripe count"
358 local comp_file=$DIR/$tdir/$tfile
359 local rw_len=$((5 * 1024 * 1024)) # 5M
362 test_mkdir $DIR/$tdir
365 multiop $comp_file oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
366 error "create failed $comp_file"
368 $LFS setstripe --component-add $params $comp_file ||
369 error "Add component to $comp_file failed"
371 check_component_count $comp_file 1
373 dd if=/dev/zero of=$comp_file bs=1M count=1 > /dev/null 2>&1 ||
374 error "Write first component failed"
375 dd if=$comp_file of=/dev/null bs=1M count=1 > /dev/null 2>&1 ||
376 error "Read first component failed"
378 dd if=/dev/zero of=$comp_file bs=1M count=2 > /dev/null 2>&1 &&
379 error "Write beyond component should fail"
380 dd if=$comp_file of=/dev/null bs=1M count=2 > /dev/null 2>&1 ||
381 error "Read beyond component should short read, not fail"
383 $LFS setstripe --component-add -E 2M -S 1M -c 1 $comp_file ||
384 error "Add component to $comp_file failed"
386 check_component_count $comp_file 2
388 $LFS setstripe --component-add -E -1 -c 3 $comp_file ||
389 error "Add last component to $comp_file failed"
391 check_component_count $comp_file 3
393 small_write $comp_file $rw_len || error "Verify RW failed"
395 rm -f $comp_file || error "Delete $comp_file failed"
399 base_test_2 "-E 1m -S 1m"
401 run_test 2a "Add components to existing file"
404 base_test_2 "-E 1m -L mdt"
406 run_test 2b "Add components w/DOM to existing file"
408 del_comp_and_verify() {
415 if [ $id == "init" -o $id == "^init" ]; then
416 opt="--component-flags="
419 $LFS setstripe --component-del $opt$id $comp_file ||
420 error "Delete component $id from $comp_file failed"
422 local comp_cnt=$($LFS getstripe --component-count $comp_file)
423 if grep -q "has no stripe info" <<< "$comp_cnt" ; then
426 [ $comp_cnt -ne $left ] && error "$comp_cnt != $left"
428 $CHECKSTAT -s $size $comp_file || error "size != $size"
432 local comp_file=$DIR/$tdir/$tfile
435 test_mkdir $DIR/$tdir
438 $LFS setstripe $params $comp_file || error "Create $comp_file failed"
440 check_component_count $comp_file 3
442 dd if=/dev/zero of=$comp_file bs=1M count=2
444 $LFS setstripe --component-del -I 2 $comp_file &&
445 error "Component deletion makes hole"
447 del_comp_and_verify $comp_file 3 2 $((2 * 1024 * 1024))
448 del_comp_and_verify $comp_file 2 1 $((1 * 1024 * 1024))
449 del_comp_and_verify $comp_file 1 0 0
451 rm -f $comp_file || error "Delete $comp_file failed"
453 $LFS setstripe -E 1M -S 1M -E 16M -E -1 $comp_file ||
454 error "Create second $comp_file failed"
456 del_comp_and_verify $comp_file "^init" 1 0
457 del_comp_and_verify $comp_file "init" 0 0
458 rm -f $comp_file || error "Delete second $comp_file failed"
462 base_test_3 "-E 1M -S 1M -E 64M -c 2 -E -1 -c 3"
464 run_test 3a "Delete components from existing file"
467 base_test_3 "-E 1M -L mdt -E 64M -S 1M -c 2 -E -1 -c 3"
469 run_test 3b "Delete components w/DOM from existing file"
472 skip "Not supported in PFL"
473 # In PFL project, only LCME_FL_INIT is supported, and it can't
474 # be altered by application.
476 run_test 4 "Modify component flags in existing file"
479 local parent=$DIR/$tdir
480 local comp_file=$DIR/$tdir/$tfile
481 local subdir=$parent/subdir
486 # set default layout to parent directory
487 $LFS setstripe -E 64M -c 2 -i 0 -E -1 -c 4 -i 0 $parent ||
488 error "Set default layout to $parent failed"
490 # create file under parent
491 touch $comp_file || error "Create $comp_file failed"
492 check_component_count $comp_file 2
494 #instantiate all components, so that objs are allocted
495 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=65k
497 local ost_idx=$($LFS getstripe -I1 -i $comp_file)
498 [ $ost_idx -ne 0 ] &&
499 error "component 1 ost_idx $ost_idx != 0"
501 ost_idx=$($LFS getstripe -I2 -i $comp_file)
502 [ $ost_idx -ne 0 ] &&
503 error "component 2 ost_idx $ost_idx != 0"
505 # create subdir under parent
506 mkdir -p $subdir || error "Create subdir $subdir failed"
508 comp_cnt=$($LFS getstripe -d --component-count $subdir)
509 [ $comp_cnt -ne 2 ] && error "subdir $comp_cnt != 2"
511 # create file under subdir
512 touch $subdir/$tfile || error "Create $subdir/$tfile failed"
514 check_component_count $subdir/$tfile 2
516 # delete default layout setting from parent
517 $LFS setstripe -d $parent ||
518 error "Delete default layout from $parent failed"
520 comp_cnt=$($LFS getstripe -d --component-count $parent)
521 [ $comp_cnt -ne 0 ] && error "$comp_cnt isn't 0"
523 rm -f $comp_file || error "Delete $comp_file failed"
524 rm -f $subdir/$tfile || error "Delete $subdir/$tfile failed"
525 rm -r $subdir || error "Delete subdir $subdir failed"
526 rmdir $parent || error "Delete dir $parent failed"
528 run_test 5 "Inherit composite layout from parent directory"
531 local comp_file=$DIR/$tdir/$tfile
533 test_mkdir $DIR/$tdir
536 $LFS setstripe -c 1 -S 128K $comp_file ||
537 error "Create v1 $comp_file failed"
539 check_component_count $comp_file 0
541 dd if=/dev/urandom of=$comp_file bs=1M count=5 oflag=sync ||
542 error "Write to v1 $comp_file failed"
544 local old_chksum=$(md5sum $comp_file)
546 # Migrate v1 to composite
547 $LFS migrate -E 1M -S 512K -c 1 -E -1 -S 1M -c 2 $comp_file ||
548 error "Migrate(v1 -> composite) $comp_file failed"
550 check_component_count $comp_file 2
552 local chksum=$(md5sum $comp_file)
553 [ "$old_chksum" != "$chksum" ] &&
554 error "(v1 -> compsoite) $old_chksum != $chksum"
556 # Migrate composite to composite
557 $LFS migrate -E 1M -S 1M -c 2 -E 4M -S 1M -c 2 \
558 -E -1 -S 3M -c 3 $comp_file ||
559 error "Migrate(compsoite -> composite) $comp_file failed"
561 check_component_count $comp_file 3
563 chksum=$(md5sum $comp_file)
564 [ "$old_chksum" != "$chksum" ] &&
565 error "(composite -> compsoite) $old_chksum != $chksum"
567 # Migrate composite to v1
568 $LFS migrate -c 2 -S 2M $comp_file ||
569 error "Migrate(composite -> v1) $comp_file failed"
571 check_component_count $comp_file 0
573 chksum=$(md5sum $comp_file)
574 [ "$old_chksum" != "$chksum" ] &&
575 error "(composite -> v1) $old_chksum != $chksum"
577 rm -f $comp_file || error "Delete $comp_file failed"
579 run_test 6 "Migrate composite file"
582 test_mkdir $DIR/$tdir
583 chmod 0777 $DIR/$tdir || error "chmod $tdir failed"
585 local comp_file=$DIR/$tdir/$tfile
586 $RUNAS $LFS setstripe -E 1M -S 1M -c 1 $comp_file ||
587 error "Create composite file $comp_file failed"
589 $RUNAS $LFS setstripe --component-add -E 64M -c 4 $comp_file ||
590 error "Add component to $comp_file failed"
592 $RUNAS $LFS setstripe --component-del -I 2 $comp_file ||
593 error "Delete component from $comp_file failed"
595 $RUNAS $LFS setstripe --component-add -E -1 -c 5 $comp_file ||
596 error "Add last component to $comp_file failed"
598 rm $comp_file || error "Delete composite failed"
600 run_test 7 "Add/Delete/Create composite file by non-privileged user"
603 local parent=$DIR/$tdir
606 mkdir_on_mdt0 $parent
608 $LFS setstripe -E 2M -c 1 -S 1M -E 16M -c 2 -S 2M \
609 -E -1 -c 4 -S 4M $parent ||
610 error "Set default layout to $parent failed"
612 bash rundbench -C -D $parent 2 || error "dbench failed"
614 rm -fr $parent || error "Delete dir $parent failed"
616 run_test 8 "Run dbench over composite files"
619 local comp_file=$DIR/$tdir/$tfile
621 test_mkdir $DIR/$tdir
624 $LFS setstripe -E 1M -S 1M -E -1 -c 1 $comp_file ||
625 error "Create $comp_file failed"
627 check_component_count $comp_file 2
629 replay_barrier $SINGLEMDS
631 # instantiate the 2nd component
632 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=2k
634 local f1=$($LFS getstripe -I2 $comp_file |
635 awk '/l_fid:/ {print $7}')
636 echo "before MDS recovery, the ost fid of 2nd component is $f1"
639 local f2=$($LFS getstripe -I2 $comp_file |
640 awk '/l_fid:/ {print $7}')
641 echo "after MDS recovery, the ost fid of 2nd component is $f2"
642 [ "x$f1" == "x$f2" ] || error "$f1 != $f2"
644 run_test 9 "Replay layout extend object instantiation"
647 echo $($LFS getstripe $1 |
648 awk '$1 == "lcm_entry_count:" { printf("%d", $2) }
649 $1 == "lcme_extent.e_start:" { printf("[%#lx", $2) }
650 $1 == "lcme_extent.e_end:" { printf(",%s]", $2) }')
654 local parent=$DIR/$tdir
657 save_layout_restore_at_exit $MOUNT
661 # mount root on $MOUNT2 if FILESET is set
662 if [ -n "$FILESET" ]; then
663 FILESET="" mount_client $MOUNT2 ||
664 error "mount $MOUNT2 fail"
668 $LFS setstripe -d $root || error "clear root layout"
670 # set root composite layout
671 $LFS setstripe -E 2M -c 1 -S 1M -E 16M -c2 -S 2M \
672 -E -1 -c 4 -S 4M $root ||
673 error "Set root layout failed"
675 if [ "$root" == "$MOUNT2" ]; then
676 umount_client $MOUNT2 ||
677 error "umount $MOUNT2 fail"
681 # set a different layout for parent
682 $LFS setstripe -E -1 -c 1 -S 1M $parent ||
683 error "set $parent layout failed"
686 local f1_entry=$(component_dump $parent/file1)
688 # delete parent's layout
689 $LFS setstripe -d $parent || error "Clear $parent layout failed"
692 local f2_entry=$(component_dump $parent/file2)
694 # verify layout inheritance
696 local f1_expect="1[0,EOF]"
697 local f2_expect="3[0,2097152][0x200000,16777216][0x1000000,EOF]"
699 echo "f1 expect=$f1_expect"
700 echo "f1 get =$f1_entry"
701 echo "f2 expect=$f2_expect"
702 echo "f2 get =$f2_entry"
704 [ x$f1_expect != x$f1_entry ] &&
705 error "$parent/file1 does not inherite parent layout"
706 [ x$f2_expect != x$f2_entry ] &&
707 error "$parent/file2 does not inherite root layout"
711 run_test 10 "Inherit composite template from root"
714 local comp_file=$DIR/$tdir/$tfile
715 test_mkdir $DIR/$tdir
718 # only 1st component instantiated
719 $LFS setstripe -E 1M -S 1M -E 2M -E 3M -E -1 $comp_file ||
720 error "Create $comp_file failed"
722 local f1=$($LFS getstripe -I1 $comp_file | grep "l_fid")
723 [[ -z $f1 ]] && error "1: 1st component uninstantiated"
724 local f2=$($LFS getstripe -I2 $comp_file | grep "l_fid")
725 [[ -n $f2 ]] && error "1: 2nd component instantiated"
726 local f3=$($LFS getstripe -I3 $comp_file | grep "l_fid")
727 [[ -n $f3 ]] && error "1: 3rd component instantiated"
728 local f4=$($LFS getstripe -I4 $comp_file | grep "l_fid")
729 [[ -n $f4 ]] && error "1: 4th component instantiated"
731 # the first 2 components instantiated
732 # Truncate to exact start of new component - LU-12586
733 $TRUNCATE $comp_file $((1024*1024*1))
735 f2=$($LFS getstripe -I2 $comp_file | grep "l_fid")
736 [[ -z $f2 ]] && error "2: 2nd component uninstantiated"
737 f3=$($LFS getstripe -I3 $comp_file | grep "l_fid")
738 [[ -n $f3 ]] && error "2: 3rd component instantiated"
739 f4=$($LFS getstripe -I4 $comp_file | grep "l_fid")
740 [[ -n $f4 ]] && error "2: 4th component instantiated"
742 # the first 3 components instantiated
743 $TRUNCATE $comp_file $((1024*1024*3 - 1))
744 $TRUNCATE $comp_file $((1024*1024*1+1))
746 f2=$($LFS getstripe -I2 $comp_file | grep "l_fid")
747 [[ -z $f2 ]] && error "3: 2nd component uninstantiated"
748 f3=$($LFS getstripe -I3 $comp_file | grep "l_fid")
749 [[ -z $f3 ]] && error "3: 3rd component uninstantiated"
750 f4=$($LFS getstripe -I4 $comp_file | grep "l_fid")
751 [[ -n $f4 ]] && error "3: 4th component instantiated"
753 # all 4 components instantiated, using append write
754 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=2k
756 rwv -f $comp_file -w -a -n 2 $((1024*1023)) 1
759 f4=$($LFS getstripe -I4 $comp_file | grep "l_fid")
760 [[ -z $f4 ]] && error "4: 4th component uninstantiated"
764 run_test 11a "Verify component instantiation with write/truncate"
767 [ $OSTCOUNT -lt 4 ] && skip "needs >= 4 OSTs"
769 local file=$DIR/$tdir/$tfile
771 test_mkdir $DIR/$tdir
774 $LFS setstripe -E 1m -E 1g -c 4 -E eof $DIR/$tdir ||
775 error "setstripe dir $DIR/$tdir failed"
776 expand_truncate_test $file ||
777 error "expand_truncate_test failed on $file"
779 run_test 11b "truncate file set file size correctly"
782 [ $OSTCOUNT -lt 3 ] && skip "needs >= 3 OSTs"
784 local file=$DIR/$tdir/$tfile
785 test_mkdir $DIR/$tdir
788 # specify ost list for component
789 $LFS setstripe -E 2M -S 1M -c 2 -o 0,1 -E 4M -c 2 -o 1,2 \
790 -E 6M -c 2 -o 2,1 -E 8M -c 1 -i 2 -E -1 $file ||
791 error "Create $file failed"
793 # clear lod component cache
794 stop $SINGLEMDS || error "stop MDS"
795 local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
796 start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || error "start MDS"
798 # instantiate all components
799 $TRUNCATE $file $((1024*1024*8+1))
801 #verify object alloc order
802 local o1=$($LFS getstripe -I1 $file |
803 awk '/l_ost_idx:/ {printf("%d",$5)}')
804 [[ $o1 != "01" ]] && error "$o1 is not 01"
806 local o2=$($LFS getstripe -I2 $file |
807 awk '/l_ost_idx:/ {printf("%d",$5)}')
808 [[ $o2 != "12" ]] && error "$o2 is not 12"
810 local o3=$($LFS getstripe -I3 $file |
811 awk '/l_ost_idx:/ {printf("%d",$5)}')
812 [[ $o3 != "21" ]] && error "$o3 is not 21"
814 local o4=$($LFS getstripe -I4 $file |
815 awk '/l_ost_idx:/ {printf("%d",$5)}')
816 [[ $o4 != "2" ]] && error "$o4 is not 2"
820 run_test 12 "Verify ost list specification"
822 test_13() { # LU-9311
823 [ $OSTCOUNT -lt 8 ] && skip "needs >= 8 OSTs"
825 local file=$DIR/$tfile
827 local dd_size=$(($dd_count * 1024 * 1024))
831 $LFS setstripe -E 1M -S 1M -c 1 -E 2M -c 2 -E -1 -c -1 -i 1 $file ||
832 error "Create $file failed"
833 dd if=/dev/zero of=$file bs=1M count=$dd_count
834 real_size=$(stat -c %s $file)
835 [ $real_size -eq $dd_size ] ||
836 error "dd actually wrote $real_size != $dd_size bytes"
840 run_test 13 "shouldn't reprocess granted resent request"
843 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
844 local file=$DIR/$tdir/$tfile
845 test_mkdir -p $DIR/$tdir
848 $LFS setstripe -E1m -c1 -S1m --pool="pool1" -E2m \
849 -E4m -c2 -S2m --pool="pool2" -E-1 $file ||
850 error "Create $file failed"
852 # check --pool inheritance
854 pool="$($LFS getstripe -I2 --pool $file)"
855 [ x"$pool" != "xpool1" ] && $LFS getstripe -I2 $file &&
856 error "$file: component 2 doesn't have poolname pool1"
857 pool="$($LFS getstripe -I4 --pool $file)"
858 [ x"$pool" != "xpool2" ] && $LFS getstripe -I4 $file &&
859 error "$file: component 4 doesn't have poolname pool2"
861 #check --stripe-count inheritance
863 count="$($LFS getstripe -I2 -c $file)"
864 [ $count -ne 1 ] && $LFS getstripe -I2 $file &&
865 error "$file: component 2 doesn't have 1 stripe_count"
866 count="$($LFS getstripe -I4 -c $file)"
867 [ $count -ne 2 ] && $LFS getstripe -I4 $file &&
868 error "$file: component 4 doesn't have 2 stripe_count"
870 #check --stripe-size inheritance
872 size="$($LFS getstripe -I2 -S $file)"
873 [ $size -ne $((1024*1024)) ] && $LFS getstripe -I2 $file &&
874 error "$file: component 2 doesn't have 1M stripe_size"
875 size="$($LFS getstripe -I4 -S $file)"
876 [ $size -ne $((1024*1024*2)) ] && $LFS getstripe -I4 $file &&
877 error "$file: component 4 doesn't have 2M stripe_size"
881 run_test 14 "Verify setstripe poolname/stripe_count/stripe_size inheritance"
884 local parent=$DIR/$tdir
889 $LFS setstripe -d $parent || error "delete default layout"
891 $LFS setstripe -E 1M -S 1M -E 10M -E eof $parent/f1 || error "create f1"
892 $LFS setstripe -E 4M -E 20M -E eof $parent/f2 || error "create f2"
893 test_mkdir $parent/subdir
894 $LFS setstripe -E 6M -S 1M -c1 -E 30M -c4 -E eof -c $OSTCOUNT \
895 $parent/subdir || error "setstripe to subdir"
896 $LFS setstripe -E 8M -E eof $parent/subdir/f3 || error "create f3"
897 $LFS setstripe -c 1 $parent/subdir/f4 || error "create f4"
900 local found=$($LFS find --component-start +2M -E -15M $parent | wc -l)
901 [ $found -eq 0 ] || error "start+2M, end-15M, $found != 0"
904 found=$($LFS find --component-start +2M -E -35M $parent | wc -l)
905 [ $found -eq 2 ] || error "start+2M, end-35M, $found != 2"
908 found=$($LFS find --component-start +4M -E -eof $parent | wc -l)
909 [ $found -eq 1 ] || error "start+4M, end-eof, $found != 1"
911 local flg_opts="--component-flags init"
913 found=$($LFS find --component-start 1M -E 10M $flg_opts $parent | wc -l)
915 error "before write: start=1M, end=10M, flag=init, $found != 0"
917 dd if=/dev/zero of=$parent/f1 bs=1M count=2 ||
918 error "dd $parent/f1 failed"
921 found=$($LFS find --component-start 1M -E 10M $flg_opts $parent | wc -l)
923 error "after write: start=1M, end=10M, flag=init, $found != 1"
925 local ext_opts="--component-start -1M -E +5M"
926 # parent, subdir, f3, f4
927 found=$($LFS find $ext_opts $parent | wc -l)
928 [ $found -eq 4 ] || error "start-1M, end+5M, $found != 4"
930 local cnt_opts="--component-count +2"
932 found=$($LFS find $ext_opts $cnt_opts $parent | wc -l)
933 [ $found -eq 1 ] || error "start-1M, end+5M, count+2, $found != 1"
936 found=$($LFS find $ext_opts $cnt_opts $flg_opts $parent | wc -l)
938 error "start-1M, end+5M, count+2, flag=init, $found != 0"
941 found=$($LFS find $ext_opts ! $cnt_opts $flg_opts $parent | wc -l)
943 error "start-1M, end+5M, !count+2, flag=init, $found != 2"
945 # check last component stripe count
946 if [ $OSTCOUNT -gt 1 ]; then
947 touch $parent/subdir/f5
948 $TRUNCATE $parent/subdir/f5 $((32*1024*1024))
949 found=$($LFS find $parent/subdir -c $OSTCOUNT)
950 [[ "$found" == "$parent/subdir/f5" ]] ||
951 error "got '$found' with stripe_count=$OSTCOUNT, not f5"
954 run_test 15 "Verify component options for lfs find"
957 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
958 large_xattr_enabled || skip_env "ea_inode feature disabled"
960 local file=$DIR/$tdir/$tfile
961 local dir=$DIR/$tdir/dir
962 local temp=$DIR/$tdir/template
964 test_mkdir $DIR/$tdir
966 #####################################################################
968 # set stripe for source file
969 $LFS setstripe -E1m -S 1M -c2 -o0,1 -E2m -c2 -E3m -o1,0 -E4m -c1 -E-1 \
970 $file || error "Create $file failed"
973 verify_yaml_layout $file $file.copy $temp "1. PFL file"
975 #####################################################################
977 # set stripe for source file
979 $LFS setstripe -c2 -o0,1 -i1 $file || error "Create $file failed"
983 verify_yaml_layout $file $file.copy $temp "2. plain file"
985 #####################################################################
987 # set stripe for source dir
989 $LFS setstripe -E1m -S 1M -c2 -E2m -c1 -E-1 $dir ||
990 error "setstripe $dir failed"
994 verify_yaml_layout $dir $dir.copy $temp.dir "3. PFL dir"
996 #####################################################################
998 # set stripe for source dir
999 $LFS setstripe -c2 -i-1 $dir || error "setstripe $dir failed"
1002 verify_yaml_layout $dir $dir.copy $temp.dir "4. plain dir"
1004 run_test 16a "Verify setstripe/getstripe with YAML config file"
1007 [[ $($LCTL get_param mdc.*.import |
1008 grep "connect_flags:.*overstriping") ]] ||
1009 skip "server does not support overstriping"
1010 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1011 [[ $OSTCOUNT -ge $(($LOV_MAX_STRIPE_COUNT / 2)) ]] &&
1012 skip_env "too many osts, skipping"
1013 large_xattr_enabled || skip_env "ea_inode feature disabled"
1017 local file=$DIR/$tdir/$tfile
1018 local dir=$DIR/$tdir/dir
1019 local temp=$DIR/$tdir/template
1020 # We know OSTCOUNT < (LOV_MAX_STRIPE_COUNT / 2), so this is overstriping
1021 local large_count=$((LOV_MAX_STRIPE_COUNT / 2 + 10))
1024 test_mkdir $DIR/$tdir
1026 #####################################################################
1027 # 1. PFL file, overstriping in first comps
1028 # set stripe for source file
1029 $LFS setstripe -E1m -S 1M -o0,0 -E2m -o1,1 -E3m -C $large_count -E-1 \
1030 $file || error "Create $file failed"
1033 verify_yaml_layout $file $file.copy $temp "1. PFL file"
1035 #####################################################################
1036 # 2. plain file + overstriping
1037 # set stripe for source file
1039 $LFS setstripe -C $large_count -i1 $file || error "Create $file failed"
1042 echo "2. plain file"
1043 verify_yaml_layout $file $file.copy $temp "2. plain file"
1045 #####################################################################
1046 # 3. PFL dir + overstriping
1047 # set stripe for source dir
1049 $LFS setstripe -E1m -S 1M -o 0,0 -E2m -C $large_count -E-1 $dir ||
1050 error "setstripe $dir failed"
1052 test_mkdir $dir.copy
1054 verify_yaml_layout $dir $dir.copy $temp.dir "3. PFL dir"
1056 #####################################################################
1057 # 4. plain dir + overstriping
1058 # set stripe for source dir
1059 $LFS setstripe -C $large_count $dir || error "setstripe $dir failed"
1062 verify_yaml_layout $dir $dir.copy $temp.dir "4. plain dir"
1064 run_test 16b "Verify setstripe/getstripe with YAML config file + overstriping"
1067 (( $MDS1_VERSION >= $(version_code 2.13.53.205) )) ||
1068 skip "need MDS version at least 2.13.53.205"
1070 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1072 local file=$DIR/$tdir/$tfile
1073 local dir=$DIR/$tdir/dir
1074 local temp=$DIR/$tdir/template
1076 test_mkdir $DIR/$tdir
1078 #####################################################################
1080 # set stripe for source file
1081 $LFS setstripe -E256M -S 1M -c2 -o0,1 -z 64M -E-1 -o1,0 -z 128M \
1082 $file || error "Create $file failed"
1085 verify_yaml_layout $file $file.copy $temp "1. PFL file"
1087 #####################################################################
1089 # set stripe for source dir
1091 $LFS setstripe -E256M -S 1M -c2 -z 64M -E-1 -z 128M \
1092 $dir || error "setstripe $dir failed"
1094 test_mkdir $dir.copy
1095 echo "2. SEL template on dir"
1096 verify_yaml_layout $dir $dir.copy $temp.dir "2. PFL dir"
1098 run_test 16c "Verify setstripe/getstripe for SEL layout with YAML config file"
1101 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1103 local file=$DIR/$tdir/$tfile
1104 local dir=$DIR/$tdir/dir
1105 local temp=$DIR/$tdir/template
1107 test_mkdir $DIR/$tdir
1109 #####################################################################
1111 # set stripe for source file
1112 $LFS setstripe -E1m -L mdt -E-1 -o1,0 $file ||
1113 error "Create $file failed"
1116 verify_yaml_layout $file $file.copy $temp "1. DOM file"
1118 #####################################################################
1120 # set stripe for source dir
1122 $LFS setstripe -E1m -L mdt -E-1 -o1,0 $dir || error "Create $dir failed"
1124 test_mkdir $dir.copy
1126 verify_yaml_layout $dir $dir.copy $temp.dir "2. DOM dir"
1128 run_test 16d "Verify setstripe/getstripe for DOM layout with YAML config file"
1132 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1133 local file=$DIR/$tdir/$tfile
1134 test_mkdir -p $DIR/$tdir
1137 $LFS setstripe -E 1M -S 1M -E 3M -c 2 -E -1 -c -1 $file ||
1138 error "Create $file failed"
1140 local s1=$($LFS getstripe -I1 -v $file | awk '/lcme_size:/{print $2}')
1141 local s2=$($LFS getstripe -I2 -v $file | awk '/lcme_size:/{print $2}')
1142 local s3=$($LFS getstripe -I3 -v $file | awk '/lcme_size:/{print $2}')
1143 echo "1st init: comp size 1:$s1 2:$s2 3:$s3"
1145 # init 2nd component
1146 $TRUNCATE $file $((1024*1024+1))
1147 local s1n=$($LFS getstripe -I1 -v $file | awk '/lcme_size:/{print $2}')
1148 local s2n=$($LFS getstripe -I2 -v $file | awk '/lcme_size:/{print $2}')
1149 echo "2nd init: comp size 1:$s1n 2:$s2n 3:$s3"
1151 [ $s1 -eq $s1n ] || error "1st comp size $s1 should == $s1n"
1152 [ $s2 -lt $s2n ] || error "2nd comp size $s2 should < $s2n"
1154 # init 3rd component
1155 $TRUNCATE $file $((1024*1024*3+1))
1156 s1n=$($LFS getstripe -I1 -v $file | awk '/lcme_size:/{print $2}')
1157 s2n=$($LFS getstripe -I2 -v $file | awk '/lcme_size:/{print $2}')
1158 local s3n=$($LFS getstripe -I3 -v $file | awk '/lcme_size:/{print $2}')
1159 echo "3rd init: comp size 1:$s1n 2:$s2n 3:$s3n"
1161 [ $s1 -eq $s1n ] || error "1st comp size $s1 should == $s1n"
1162 [ $s2 -lt $s2n ] || error "2nd comp size $s2 should < $s2n"
1163 [ $s3 -lt $s3n ] || error "3rd comp size $s3 should < $s3n"
1165 run_test 17 "Verify LOVEA grows with more component inited"
1167 check_distribution() {
1171 local obj_min_one=$((OSTCOUNT - 1))
1173 objs=$($LFS getstripe $file |
1174 awk '/l_ost_idx:/ { print $5 }' | wc -l)
1175 let ave=$((objs / OSTCOUNT))
1177 # collect objects per OST distribution
1178 $LFS getstripe $file | awk '/l_ost_idx:/ { print $5 }' | tr -d "," |
1179 (inuse=( $(for i in $(seq 0 $obj_min_one); do echo 0; done) )
1181 let inuse[$O]=$((1 + ${inuse[$O]}))
1184 # verify object distribution varies no more than +-1
1185 for idx in $(seq 0 $obj_min_one); do
1186 let dif=$((${inuse[$idx]} - ave))
1188 if [ "$dif" -gt 1 ]; then
1189 echo "OST${idx}: ${inuse[$idx]} objects"
1190 error "bad distribution on OST${idx}"
1196 local file1=$DIR/${tfile}-1
1197 local file2=$DIR/${tfile}-2
1198 local file3=$DIR/${tfile}-3
1200 rm -f $file1 $file2 $file3
1202 $LFS setstripe -E 1m -S 1m $file1 ||
1203 error "Create $file1 failed"
1204 $LFS setstripe -E 1m -S 1m $file2 ||
1205 error "Create $file2 failed"
1206 $LFS setstripe -E 1m -S 1m $file3 ||
1207 error "Create $file3 failed"
1209 local objs=$((OSTCOUNT+1))
1210 for comp in $(seq 1 $OSTCOUNT); do
1211 $LFS setstripe --component-add -E $((comp+1))M -c 1 $file1 ||
1212 error "Add component to $file1 failed 2"
1213 $LFS setstripe --component-add -E $((comp+1))M -c 1 $file2 ||
1214 error "Add component to $file2 failed 2"
1215 $LFS setstripe --component-add -E $((comp+1))M -c 1 $file3 ||
1216 error "Add component to $file3 failed 2"
1219 $LFS setstripe --component-add -E -1 -c -1 $file1 ||
1220 error "Add component to $file1 failed 3"
1221 $LFS setstripe --component-add -E -1 -c -1 $file2 ||
1222 error "Add component to $file2 failed 3"
1223 $LFS setstripe --component-add -E -1 -c -1 $file3 ||
1224 error "Add component to $file3 failed 3"
1226 # Instantiate all components
1227 dd if=/dev/urandom of=$file1 bs=1M count=$((objs+1)) ||
1228 error "dd failed for $file1"
1229 dd if=/dev/urandom of=$file2 bs=1M count=$((objs+1)) ||
1230 error "dd failed for $file2"
1231 dd if=/dev/urandom of=$file3 bs=1M count=$((objs+1)) ||
1232 error "dd failed for $file3"
1234 check_distribution $file1
1235 check_distribution $file2
1236 check_distribution $file3
1239 run_test 18 "check component distribution"
1243 local already_created=${2:-0}
1244 local rw_len=$((3 * 1024 * 1024)) # 3M
1248 if [ $already_created != 1 ]; then
1249 test_mkdir -p $DIR/$tdir
1250 $LFS setstripe --extension-size 64M -c 1 -E -1 $comp_file ||
1251 error "Create $comp_file failed"
1254 # write past end of first component, so it is extended
1255 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=127 conv=notrunc ||
1256 error "dd to extend failed"
1258 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1259 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
1260 local ssize=$($LFS getstripe -S -I1 $comp_file)
1262 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
1263 [ $ost_idx2 -ne "-1" ] && error "second component init $ost_idx2"
1265 flg_opts="--comp-flags init"
1266 found=$($LFS find --comp-start 0 -E 128M $flg_opts $comp_file | wc -l)
1267 [ $found -eq 1 ] || error "Write: Extended first component not found"
1269 flg_opts="--comp-flags extension"
1270 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
1271 [ $found -eq 1 ] || error "Write: second component not found"
1273 found=$($LFS find -z 64M $comp_file | wc -l)
1274 [ $found -eq 1 ] || error "component not found by ext size"
1276 found=$($LFS find --extension-size +63M $comp_file | wc -l)
1277 [ $found -eq 1 ] || error "component not found by +ext size"
1279 found=$($LFS find --ext-size -65M $comp_file | wc -l)
1280 [ $found -eq 1 ] || error "component not found by -ext size"
1282 found=$($LFS find -z 65M $comp_file | wc -l)
1283 [ $found -eq 0 ] || error "component found by wrong ext size"
1285 found=$($LFS find -z +65M $comp_file | wc -l)
1286 [ $found -eq 0 ] || error "component found by wrong +ext size"
1288 found=$($LFS find -z -63M $comp_file | wc -l)
1289 [ $found -eq 0 ] || error "component found by wrong -ext size"
1291 found=$($LFS find ! -z 64M $comp_file | wc -l)
1292 [ $found -eq 0 ] || error "component found by negation of ext size"
1294 found=$($LFS find ! -z +63M $comp_file | wc -l)
1295 [ $found -eq 0 ] || error "component found by negation of +ext size"
1297 found=$($LFS find ! -z -65M $comp_file | wc -l)
1298 [ $found -eq 0 ] || error "component found by negation of -ext size"
1300 found=$($LFS find ! -z 65M $comp_file | wc -l)
1302 error "component not found by negation of wrong ext size"
1304 found=$($LFS find ! -z +65M $comp_file | wc -l)
1306 error "component not found by negation of wrong +ext size"
1308 found=$($LFS find ! -z -63M $comp_file | wc -l)
1310 error "component not found by negation of wrong -ext size"
1312 found=$($LFS find -S +$ssize $comp_file | wc -l)
1313 [ $found -eq 0 ] || error "component found by wrong +stripe size"
1315 found=$($LFS find -c 1 $comp_file | wc -l)
1316 [ $found -eq 1 ] || error "component not found by stripe count"
1318 small_write $comp_file $rw_len || error "Verify RW failed"
1320 sel_layout_sanity $comp_file 2
1323 # Self-extending PFL tests
1325 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1326 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1327 skip "skipped for lustre < $SEL_VER"
1329 test19_io_base $DIR/$tdir/$tfile
1331 run_test 19a "Simple test of extension behavior"
1333 # Same as 19a, but with default layout set on directory rather than on file
1335 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1336 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1337 skip "skipped for lustre < $SEL_VER"
1339 local comp_file=$DIR/$tdir/$tfile
1340 local comp_dir=$DIR/$tdir/$tdir
1344 test_mkdir -p $DIR/$tdir
1345 $LFS setstripe --ext-size 64M -c 1 -E -1 $DIR/$tdir ||
1346 error "Setstripe on $DIR/$tdir failed"
1348 # check inheritance for a sub-dir and a file
1349 test_mkdir $comp_dir
1350 found=$($LFS find --comp-start 0 -E 64M $comp_dir | wc -l)
1351 [ $found -eq 1 ] || error "Dir Inheritance: wrong first component size"
1353 flg_opts="--comp-flags extension"
1354 found=$($LFS find --comp-start 64M -E EOF $flg_opts $comp_dir | wc -l)
1355 [ $found -eq 1 ] || error "Dir Inheritance: Second component not found"
1359 flg_opts="--comp-flags init"
1360 found=$($LFS find --comp-start 0 -E 64M $flg_opts $comp_file | wc -l)
1361 [ $found -eq 1 ] || error "File Inheritance: wrong first component size"
1363 flg_opts="--comp-flags extension"
1364 found=$($LFS find --comp-start 64M -E EOF $flg_opts $comp_file | wc -l)
1365 [ $found -eq 1 ] || error "File Inheritance: Second component not found"
1367 test19_io_base $comp_file 1
1369 run_test 19b "Simple test of SEL as default layout"
1371 # Test behavior when seeking deep in a file
1373 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1374 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1375 skip "skipped for lustre < $SEL_VER"
1377 local comp_file=$DIR/$tdir/$tfile
1381 test_mkdir -p $DIR/$tdir
1383 $LFS setstripe -z 128M -E 1G -E -1 $comp_file ||
1384 error "Create $comp_file failed"
1386 # write past end of first component, so it is extended
1387 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=130 conv=notrunc ||
1388 error "dd to extend failed"
1390 flg_opts="--comp-flags init"
1391 found=$($LFS find --comp-start 0M -E 256M $flg_opts $comp_file | wc -l)
1392 [ $found -eq 1 ] || error "Write: first extension component not found"
1394 flg_opts="--comp-flags extension,^init"
1395 found=$($LFS find --comp-start 256M -E 1024M $flg_opts $comp_file |\
1397 [ $found -eq 1 ] || error "Write: second extension component not found"
1399 local end_1=$($LFS getstripe -I1 -E $comp_file)
1402 [ $end_1 -eq 268435456 ] ||
1403 error "end of first component $end_1 != 268435456"
1405 # Write past end of extension space component, in to normal component
1406 # should exhaust & remove extension component
1407 dd if=/dev/zero bs=1M count=1 seek=1100 of=$comp_file conv=notrunc ||
1408 error "dd distant seek failed"
1410 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1411 # the last component index is 3
1412 local ost_idx2=$($LFS getstripe -I3 -i $comp_file)
1414 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
1416 local start1=$($LFS getstripe -I1 --comp-start $comp_file)
1417 local end1=$($LFS getstripe -I1 -E $comp_file)
1418 local start2=$($LFS getstripe -I3 --comp-start $comp_file)
1419 local end2=$($LFS getstripe -I3 -E $comp_file)
1421 [ $start1 -eq 0 ] || error "start of first component incorrect"
1422 [ $end1 -eq 1073741824 ] || error "end of first component incorrect"
1423 [ $start2 -eq 1073741824 ] ||
1424 error "start of second component incorrect"
1425 [ "$end2" = "EOF" ] || error "end of second component incorrect"
1427 flg_opts="--comp-flags extension"
1428 found=$($LFS find $flg_opts $comp_file | wc -l)
1429 [ $found -eq 0 ] || error "Seek Write: extension component exists"
1431 sel_layout_sanity $comp_file 2
1433 run_test 19c "Test self-extending layout seeking behavior"
1436 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1437 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1438 skip "skipped for lustre < $SEL_VER"
1440 local comp_file=$DIR/$tdir/$tfile
1444 test_mkdir -p $DIR/$tdir
1446 $LFS setstripe -E 128M -c 1 -z 64M -E -1 $comp_file ||
1447 error "Create $comp_file failed"
1449 # This will cause component 1 to be extended to 128M, then the
1450 # extension space component will be removed
1451 dd if=/dev/zero of=$comp_file bs=130M count=1 ||
1452 error "dd to extend failed"
1454 flg_opts="--comp-flags init"
1455 found=$($LFS find --comp-start 0M -E 128M $flg_opts $comp_file | wc -l)
1456 [ $found -eq 1 ] || error "Write: first component not found"
1458 flg_opts="--comp-flags init"
1459 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
1460 [ $found -eq 1 ] || error "Write: second component not found"
1462 sel_layout_sanity $comp_file 2
1464 # always remove large files in case of DO_CLEANUP=false
1465 rm -f $comp_file || error "Delete $comp_file failed"
1467 run_test 19d "Test write which completely spans extension space component"
1472 local comp2_flags=$($LFS getstripe -I2 --comp-flags $comp_file)
1473 local comp3_flags=$($LFS getstripe -I3 --comp-flags $comp_file)
1475 [ "$comp2_flags" != "init" ] && error "$comp2_flags != init"
1476 [ "$comp3_flags" != "extension" ] && error "$comp3_flags != extension"
1478 local flg_opts=" --comp-start 2M -E 66M --comp-flags init"
1479 local found=$($LFS find $flg_opts $comp_file | wc -l)
1480 [ $found -eq 1 ] || error "Write: extended second component not found"
1482 flg_opts="--comp-start 66M -E EOF --comp-flags extension"
1483 found=$($LFS find $flg_opts $comp_file | wc -l)
1484 [ $found -eq 1 ] || error "Write: third component not found"
1486 sel_layout_sanity $comp_file 3
1490 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1491 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1492 skip "skipped for lustre < $SEL_VER"
1494 local comp_file=$DIR/$tdir/$tfile
1495 local rw_len=$((3 * 1024 * 1024)) # 3M
1499 test_mkdir -p $DIR/$tdir
1501 $LFS setstripe -E 2m -E -1 -z 64M $comp_file ||
1502 error "Create $comp_file failed"
1504 replay_barrier $SINGLEMDS
1506 #instantiate & extend second component
1507 dd if=/dev/zero of=$comp_file bs=4M count=1 ||
1508 error "dd to extend failed"
1510 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
1511 local ost_idx3=$($LFS getstripe -I3 -i $comp_file)
1513 [ $ost_idx2 -eq $ost_idx3 ] && error "$ost_idx2 == $ost_idx3"
1514 [ $ost_idx3 -ne "-1" ] && error "third component init $ost_idx3"
1516 test_19e_check $comp_file
1518 local f1=$($LFS getstripe -I2 $comp_file | awk '/l_fid:/ {print $7}')
1519 echo "before MDS recovery, the ost fid of 2nd component is $f1"
1523 local f2=$($LFS getstripe -I2 $comp_file | awk '/l_fid:/ {print $7}')
1524 echo "after MDS recovery, the ost fid of 2nd component is $f2"
1525 [ "x$f1" == "x$f2" ] || error "$f1 != $f2"
1527 # simply repeat all previous checks, but also verify components are on
1528 # the same OST as before
1530 local ost_idx2_2=$($LFS getstripe -I2 -i $comp_file)
1531 local ost_idx3_2=$($LFS getstripe -I3 -i $comp_file)
1533 [ $ost_idx2_2 -eq $ost_idx3_2 ] && error "$ost_idx2_2 == $ost_idx3_2"
1534 [ $ost_idx3_2 -ne "-1" ] && error "second component init $ost_idx3_2"
1536 # verify OST id is the same after failover
1537 [ $ost_idx2 -ne $ost_idx2_2 ] &&
1538 error "$ost_idx2 != $ost_idx2_2, changed after failover"
1540 test_19e_check $comp_file
1542 run_test 19e "Replay of layout instantiation & extension"
1545 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1546 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1547 skip "skipped for lustre < $SEL_VER"
1549 local comp_file=$DIR/$tdir/$tfile
1553 test_mkdir -p $DIR/$tdir
1555 $LFS setstripe -E 256M --comp-flags extension -E -1 $comp_file
1557 [ $? != 0 ] || error "should not be able to manually set extension flag"
1560 run_test 19f "Rejection of invalid layouts"
1563 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1564 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1565 skip "skipped for lustre < $SEL_VER"
1567 local file1=$DIR/${tfile}-1
1568 local file2=$DIR/${tfile}-2
1570 test_mkdir -p $DIR/$tdir
1571 multiop $file1 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
1572 error "create failed $file1"
1573 multiop $file2 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
1574 error "create failed $file2"
1576 $LFS setstripe --component-add -E 1G -c 1 $file1 ||
1577 error "comp-add [0,1G] failed $file1"
1578 $LFS setstripe --component-add -E 512M -z 128M $file1 &&
1579 error "comp-add [1G,1G],SEL[1G,512M] succeded $file1"
1580 $LFS setstripe --component-add -E 10G -z 128M $file1 ||
1581 error "comp-add [1G,1G],SEL[1G,10G] failed $file1"
1582 $LFS setstripe --component-add -E -1 $file1 ||
1583 error "comp-add [10G,-1] failed $file1"
1585 $LFS setstripe --component-add -E 1G -z 32M -c 1 $file2 &&
1586 error "comp-add with smal ext size succeeded $file1"
1587 $LFS setstripe --component-add -E 1G -z 100M -c 1 $file2 &&
1588 error "comp-add with not aligned ext size succeeded $file1"
1589 $LFS setstripe --component-add -E 1G -z 128M -c 1 $file2 ||
1590 error "comp-add [0,128M],SEL[128M,1G] failed $file1"
1591 $LFS setstripe --component-add -E 10G $file2 ||
1592 error "comp-add [1G,10G] failed $file1"
1593 $LFS setstripe --component-add -E -1 -z 128M -c 1 $file2 ||
1594 error "comp-add [10G,10G],SEL[10G,-1] failed $file1"
1595 $LFS setstripe --component-add -E -1 -z 128M -c 1 $file2 &&
1596 error "repeated comp-add [10G,10G],SEL[10G,-1] succeeded $file1"
1598 $LFS getstripe $file1
1599 flg_opts="--comp-flags init"
1600 found=$($LFS find --comp-start 0 -E 1G $flg_opts $file1 | wc -l)
1601 [ $found -eq 1 ] || error "First component not found $file1"
1603 flg_opts="--comp-flags ^init"
1604 found=$($LFS find --comp-start 1G -E 1G $flg_opts $file1 | wc -l)
1605 [ $found -eq 1 ] || error "Second component not found $file1"
1607 flg_opts="--comp-flags ^init,extension"
1608 found=$($LFS find --comp-start 1G -E 10G $flg_opts $file1 | wc -l)
1609 [ $found -eq 1 ] || error "Third component not found $file1"
1611 flg_opts="--comp-flags ^init"
1612 found=$($LFS find --comp-start 10G -E EOF $flg_opts $file1 | wc -l)
1613 [ $found -eq 1 ] || error "Fourth component not found $file1"
1615 $LFS getstripe $file2
1616 flg_opts="--comp-flags init"
1617 found=$($LFS find --comp-start 0 -E 128M $flg_opts $file2 | wc -l)
1618 [ $found -eq 1 ] || error "First component not found $file2"
1620 flg_opts="--comp-flags extension"
1621 found=$($LFS find --comp-start 128M -E 1G $flg_opts $file2 | wc -l)
1622 [ $found -eq 1 ] || error "Second component not found $file2"
1624 flg_opts="--comp-flags ^init"
1625 found=$($LFS find --comp-start 1G -E 10G $flg_opts $file2 | wc -l)
1626 [ $found -eq 1 ] || error "Third component not found $file2"
1628 flg_opts="--comp-flags ^init"
1629 found=$($LFS find --comp-start 10G -E 10G $flg_opts $file2 | wc -l)
1630 [ $found -eq 1 ] || error "Fourth component not found $file2"
1632 flg_opts="--comp-flags ^init,extension"
1633 found=$($LFS find --comp-start 10G -E EOF $flg_opts $file2 | wc -l)
1634 [ $found -eq 1 ] || error "Fifth component not found $file2"
1636 run_test 19g "component-add behaviour"
1638 # Test out of space behavior
1640 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1641 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1642 skip "skipped for lustre < $SEL_VER"
1644 local comp_file=$DIR/$tdir/$tfile
1648 test_mkdir -p $DIR/$tdir
1650 # without this, a previous delete can finish after we check free space
1651 wait_delete_completed
1654 # First component is on OST0
1655 $LFS setstripe -E 256M -i 0 -z 64M -E -1 -z 128M $comp_file ||
1656 error "Create $comp_file failed"
1658 # write past end of first component, so it is extended
1659 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=66 ||
1660 error "dd to extend failed"
1662 flg_opts="--comp-flags extension"
1663 found=$($LFS find --comp-start 128M -E 256M $flg_opts $comp_file |wc -l)
1664 [ $found -eq 1 ] || error "Write: Second component not found"
1666 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1667 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
1669 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
1671 flg_opts="--comp-flags extension"
1672 # Write past current init comp, but we won't extend (because no space)
1673 dd if=/dev/zero of=$comp_file bs=1M count=10 seek=200 ||
1674 error "dd write past current comp failed"
1676 $LFS getstripe $comp_file
1678 flg_opts="--comp-flags init"
1679 found=$($LFS find --comp-start 128M -E 256M $flg_opts $comp_file | \
1681 [ $found -eq 1 ] || error "Write: third component not found"
1683 flg_opts="--comp-flags extension"
1684 found=$($LFS find --comp-start 256M -E EOF $flg_opts $comp_file |wc -l)
1685 [ $found -eq 1 ] || error "Write: fourth extension component not found"
1687 sel_layout_sanity $comp_file 3
1689 run_test 20a "Test out of space, spillover to defined component"
1692 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1693 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1694 skip "skipped for lustre < $SEL_VER"
1696 local comp_file=$DIR/$tdir/$tfile
1700 test_mkdir -p $DIR/$tdir
1702 # Pool allows us to force use of only certain OSTs
1703 pool_add $TESTNAME || error "Pool creation failed"
1704 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
1706 # normal component to 10M, extendable component to 1G
1707 # further extendable to EOF
1708 $LFS setstripe -E 10M -E 1G -p $TESTNAME -z 64M -E -1 -p "" -z 128M \
1709 $comp_file || error "Create $comp_file failed"
1711 replay_barrier $SINGLEMDS
1713 found=$($LFS find --comp-start 10M -E 10M $flg_opts $comp_file | wc -l)
1714 [ $found -eq 1 ] || error "Zero length component not found"
1717 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
1719 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
1721 # write past end of first component
1722 # This should remove the next component, since OST0 is out of space
1723 # and it is striped there (pool contains only OST0)
1724 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=14 ||
1725 error "dd to extend/remove failed"
1727 found=$($LFS find --comp-start 10M -E 10M $flg_opts $comp_file | wc -l)
1728 [ $found -eq 0 ] || error "Write: zero length component still present"
1730 flg_opts="--comp-flags init"
1731 $LFS find --comp-start 10M -E +137M $flg_opts $comp_file
1732 found=$($LFS find --comp-start 10M -E +137M $flg_opts $comp_file |wc -l)
1733 [ $found -eq 1 ] || error "Write: second component not found"
1735 flg_opts="--comp-flags extension"
1736 found=$($LFS find --comp-start +137M -E EOF $flg_opts $comp_file |wc -l)
1737 [ $found -eq 1 ] || error "Write: third component not found"
1741 found=$($LFS find --comp-start 10M -E 10M $flg_opts $comp_file | wc -l)
1742 [ $found -eq 0 ] || error "Failover: 0-length component still present"
1744 flg_opts="--comp-flags init"
1745 found=$($LFS find --comp-start 10M -E +137M $flg_opts $comp_file |wc -l)
1746 [ $found -eq 1 ] || error "Failover: second component not found"
1748 flg_opts="--comp-flags extension"
1749 found=$($LFS find --comp-start +137M -E EOF $flg_opts $comp_file |wc -l)
1750 [ $found -eq 1 ] || error "Failover: third component not found"
1752 sel_layout_sanity $comp_file 3
1754 run_test 20b "Remove component without instantiation when there is no space"
1757 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1758 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1759 skip "skipped for lustre < $SEL_VER"
1761 local comp_file=$DIR/$tdir/$tfile
1765 test_mkdir -p $DIR/$tdir
1767 # pool is used to limit available OSTs to 0 and 1, so we can set all
1768 # available OSTs out of space
1769 pool_add $TESTNAME || error "Pool creation failed"
1770 pool_add_targets $TESTNAME 0 1 || error "Pool add targets failed"
1772 # without this, a previous delete can finish after we check free space
1773 wait_delete_completed
1776 $LFS setstripe -E 100M -E -1 -p $TESTNAME -z 64M $comp_file ||
1777 error "Create $comp_file failed"
1781 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
1783 local wms2=$(ost_watermarks_set_enospc $tfile $ost_idx2 |
1785 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
1786 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx2 $wms2" EXIT
1788 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=120 &&
1789 error "dd should fail with ENOSPC"
1791 flg_opts="--comp-flags init"
1792 found=$($LFS find --comp-start 0M -E 100M $flg_opts $comp_file | wc -l)
1793 [ $found -eq 1 ] || error "Write: First component not found"
1795 flg_opts="--comp-flags ^init"
1796 found=$($LFS find --comp-start 100M -E 100M $flg_opts $comp_file |wc -l)
1797 [ $found -eq 1 ] || error "Write: 0-length component not found"
1799 flg_opts="--comp-flags extension"
1800 found=$($LFS find --comp-start 100M -E EOF $flg_opts $comp_file | wc -l)
1801 [ $found -eq 1 ] || error "Write: third extension component not found"
1803 sel_layout_sanity $comp_file 3
1805 run_test 20c "Test inability to stripe new extension component"
1808 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1809 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1810 skip "skipped for lustre < $SEL_VER"
1812 local comp_file=$DIR/$tdir/$tfile
1813 test_mkdir -p $DIR/$tdir
1815 wait_delete_completed
1818 pool_add $TESTNAME || error "Pool creation failed"
1819 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
1820 $LFS setstripe -E 64m -E -1 -p $TESTNAME -z 64M $comp_file ||
1821 error "Create $comp_file failed"
1823 replay_barrier $SINGLEMDS
1825 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
1826 dd if=/dev/zero bs=1M count=1 seek=100 of=$comp_file
1829 ost_watermarks_clear_enospc $tfile 0 $wms
1830 [ $RC -eq 0 ] || error "dd failed: $RC"
1832 $LFS getstripe $comp_file
1833 local flg_opts="--comp-start 64M -E 128M --comp-flags init"
1834 local found=$($LFS find $flg_opts $comp_file | wc -l)
1835 [ $found -eq 1 ] || error "Write: component (64M-128M) not found"
1837 local ost_idx=$($LFS getstripe -I3 -i $comp_file)
1838 [ "$ost_idx" != "-1" ] && error "Write: EXT component disappeared"
1842 found=$($LFS find $flg_opts $comp_file | wc -l)
1843 [ $found -eq 1 ] || error "Failover: component (64M-128M) not found"
1845 ost_idx=$($LFS getstripe -I3 -i $comp_file)
1846 [ "$ost_idx" != "-1" ] && error "Failover: EXT component disappeared"
1848 sel_layout_sanity $comp_file 3
1850 run_test 20d "Low on space + 0-length comp: force extension"
1853 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1854 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1855 skip "skipped for lustre < $SEL_VER"
1857 local comp_file=$DIR/$tdir/$tfile
1858 test_mkdir -p $DIR/$tdir
1860 wait_delete_completed
1863 pool_add $TESTNAME || error "Pool creation failed"
1864 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
1866 $LFS setstripe -E 64m -E 640M -z 64M -p $TESTNAME -E -1 $comp_file ||
1867 error "Create $comp_file failed"
1869 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
1871 dd if=/dev/zero bs=1M count=1 seek=100 of=$comp_file
1874 ost_watermarks_clear_enospc $tfile 0 $wms
1875 [ $RC -eq 0 ] || error "dd failed $RC"
1877 $LFS getstripe $comp_file
1878 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
1879 local found=$($LFS find $flg_opts $comp_file | wc -l)
1880 [ $found -eq 1 ] || error "Write: component (64M-EOF) not found"
1882 local ost_idx=$($LFS getstripe -I2 -i $comp_file)
1883 [ "$ost_idx" != "" ] && error "Write: 0-length component still exists"
1884 ost_idx=$($LFS getstripe -I3 -i $comp_file)
1885 [ "$ost_idx" != "" ] && error "Write: extension component still exists"
1887 sel_layout_sanity $comp_file 2
1889 run_test 20e "ENOSPC with next real comp: spillover and backward extension"
1891 # Simple DoM interaction test
1893 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1894 skip "skipped for lustre < $SEL_VER"
1896 local comp_file=$DIR/$tdir/$tfile
1900 test_mkdir -p $DIR/$tdir
1902 # simple, correct self-extending layout after DoM component
1903 $LFS setstripe -E 1M -L mdt -E -1 -z 64m $comp_file || \
1904 error "Create $comp_file failed"
1906 # Write to DoM component & to self-extending comp after it
1907 dd if=/dev/zero bs=1M count=12 of=$comp_file ||
1908 error "dd to extend failed"
1910 flg_opts="--comp-flags init"
1911 found=$($LFS find --comp-start 1M -E 65M $flg_opts $comp_file | wc -l)
1912 [ $found -eq 1 ] || error "Write: extended component not found"
1914 flg_opts="--comp-flags extension"
1915 found=$($LFS find --comp-start 65M $flg_opts $comp_file | wc -l)
1916 [ $found -eq 1 ] || error "Write: extension component not found"
1918 sel_layout_sanity $comp_file 3
1920 run_test 21a "Simple DoM interaction tests"
1922 # DoM + extension + removal
1924 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1925 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1926 skip "skipped for lustre < $SEL_VER"
1928 local comp_file=$DIR/$tdir/$tfile
1929 local ost_name=$(ostname_from_index 0)
1933 test_mkdir -p $DIR/$tdir
1935 # DoM, extendable component, further extendable component
1936 $LFS setstripe -E 1M -L mdt -E 256M -i 0 -z 64M -E -1 -z 128M \
1937 $comp_file || error "Create $comp_file failed"
1939 found=$($LFS find --comp-start 1M -E 1M $flg_opts $comp_file | wc -l)
1940 [ $found -eq 1 ] || error "Write: Zero length component not found"
1942 # This also demonstrates that we will avoid degraded OSTs
1943 do_facet ost1 $LCTL set_param -n obdfilter.$ost_name.degraded=1
1944 # sleep to guarantee we see the degradation
1947 # un-degrade on exit
1948 stack_trap "do_facet ost1 $LCTL set_param -n \
1949 obdfilter.$ost_name.degraded=0; sleep_maxage" EXIT
1951 # This should remove the first component after DoM and spill over to
1953 dd if=/dev/zero bs=1M count=2 of=$comp_file ||
1954 error "dd to remove+spill over failed"
1956 found=$($LFS find --comp-start 1M -E 1M $flg_opts $comp_file | wc -l)
1957 [ $found -eq 0 ] || error "Write: Zero length component still present"
1959 flg_opts="--comp-flags init"
1960 found=$($LFS find --comp-start 1M -E 129M $flg_opts $comp_file | wc -l)
1961 [ $found -eq 1 ] || error "Write: extended component not found"
1963 flg_opts="--comp-flags extension"
1964 found=$($LFS find --comp-start 129M -E EOF $flg_opts $comp_file |wc -l)
1965 [ $found -eq 1 ] || error "Write: extension component not found"
1967 sel_layout_sanity $comp_file 3
1969 run_test 21b "DoM followed by extendable component with removal"
1971 # Test of repeat component behavior with OOS/degraded OST
1973 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1974 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1975 skip "skipped for lustre < $SEL_VER"
1977 local comp_file=$DIR/$tdir/$tfile
1981 test_mkdir -p $DIR/$tdir
1983 $LFS setstripe -E -1 -c 1 -z 128M $comp_file ||
1984 error "Create $comp_file failed"
1986 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1987 local ost_name=$(ostname_from_index $ost_idx1)
1989 # write past end of first component, so it is extended
1990 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=130 ||
1991 error "dd to extend failed"
1993 flg_opts="--comp-flags extension"
1994 found=$($LFS find --comp-start 256M -E EOF $flg_opts $comp_file | wc -l)
1995 [ $found -eq 1 ] || error "Write: second component not found"
1997 # degrade OST for component 1
1998 do_facet ost$((ost_idx1+1)) $LCTL set_param -n \
1999 obdfilter.$ost_name.degraded=1
2000 # sleep to guarantee we see the degradation
2003 # un-degrade on exit
2004 stack_trap "do_facet ost$((ost_idx1+1)) $LCTL set_param -n \
2005 obdfilter.$ost_name.degraded=0; sleep_maxage" EXIT
2007 replay_barrier $SINGLEMDS
2009 # seek past the end of current comp & write, should cause a new comp
2010 # to be created (ie repeat previous comp)
2011 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=300 ||
2012 error "dd to repeat failed"
2014 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
2016 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
2018 flg_opts="--comp-flags init"
2019 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
2020 [ $found -eq 1 ] || error "Write: second component not found"
2022 flg_opts="--comp-flags extension"
2023 found=$($LFS find --comp-start 384M -E EOF $flg_opts $comp_file | wc -l)
2024 [ $found -eq 1 ] || error "Write: extension component not found"
2028 local ost_idx2_2=$($LFS getstripe -I2 -i $comp_file)
2029 [ $ost_idx2_2 -ne $ost_idx2 ] && error "$ost_idx2_2 != $ost_idx2"
2031 flg_opts="--comp-flags init"
2032 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
2033 [ $found -eq 1 ] || error "Failover: second component not found"
2035 flg_opts="--comp-flags extension"
2036 found=$($LFS find --comp-start 384M -E EOF $flg_opts $comp_file | wc -l)
2037 [ $found -eq 1 ] || error "Failover: extension component not found"
2039 sel_layout_sanity $comp_file 3
2041 run_test 22a "Test repeat component behavior with degraded OST"
2043 # Test repeat behavior with low space
2045 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2046 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2047 skip "skipped for lustre < $SEL_VER"
2049 local comp_file=$DIR/$tdir/$tfile
2053 test_mkdir -p $DIR/$tdir
2055 # without this, a previous delete can finish after we check free space
2056 wait_delete_completed
2059 $LFS setstripe -E -1 -c 1 -z 128M \
2060 $comp_file || error "Create $comp_file failed"
2062 # write past end of first component, so it is extended
2063 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=130 ||
2064 error "dd to extend failed"
2066 flg_opts="--comp-flags extension"
2067 found=$($LFS find --comp-start 256M -E EOF $flg_opts $comp_file | wc -l)
2068 [ $found -eq 1 ] || error "Write: Second component not found"
2070 # set our OST low on space
2071 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
2072 local wms=$(ost_watermarks_set_low_space $ost_idx1 | grep "watermarks")
2074 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
2076 # Write past end of current space, fail to extend, causing repeat
2077 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=300 ||
2078 error "dd to repeat failed"
2080 $LFS getstripe $comp_file
2082 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
2084 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
2086 flg_opts="--comp-flags init"
2087 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
2088 [ $found -eq 1 ] || error "Write: Second component not found"
2090 flg_opts="--comp-flags extension"
2091 found=$($LFS find --comp-start 384M -E EOF $flg_opts $comp_file | wc -l)
2092 [ $found -eq 1 ] || error "Write: Extension component not found"
2094 sel_layout_sanity $comp_file 3
2096 run_test 22b "Test simple 'out of space' condition with repeat"
2098 # This tests both "repeat" and "extend in place when repeat fails" aspects
2099 # of repeating components
2101 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2102 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2103 skip "skipped for lustre < $SEL_VER"
2105 local comp_file=$DIR/$tdir/$tfile
2109 test_mkdir -p $DIR/$tdir
2111 # pool is used to limit available OSTs to 0 and 1, so we can set all
2112 # available OSTs out of space
2113 pool_add $TESTNAME || error "Pool creation failed"
2114 pool_add_targets $TESTNAME 0 1 || error "Pool add targets failed"
2116 # without this, a previous delete can finish after we check free space
2117 wait_delete_completed
2120 $LFS setstripe -E -1 -z 64M -c 1 -p "$TESTNAME" $comp_file || \
2121 error "Create $comp_file failed"
2123 # write past end of first component, so it is extended
2124 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=80 conv=notrunc ||
2125 error "dd to extend failed"
2127 $LFS getstripe $comp_file
2129 flg_opts="--comp-flags extension"
2130 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
2131 [ $found -eq 1 ] || error "Write: second component not found"
2133 # set our OST out of space
2134 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
2135 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
2137 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
2139 # This should create a repeat component on a new OST
2140 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=180 conv=notrunc ||
2141 error "dd to repeat failed"
2143 $LFS getstripe $comp_file
2145 local comp_cnt=$($LFS getstripe --component-count $comp_file)
2146 [ $comp_cnt -ne 3 ] && error "component count: $comp_cnt, should be 3"
2148 # New second component should be on a different OST
2149 local ost_idx2=$($LFS getstripe --comp-start=128m \
2150 --comp-end=192m --comp-flags=init -i $comp_file)
2152 [ $ost_idx1 -eq $ost_idx2 ] && error "2nd comp: same OST $ost_idx1"
2154 local wms2=$(ost_watermarks_set_enospc $tfile $ost_idx2 |
2156 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx2 $wms2" EXIT
2158 # now that the second OST is out of space (as is the first OST), we
2159 # attempt to extend. This should result in an extension of the
2160 # existing component, rather than a new component.
2161 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=240 conv=notrunc ||
2162 error "dd for forced extension failed"
2164 $LFS getstripe $comp_file
2166 # clear out of space on first OST
2167 ost_watermarks_clear_enospc $tfile $ost_idx1 $wms
2169 # finally, now that the first OST has space again, we attempt to
2170 # extend one last time. This should create a new component on the
2172 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=300 conv=notrunc ||
2173 error "dd for repeat on first OST failed"
2175 $LFS getstripe $comp_file
2177 flg_opts="--comp-flags init"
2178 found=$($LFS find --comp-start 128M $flg_opts $comp_file | wc -l)
2179 [ $found -eq 1 ] || error "Write: second component not found"
2181 flg_opts="--comp-flags init"
2182 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
2183 [ $found -eq 1 ] || error "Write: third component not found"
2185 flg_opts="--comp-flags extension"
2186 found=$($LFS find --comp-start 320M -E EOF $flg_opts $comp_file | wc -l)
2187 [ $found -eq 1 ] || error "Write: extension component not found"
2189 sel_layout_sanity $comp_file 4
2191 run_test 22c "Test repeat with out of space on > 1 OST"
2193 test_22d_post_check() {
2196 local flg_opts="--comp-flags init"
2197 local found=$($LFS find --comp-start 0M -E 128M $flg_opts $comp_file |
2199 [ $found -eq 1 ] || {
2200 $LFS getstripe $comp_file
2201 error "$name: second component not found"
2204 flg_opts="--comp-flags extension"
2205 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
2206 [ $found -eq 1 ] || error "$name: third extension component not found"
2208 sel_layout_sanity $comp_file 2
2216 # write past end of first component
2217 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=70
2220 ost_watermarks_clear_enospc $tfile 0 $wms
2221 [ $RC -eq 0 ] || error "dd to force extend failed"
2223 test_22d_post_check $comp_file "Write"
2227 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2228 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2229 skip "skipped for lustre < $SEL_VER"
2231 local comp_file=$DIR/$tdir/$tfile
2235 test_mkdir -p $DIR/$tdir
2237 # without this, a previous delete can finish after we check free space
2238 wait_delete_completed
2241 # Pool allows us to force use of only certain OSTs
2242 pool_add $TESTNAME || error "Pool creation failed"
2243 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
2245 # 1. Fail to extend due to OOS, try to repeat within the same pool,
2246 # fail to stripe (again OOS) the 0-length component, remove the
2247 # repeated one, force the extension on the original one.
2248 $LFS setstripe -E -1 -p $TESTNAME -z 64M $comp_file ||
2249 error "Create $comp_file failed"
2251 replay_barrier $SINGLEMDS
2253 # set our OST out of space
2254 local wms=$(ost_watermarks_set_enospc $tfile 0 | grep "watermarks")
2256 test_22d_pre $comp_file "$wms"
2258 test_22d_post_check $comp_file "Failover"
2260 # 2. repeat with low on space: 0-length repeated component will be
2261 # striped, but still fails to be extended; otherwise the same as (1).
2263 $LFS setstripe -E -1 -p $TESTNAME -z 64M $comp_file ||
2264 error "Create $comp_file failed"
2266 replay_barrier $SINGLEMDS
2268 # set our OST low on space
2269 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
2271 test_22d_pre $comp_file "$wms"
2273 test_22d_post_check $comp_file "Failover"
2275 run_test 22d "out of/low on space + failed to repeat + forced extension"
2278 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2279 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2280 skip "skipped for lustre < $SEL_VER"
2282 local comp_file=$DIR/$tdir/$tfile
2283 test_mkdir -p $DIR/$tdir
2285 $LFS setstripe -z 64M -c 1 -E -1 $comp_file ||
2286 error "Create $comp_file failed"
2288 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file ||
2289 error "dd append failed"
2291 local flg_opts="--comp-start 0 -E EOF --comp-flags init"
2292 local found=$($LFS find $flg_opts $comp_file | wc -l)
2293 [ $found -eq 1 ] || error "Append: first component (0-EOF) not found"
2295 local ost_idx=$($LFS getstripe -I2 -i $comp_file)
2296 [ "$ost_idx" != "" ] && error "Append: second component still exists"
2298 sel_layout_sanity $comp_file 1
2300 run_test 23a "Append: remove EXT comp"
2303 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2304 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2305 skip "skipped for lustre < $SEL_VER"
2307 local comp_file=$DIR/$tdir/$tfile
2308 test_mkdir -p $DIR/$tdir
2310 $LFS setstripe -E 64m -E -1 -z 64M $comp_file ||
2311 error "Create $comp_file failed"
2313 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file ||
2314 error "dd append failed"
2316 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2317 local found=$($LFS find $flg_opts $comp_file | wc -l)
2318 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2320 local ost_idx=$($LFS getstripe -I3 -i $comp_file)
2321 [ "$ost_idx" != "" ] && error "Append: third component still exists"
2323 sel_layout_sanity $comp_file 2
2325 run_test 23b "Append with 0-length comp: remove EXT comp"
2328 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2329 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2330 skip "skipped for lustre < $SEL_VER"
2332 local comp_file=$DIR/$tdir/$tfile
2333 test_mkdir -p $DIR/$tdir
2335 wait_delete_completed
2338 pool_add $TESTNAME || error "Pool creation failed"
2339 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
2340 $LFS setstripe -E 64m -E -1 -p $TESTNAME -z 64M $comp_file ||
2341 error "Create $comp_file failed"
2343 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
2344 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file
2347 ost_watermarks_clear_enospc $tfile 0 $wms
2348 [ $RC -eq 0 ] || error "dd append failed: $RC"
2350 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2351 local found=$($LFS find $flg_opts $comp_file | wc -l)
2352 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2354 local ost_idx=$($LFS getstripe -I3 -i $comp_file)
2355 [ "$ost_idx" != "" ] && error "Append: EXT component still exists"
2357 sel_layout_sanity $comp_file 2
2359 run_test 23c "Append with low on space + 0-length comp: force extension"
2362 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2363 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2364 skip "skipped for lustre < $SEL_VER"
2366 local comp_file=$DIR/$tdir/$tfile
2367 test_mkdir -p $DIR/$tdir
2369 $LFS setstripe -E 64m -E 640M -z 64M -E -1 $comp_file ||
2370 error "Create $comp_file failed"
2372 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file ||
2373 error "dd append failed"
2375 flg_opts="--comp-start 64M -E 640M --comp-flags init"
2376 found=$($LFS find $flg_opts $comp_file | wc -l)
2377 [ $found -eq 1 ] || error "Append: component (64M-640M) not found"
2379 ost_idx=$($LFS getstripe -I3 -i $comp_file)
2380 [ "$ost_idx" != "" ] && error "Append: third component still exists"
2382 sel_layout_sanity $comp_file 3
2384 run_test 23d "Append with 0-length comp + next real comp: remove EXT comp"
2387 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2388 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2389 skip "skipped for lustre < $SEL_VER"
2391 local comp_file=$DIR/$tdir/$tfile
2392 test_mkdir -p $DIR/$tdir
2394 wait_delete_completed
2397 pool_add $TESTNAME || error "Pool creation failed"
2398 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
2400 $LFS setstripe -E 64m -E 640M -z 64M -p $TESTNAME -E -1 $comp_file ||
2401 error "Create $comp_file failed"
2403 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
2405 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file
2408 ost_watermarks_clear_enospc $tfile 0 $wms
2409 [ $RC -eq 0 ] || error "dd append failed $RC"
2411 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2412 local found=$($LFS find $flg_opts $comp_file | wc -l)
2413 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2415 local ost_idx=$($LFS getstripe -I2 -i $comp_file)
2416 [ "$ost_idx" != "" ] && error "Append: 0-length component still exists"
2417 ost_idx=$($LFS getstripe -I3 -i $comp_file)
2418 [ "$ost_idx" != "" ] && error "Append: extension component still exists"
2420 sel_layout_sanity $comp_file 2
2422 run_test 23e "Append with next real comp: spillover and backward extension"
2425 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2426 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2427 skip "skipped for lustre < $SEL_VER"
2429 local comp_file=$DIR/$tdir/$tfile
2430 test_mkdir -p $DIR/$tdir
2432 $LFS setstripe -z 64M -c 1 -E -1 $comp_file ||
2433 error "Create $comp_file failed"
2435 local ost_idx=$($LFS getstripe -I1 -i $comp_file)
2436 local wms=$(ost_watermarks_set_low_space $ost_idx | grep "watermarks")
2438 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file
2441 ost_watermarks_clear_enospc $tfile $ost_idx $wms
2442 [ $RC -eq 0 ] || error "dd append failed"
2444 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2445 local found=$($LFS find $flg_opts $comp_file | wc -l)
2446 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2448 ost_idx=$($LFS getstripe -I2 -i $comp_file)
2449 [ "$ost_idx" != "" ] && error "Append: extension component still exists"
2451 sel_layout_sanity $comp_file 2
2453 run_test 23f "Append with low on space: repeat and remove EXT comp"
2462 [ "$OSTCOUNT" -lt "3" ] && skip_env "needs >= 3 OSTs"
2464 trap cleanup_24 EXIT RETURN
2466 local file=$DIR/$tfile
2468 $LFS setstripe -E 1m -c1 -o0 -E eof -c2 -S 1M -o1,2 $file ||
2469 error "setstripe on $file"
2471 dd if=/dev/zero of=$file bs=1M count=3 || error "dd failed for $file"
2474 filefrag -ves $file || error "filefrag $file failed"
2475 filefrag_op=$(filefrag -ve -k $file |
2476 sed -n '/ext:/,/found/{/ext:/d; /found/d; p}')
2478 #Filesystem type is: bd00bd0
2479 #File size of /mnt/lustre/f24a.sanity-pfl is 3145728 (3072 blocks of 1024 bytes)
2480 # ext: device_logical: physical_offset: length: dev: flags:
2481 # 0: 0.. 1023: 1572864.. 1573887: 1024: 0000: net
2482 # 1: 0.. 1023: 1572864.. 1573887: 1024: 0002: net
2483 # 2: 1024.. 2047: 1573888.. 1574911: 1024: 0001: last,net
2484 #/mnt/lustre/f24a.sanity-pfl: 3 extents found
2486 last_lun=$(echo $filefrag_op | cut -d: -f5)
2491 for line in $filefrag_op; do
2492 frag_lun=$(echo $line | cut -d: -f5)
2493 ext_len=$(echo $line | cut -d: -f4)
2494 if [[ "$frag_lun" != "$last_lun" ]]; then
2495 if (( tot_len != 1024 )); then
2497 error "$file: OST$last_lun $tot_len != 1024"
2503 (( tot_len += ext_len ))
2506 if (( num_luns != 3 || tot_len != 1024 )); then
2508 error "$file: $num_luns != 3, $tot_len != 1024 on OST$last_lun"
2511 echo "FIEMAP on $file succeeded"
2513 run_test 24a "FIEMAP upon PFL file"
2516 local pfl_f=$DIR/$tdir/"$tfile"_pfl
2517 local dom_f=$DIR/$tdir/"$tfile"_dom
2518 local common_f=$DIR/$tdir/"$tfile"_common
2522 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2523 $LFS setstripe -E 10M -S 64k -c -1 -E 20M -S 1M -E -1 -S 2M -c 1 \
2524 $pfl_f || error "setstripe $pfl_f failed"
2525 $LFS setstripe -E 256k -L mdt -E -1 -S 1M $dom_f ||
2526 error "setstripe $dom_f failed"
2527 $LFS setstripe -S 512K -c -1 $common_f ||
2528 error "setstripe $common_f failed"
2530 #verify lov_getstripe_old with PFL file
2531 stripe_count=$(lov_getstripe_old $pfl_f |
2532 awk '/stripe_count/ { print $2 }')
2533 stripe_size=$(lov_getstripe_old $pfl_f |
2534 awk '/stripe_size/ { print $2 }')
2535 [ $stripe_count -eq 1 ] ||
2536 error "stripe_count $stripe_count !=1 for $pfl_f"
2537 [ $stripe_size -eq 2097152 ] ||
2538 error "stripe_size $stripe_size != 2097152 for $pfl_f"
2540 #verify lov_getstripe_old with DoM file
2541 stripe_count=$(lov_getstripe_old $dom_f |
2542 awk '/stripe_count/ { print $2 }')
2543 stripe_size=$(lov_getstripe_old $dom_f |
2544 awk '/stripe_size/ { print $2 }')
2545 [ $stripe_count -eq 1 ] ||
2546 error "stripe_count $stripe_count !=1 for $dom_f"
2547 [ $stripe_size -eq 1048576 ] ||
2548 error "stripe_size $stripe_size != 1048576 for $dom_f"
2550 #verify lov_getstripe_old with common file
2551 stripe_count=$(lov_getstripe_old $common_f |
2552 awk '/stripe_count/ { print $2 }')
2553 stripe_size=$(lov_getstripe_old $common_f |
2554 awk '/stripe_size/ { print $2 }')
2555 [ $stripe_count -eq $OSTCOUNT ] ||
2556 error "stripe_count $stripe_count !=$OSTCOUNT for $common_f"
2557 [ $stripe_size -eq 524288 ] ||
2558 error "stripe_size $stripe_size != 524288 for $common_f"
2560 run_test 25 "Verify old lov stripe API with PFL files"
2563 $LFS setstripe -E 1m -S 1M -c 1 $DIR/$tfile
2564 dd if=/dev/urandom bs=1M count=10 >> $DIR/$tfile
2565 [ $? != 0 ] || error "append must return an error"
2567 run_test 26a "Append to not-existent component"
2570 $LFS setstripe -E 1m -S 1M -c 1 $DIR/$tfile
2571 dd if=/dev/urandom bs=1M count=1 > $DIR/$tfile
2572 dd if=/dev/urandom bs=1M count=1 >> $DIR/$tfile
2573 [ $? != 0 ] || error "append must return an error"
2575 run_test 26b "Append to not-existend component, file size is unknown"
2578 $LFS setstripe -E 1m -S 1M -c 1 $DIR/$tfile
2579 dd if=/dev/urandom bs=2M count=1 >> $DIR/$tfile
2580 [ $? != 0 ] || error "append must return an error"
2582 run_test 26c "Append to not-existend component, crossing the component border"
2585 [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] ||
2586 skip "server does not support overstriping"
2587 (( $MDS1_VERSION >= $(version_code 2.15.55.102) )) ||
2588 skip "need MDS >= 2.12.55.102 for mdt_dump_lmm fix"
2590 stack_trap "rm -f $DIR/$tfile"
2591 # start_full_debug_logging
2592 $LFS setstripe -S 64K -C -1 $DIR/$tfile || error "create $tfile failed"
2593 $LFS getstripe -c $DIR/$tfile || error "getstripe $tfile failed"
2595 $LFS getstripe -c $DIR/$tfile || error "getstripe failed after clear"
2597 test_mkdir $DIR/$tdir
2598 stack_trap "rm -rf $DIR/$tdir/$tfile"
2599 $LFS setstripe -S 64K -C -1 $DIR/$tdir || error "mkdir $tdir failed"
2600 $LFS getstripe -y $DIR/$tdir || error "getstripe $tdir failed"
2601 touch $DIR/$tdir/$tfile || error "create $tdir/$tfile failed"
2603 $LFS getstripe -c $DIR/$tdir/$tfile ||
2604 error "getstripe $tdir/$tfile failed"
2605 #stop_full_debug_logging
2607 run_test 27 "overstriping with -C -1 in mdt_dump_lmm"
2609 complete_test $SECONDS
2610 check_and_cleanup_lustre