+run_test 1a "Create full components file, reused OSTs"
+
+# test overstriping (>1 stripe/OST within a component)
+test_1b() {
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
+ [[ $($LCTL get_param mdc.*.import |
+ grep "connect_flags:.*overstriping") ]] ||
+ skip "server does not support overstriping"
+
+ local comp_file=$DIR/$tdir/$tfile
+ local rw_len=$((3 * 1024 * 1024)) # 3M
+
+ test_mkdir $DIR/$tdir
+
+ $LFS setstripe -E 1m -S 1m -o 0,0 -E -1 -o 1,1,0,0 $comp_file ||
+ error "Create $comp_file failed"
+
+ #instantiate all components, so that objs are allocted
+ dd if=/dev/zero of=$comp_file bs=1k count=1 seek=1M
+
+ $LFS getstripe $comp_file
+ local OSTS_1=$($LFS getstripe -I1 $comp_file | grep -o 'l_ost_idx.*' |
+ awk -e '{print $2}' | tr "\n" "\0")
+ local OSTS_2=$($LFS getstripe -I2 $comp_file | grep -o 'l_ost_idx.*' |
+ awk -e '{print $2}' | tr "\n" "\0")
+
+ echo ":"$OSTS_1":"
+ echo ":"$OSTS_2":"
+ [ "$OSTS_1" = "0,0," ] || error "incorrect OSTs($OSTS_1) in component 1"
+ [ "$OSTS_2" = "1,1,0,0," ] ||
+ error "incorrect OSTs($OSTS_2) in component 2"
+
+ small_write $comp_file $rw_len || error "Verify RW failed"
+
+ rm -f $comp_file || error "Delete $comp_file failed"
+}
+run_test 1b "Create full components file, overstriping in components"
+
+# test overstriping with max stripe count
+test_1c() {
+ [[ $($LCTL get_param mdc.*.import |
+ grep "connect_flags:.*overstriping") ]] ||
+ skip "server does not support overstriping"
+ large_xattr_enabled || skip_env "no large xattr support"
+
+ local comp_file=$DIR/$tdir/$tfile
+ local rw_len=$((3 * 1024 * 1024)) # 3M
+
+ test_mkdir $DIR/$tdir
+
+ $LFS setstripe -E 1m -C 10 -E 10M -C 100 -E -1 \
+ -C $LOV_MAX_STRIPE_COUNT $comp_file ||
+ error "Create $comp_file failed"
+
+ # Seek & write in to last component so all objects are allocated
+ dd if=/dev/zero of=$comp_file bs=1k count=1 seek=20000
+
+ local count=$($LFS getstripe -c -I1 $DIR/$tdir/$tfile)
+ [ $count -eq 10 ] || error "comp1 stripe count $count, should be 10"
+ count=$($LFS getstripe -c -I2 $DIR/$tdir/$tfile)
+ [ $count -eq 100 ] || error "comp2 stripe count $count, should be 100"
+ count=$($LFS getstripe -c -I3 $DIR/$tdir/$tfile)
+ [ $count -eq $LOV_MAX_STRIPE_COUNT ] ||
+ error "comp4 stripe count $count != $LOV_MAX_STRIPE_COUNT"
+
+ small_write $comp_file $rw_len || error "Verify RW failed"
+
+ rm -f $comp_file || error "Delete $comp_file failed"
+}
+run_test 1c "Test overstriping w/max stripe count"