5 # Let's look, xfs_db, at the inode and its literal area for the
6 # extents and the attributes
8 #-----------------------------------------------------------------------
9 # Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
10 #-----------------------------------------------------------------------
13 owner=tes@puffy.melbourne.sgi.com
16 echo "QA output created by $seq"
20 status=1 # failure is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
29 # get standard environment, filters and checks
33 # real QA test starts here
35 #_notrun "Need to fix up filtering before checkin"
37 # Modify as appropriate.
39 _supported_os IRIX Linux
42 export MKFS_OPTIONS="-i size=512,attr=2"
46 file=$SCRATCH_MNT/file
48 inum=`ls -i $file | awk '{print $1}'`
60 echo ""; echo "** add $start..$end EAs **"
62 while [ $i -le $end ]; do
63 attr -s name.$i -V value $file >/dev/null
72 echo ""; echo "** rm $start..$end EAs **"
74 while [ $i -le $end ]; do
75 attr -r name.$i $file >/dev/null
83 echo ""; echo "** $num extents **"
84 src/makeextents -v -p -w -n $num $file
90 xfs_db -r -c "inode $inum" -c "print" $SCRATCH_DEV |\
92 /nextents/ { print; next }
93 /naextents/ { print; next }
96 /forkoff/ { printf("core.forkoff = %d (%d bytes)\n", $3, $3*8); next }
97 /format/ { print; next }
98 /size/ { print; next }
106 xfs_db -r -c "inode $inum" -c "print u" $SCRATCH_DEV
113 xfs_db -r -c "inode $inum" -c "print a" $SCRATCH_DEV
171 while [ $j -le 30 ]; do
179 while [ $j -ge 1 ]; do
187 while [ $j -le 30 ]; do
195 # Using a nested loop,
196 # for various number of data extents,
197 # try adding EAs and then removing EAs
198 # Check that when we play with the EAs that we don't mess with the extents
202 # now do the EAs with the extents
208 for i in `seq 1 $extents_inc $extents_max`; do
210 echo "--- extents: $i ---"
212 _print_inode_u > $tmp.u1
213 for j in `seq 1 $EAs_inc $EAs_max`; do
214 k=`expr $j + $EAs_inc - 1`
217 # should have same extents
219 _print_inode_u > $tmp.u2
221 _print_inode_u > $tmp.u3
224 echo "*** Extent differences before and after EAs added ***"
225 diff -s $tmp.u1 $tmp.u2 | _filter
227 if ! diff $tmp.u1 $tmp.u2 >/dev/null; then
228 echo "Data extents magically changed"
233 echo "*** Extent differences before and after EAs removed ***"
234 diff -s $tmp.u2 $tmp.u3 | _filter
236 if ! diff $tmp.u2 $tmp.u3 >/dev/null; then
237 echo "Data extents magically changed"
244 # The counterpart of _test_extents_eas
245 # with the nested loops reversed.
246 # For various number of EAs, try adding extents
247 # Check that when we play with the data extents that we don't mess with the EAs
251 # now do the EAs with the extents
257 for j in `seq 1 $EAs_inc $EAs_max`; do
259 k=`expr $j + $EAs_inc - 1`
261 echo "--- EAs: $j ---"
264 _print_inode_a > $tmp.a1
265 for i in `seq 1 $extents_inc $extents_max`; do
269 # should have same EAs
271 _print_inode_a > $tmp.a2
273 _print_inode_a > $tmp.a3
276 echo "*** EA differences before and after extents added ***"
277 diff -s $tmp.a1 $tmp.a2 | _filter
279 if ! diff $tmp.a1 $tmp.a2 >/dev/null; then
280 echo "EAs magically changed"
285 echo "*** EA differences before and after extents removed ***"
286 diff -s $tmp.a2 $tmp.a3 | _filter
288 if ! diff $tmp.a2 $tmp.a3 >/dev/null; then
289 echo "EAs magically changed"
296 # test to see how we go
299 # test to ensure it fits a max sf EA
301 # literal part of inode starts at offset 100 (decimal)
302 # for 512 bytes inode that gives 412 bytes of literal area
304 # min btree root (numrecs=3) => 3 * 16 + (4 or 8)
305 # for 8 byte alignment => 56 bytes
306 # => 512 - 156 = 356 bytes
320 # vlen = 356 - (6+4) = 346
323 _test_initial_sf_ea()
329 dd if=/dev/zero bs=1 count=$vlen | attr -s name $file
341 # do a test with a variety of sized EAs