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.
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation.
15 # This program is distributed in the hope that it would be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write the Free Software Foundation,
22 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #-----------------------------------------------------------------------
28 seqres=$RESULT_DIR/$seq
29 seqres=$RESULT_DIR/$seq
30 seqres=$RESULT_DIR/$seq
31 echo "QA output created by $seq"
35 status=1 # failure is the default!
36 trap "_cleanup; exit \$status" 0 1 2 3 15
44 # get standard environment, filters and checks
49 # real QA test starts here
51 #_notrun "Need to fix up filtering before checkin"
53 # Modify as appropriate.
55 _supported_os IRIX Linux
60 export MKFS_OPTIONS="-i size=512,attr=2"
61 _scratch_mkfs_xfs > /dev/null 2>&1
64 file=$SCRATCH_MNT/file
66 inum=`ls -i $file | awk '{print $1}'`
78 echo ""; echo "** add $start..$end EAs **"
80 while [ $i -le $end ]; do
81 ${ATTR_PROG} -s name.$i -V value $file >/dev/null
90 echo ""; echo "** rm $start..$end EAs **"
92 while [ $i -le $end ]; do
93 ${ATTR_PROG} -r name.$i $file >/dev/null
101 echo ""; echo "** $num extents **"
102 src/makeextents -v -p -w -n $num $file
108 xfs_db -r -c "inode $inum" -c "print" $SCRATCH_DEV |\
110 /nextents/ { print; next }
111 /naextents/ { print; next }
112 /u\./ { print; next }
113 /a\./ { print; next }
114 /forkoff/ { printf("core.forkoff = %d (%d bytes)\n", $3, $3*8); next }
115 /format/ { print; next }
116 /size/ { print; next }
124 xfs_db -r -c "inode $inum" -c "print u" $SCRATCH_DEV
131 xfs_db -r -c "inode $inum" -c "print a" $SCRATCH_DEV
189 while [ $j -le 30 ]; do
197 while [ $j -ge 1 ]; do
205 while [ $j -le 30 ]; do
213 # Using a nested loop,
214 # for various number of data extents,
215 # try adding EAs and then removing EAs
216 # Check that when we play with the EAs that we don't mess with the extents
220 # now do the EAs with the extents
226 for i in `seq 1 $extents_inc $extents_max`; do
228 echo "--- extents: $i ---"
230 _print_inode_u > $tmp.u1
231 for j in `seq 1 $EAs_inc $EAs_max`; do
235 # should have same extents
237 _print_inode_u > $tmp.u2
239 _print_inode_u > $tmp.u3
242 echo "*** Extent differences before and after EAs added ***"
243 diff -s $tmp.u1 $tmp.u2 | _filter
245 if ! diff $tmp.u1 $tmp.u2 >/dev/null; then
246 echo "Data extents magically changed"
251 echo "*** Extent differences before and after EAs removed ***"
252 diff -s $tmp.u2 $tmp.u3 | _filter
254 if ! diff $tmp.u2 $tmp.u3 >/dev/null; then
255 echo "Data extents magically changed"
262 # The counterpart of _test_extents_eas
263 # with the nested loops reversed.
264 # For various number of EAs, try adding extents
265 # Check that when we play with the data extents that we don't mess with the EAs
269 # now do the EAs with the extents
275 for j in `seq 1 $EAs_inc $EAs_max`; do
279 echo "--- EAs: $j ---"
282 _print_inode_a > $tmp.a1
283 for i in `seq 1 $extents_inc $extents_max`; do
287 # should have same EAs
289 _print_inode_a > $tmp.a2
291 _print_inode_a > $tmp.a3
294 echo "*** EA differences before and after extents added ***"
295 diff -s $tmp.a1 $tmp.a2 | _filter
297 if ! diff $tmp.a1 $tmp.a2 >/dev/null; then
298 echo "EAs magically changed"
303 echo "*** EA differences before and after extents removed ***"
304 diff -s $tmp.a2 $tmp.a3 | _filter
306 if ! diff $tmp.a2 $tmp.a3 >/dev/null; then
307 echo "EAs magically changed"
314 # test to see how we go
317 # test to ensure it fits a max sf EA
319 # literal part of inode starts at offset 100 (decimal)
320 # for 512 bytes inode that gives 412 bytes of literal area
322 # min btree root (numrecs=3) => 3 * 16 + (4 or 8)
323 # for 8 byte alignment => 56 bytes
324 # => 512 - 156 = 356 bytes
338 # vlen = 356 - (6+4) = 346
341 _test_initial_sf_ea()
347 dd if=/dev/zero bs=1 count=$vlen | ${ATTR_PROG} -s name $file
359 # do a test with a variety of sized EAs