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 #-----------------------------------------------------------------------
27 owner=tes@puffy.melbourne.sgi.com
30 echo "QA output created by $seq"
34 status=1 # failure is the default!
35 trap "_cleanup; exit \$status" 0 1 2 3 15
43 # get standard environment, filters and checks
47 # real QA test starts here
49 #_notrun "Need to fix up filtering before checkin"
51 # Modify as appropriate.
53 _supported_os IRIX Linux
56 export MKFS_OPTIONS="-i size=512,attr=2"
60 file=$SCRATCH_MNT/file
62 inum=`ls -i $file | awk '{print $1}'`
74 echo ""; echo "** add $start..$end EAs **"
76 while [ $i -le $end ]; do
77 attr -s name.$i -V value $file >/dev/null
86 echo ""; echo "** rm $start..$end EAs **"
88 while [ $i -le $end ]; do
89 attr -r name.$i $file >/dev/null
97 echo ""; echo "** $num extents **"
98 src/makeextents -v -p -w -n $num $file
104 xfs_db -r -c "inode $inum" -c "print" $SCRATCH_DEV |\
106 /nextents/ { print; next }
107 /naextents/ { print; next }
108 /u\./ { print; next }
109 /a\./ { print; next }
110 /forkoff/ { printf("core.forkoff = %d (%d bytes)\n", $3, $3*8); next }
111 /format/ { print; next }
112 /size/ { print; next }
120 xfs_db -r -c "inode $inum" -c "print u" $SCRATCH_DEV
127 xfs_db -r -c "inode $inum" -c "print a" $SCRATCH_DEV
185 while [ $j -le 30 ]; do
193 while [ $j -ge 1 ]; do
201 while [ $j -le 30 ]; do
209 # Using a nested loop,
210 # for various number of data extents,
211 # try adding EAs and then removing EAs
212 # Check that when we play with the EAs that we don't mess with the extents
216 # now do the EAs with the extents
222 for i in `seq 1 $extents_inc $extents_max`; do
224 echo "--- extents: $i ---"
226 _print_inode_u > $tmp.u1
227 for j in `seq 1 $EAs_inc $EAs_max`; do
231 # should have same extents
233 _print_inode_u > $tmp.u2
235 _print_inode_u > $tmp.u3
238 echo "*** Extent differences before and after EAs added ***"
239 diff -s $tmp.u1 $tmp.u2 | _filter
241 if ! diff $tmp.u1 $tmp.u2 >/dev/null; then
242 echo "Data extents magically changed"
247 echo "*** Extent differences before and after EAs removed ***"
248 diff -s $tmp.u2 $tmp.u3 | _filter
250 if ! diff $tmp.u2 $tmp.u3 >/dev/null; then
251 echo "Data extents magically changed"
258 # The counterpart of _test_extents_eas
259 # with the nested loops reversed.
260 # For various number of EAs, try adding extents
261 # Check that when we play with the data extents that we don't mess with the EAs
265 # now do the EAs with the extents
271 for j in `seq 1 $EAs_inc $EAs_max`; do
275 echo "--- EAs: $j ---"
278 _print_inode_a > $tmp.a1
279 for i in `seq 1 $extents_inc $extents_max`; do
283 # should have same EAs
285 _print_inode_a > $tmp.a2
287 _print_inode_a > $tmp.a3
290 echo "*** EA differences before and after extents added ***"
291 diff -s $tmp.a1 $tmp.a2 | _filter
293 if ! diff $tmp.a1 $tmp.a2 >/dev/null; then
294 echo "EAs magically changed"
299 echo "*** EA differences before and after extents removed ***"
300 diff -s $tmp.a2 $tmp.a3 | _filter
302 if ! diff $tmp.a2 $tmp.a3 >/dev/null; then
303 echo "EAs magically changed"
310 # test to see how we go
313 # test to ensure it fits a max sf EA
315 # literal part of inode starts at offset 100 (decimal)
316 # for 512 bytes inode that gives 412 bytes of literal area
318 # min btree root (numrecs=3) => 3 * 16 + (4 or 8)
319 # for 8 byte alignment => 56 bytes
320 # => 512 - 156 = 356 bytes
334 # vlen = 356 - (6+4) = 346
337 _test_initial_sf_ea()
343 dd if=/dev/zero bs=1 count=$vlen | attr -s name $file
355 # do a test with a variety of sized EAs