3 # Copyright (c) 2007 Silicon Graphics, Inc. All Rights Reserved.
5 # Core of filestreams tests.
10 local directory_name=$1
17 local count=`expr $file_size / $bsize`
19 if [ "$iflag" = "1" ]; then
20 $XFS_IO_PROG -x -c "chattr +S" $directory_name \
21 || _fail "chattr of filestream flag"
26 if [ "$dio" = "1" ]; then
29 while [ $i -le $files ]; do
30 dd if=/dev/zero of=frame-${i} $oflags \
31 bs=$bsize count=$count >/dev/null 2>&1
38 # the ag number is in column 4 of xfs_bmap output
40 $ag = (split /\s+/)[4] ;
41 if ($ag =~ /\d+/) {print "$ag "} ;
47 local directory_name=$1
48 local stream_ags=`xfs_bmap -vp ${directory_name}/* | _filter_agno`
54 # check for duplicate numbers between two space seperated vars
60 for this_num_one in $num_str_one; do
61 for this_num_two in $num_str_two; do
62 if [ "$this_num_one" == "$this_num_two" ]; then
63 echo "duplicate AG $this_num_one found" \
74 # test that filestreams are available
75 umount $SCRATCH_MNT > /dev/null 2>&1
77 _scratch_mkfs_xfs > /dev/null 2>&1 \
78 || _fail "mkfs failed"
80 _scratch_mount "-o filestreams" \
81 || _notrun "filestreams mount not available"
84 umount $SCRATCH_MNT > /dev/null 2>&1
88 echo "# testing $* ...."
90 local agsize="$2" # in MB
91 local stream_count="$3"
92 local stream_files="$4"
93 local stream_file_size=`expr $5 \* 1024 \* 1024`
95 local use_directio="$7"
96 local expected_result="$8"
98 local size=`expr $agsize \* 1024 \* 1024 \* $agcount`
99 _scratch_mkfs_xfs -dsize=$size,agcount=$agcount >/dev/null 2>&1 \
100 || _fail "mkfs failed"
102 if [ "$use_iflag" = "0" ]; then
103 # mount using filestreams mount option
104 _scratch_mount "-o filestreams" \
105 || _notrun "filestreams mount not available"
107 # test will set inode flag
114 # start four streams, each writing 24m (8 x 3m files)
118 while [ $stream_index -le $stream_count ]; do
119 _do_stream stream${stream_index}-dir $stream_files \
120 $stream_file_size 1048576 $use_iflag $use_directio &
121 stream_pids="$stream_pids $!"
122 stream_index=`expr $stream_index + 1`
125 # wait for streams to finish
126 # XXX wait here not needed? -dgc
129 # sync the buffered streams out in parallel
133 while [ $stream_index -le $stream_count ]; do
134 _get_stream_ags stream${stream_index}-dir > /dev/null 2>&1 &
135 stream_pids="$stream_pids $!"
136 stream_index=`expr $stream_index + 1`
139 # wait for streams to finish
142 # confirm streams are in seperate AGs
143 echo "# checking stream AGs..."
146 while [ $stream_index -le $stream_count ]; do
147 _get_stream_ags stream${stream_index}-dir > $tmp.${stream_index} &
148 this_stream_ags=`_get_stream_ags stream${stream_index}-dir`
149 echo "stream $stream_index AGs: $this_stream_ags" >> $here/$seq.full
150 _check_for_dupes "$ags_seen" "$this_stream_ags"
151 if [ $? -ne 0 ]; then
152 if [ "$expected_result" = "fail" ]; then
153 echo "+ expected failure, matching AGs"
154 expected_result="failed"
157 _fail "- failed, streams with matching AGs"
160 ags_seen="$ags_seen $this_stream_ags"
161 stream_index=`expr $stream_index + 1`
163 if [ "$expected_result" != "failed" ]; then
164 echo "+ passed, streams are in seperate AGs"