xfs: fix $XFS_DB_PROG usage
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 30 Sep 2016 02:23:41 +0000 (19:23 -0700)
committerEryu Guan <eguan@redhat.com>
Fri, 7 Oct 2016 09:18:53 +0000 (17:18 +0800)
xfs_db requires us to pass in the log device, if any; this can be
accomplished via _scratch_xfs_db_options (if we're operating on the
scratch device, anyway).  However, many of the tests/xfs/ scripts
pass only $SCRATCH_DEV directly, so they'll fail if we test with an
external log.  Fix that by adding a new _scratch_xfs_db helper.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
37 files changed:
common/populate
common/rc
tests/xfs/001
tests/xfs/002
tests/xfs/070
tests/xfs/077
tests/xfs/086
tests/xfs/087
tests/xfs/088
tests/xfs/089
tests/xfs/091
tests/xfs/093
tests/xfs/097
tests/xfs/098
tests/xfs/099
tests/xfs/100
tests/xfs/101
tests/xfs/102
tests/xfs/105
tests/xfs/111
tests/xfs/112
tests/xfs/113
tests/xfs/117
tests/xfs/120
tests/xfs/123
tests/xfs/124
tests/xfs/125
tests/xfs/126
tests/xfs/130
tests/xfs/135
tests/xfs/137
tests/xfs/179
tests/xfs/186
tests/xfs/187
tests/xfs/235
tests/xfs/287
tests/xfs/298

index aa6ed7939739f73998d5331838a1a0a88a81df79..d0003c5ec197a72ad94456497d0a7199ce322c13 100644 (file)
@@ -275,38 +275,35 @@ __populate_find_inode() {
 
 # Check data fork format of XFS file
 __populate_check_xfs_dformat() {
 
 # Check data fork format of XFS file
 __populate_check_xfs_dformat() {
-       dev="$1"
-       inode="$2"
-       format="$3"
+       inode="$1"
+       format="$2"
 
 
-       fmt="$($XFS_DB_PROG -c "inode ${inode}" -c 'p core.format' "${dev}" | sed -e 's/^.*(\([a-z]*\)).*$/\1/g')"
+       fmt="$(_scratch_xfs_db -c "inode ${inode}" -c 'p core.format' | sed -e 's/^.*(\([a-z]*\)).*$/\1/g')"
        test "${format}" = "${fmt}" || _fail "failed to create ino ${inode} dformat expected ${format} saw ${fmt}"
 }
 
 # Check attr fork format of XFS file
 __populate_check_xfs_aformat() {
        test "${format}" = "${fmt}" || _fail "failed to create ino ${inode} dformat expected ${format} saw ${fmt}"
 }
 
 # Check attr fork format of XFS file
 __populate_check_xfs_aformat() {
-       dev="$1"
-       inode="$2"
-       format="$3"
+       inode="$1"
+       format="$2"
 
 
-       fmt="$($XFS_DB_PROG -c "inode ${inode}" -c 'p core.aformat' "${dev}" | sed -e 's/^.*(\([a-z]*\)).*$/\1/g')"
+       fmt="$(_scratch_xfs_db -c "inode ${inode}" -c 'p core.aformat' | sed -e 's/^.*(\([a-z]*\)).*$/\1/g')"
        test "${format}" = "${fmt}" || _fail "failed to create ino ${inode} aformat expected ${format} saw ${fmt}"
 }
 
 # Check structure of XFS directory
 __populate_check_xfs_dir() {
        test "${format}" = "${fmt}" || _fail "failed to create ino ${inode} aformat expected ${format} saw ${fmt}"
 }
 
 # Check structure of XFS directory
 __populate_check_xfs_dir() {
-       dev="$1"
-       inode="$2"
-       dtype="$3"
+       inode="$1"
+       dtype="$2"
 
        (test -n "${leaf_lblk}" && test -n "${node_lblk}") || _fail "must define leaf_lblk and node_lblk before calling __populate_check_xfs_dir"
        datab=0
        leafb=0
        freeb=0
 
        (test -n "${leaf_lblk}" && test -n "${node_lblk}") || _fail "must define leaf_lblk and node_lblk before calling __populate_check_xfs_dir"
        datab=0
        leafb=0
        freeb=0
-       #echo "== check dir ${inode} type ${dtype}" ; $XFS_DB_PROG -x -c "inode ${inode}" -c "bmap" "${SCRATCH_DEV}"
-       $XFS_DB_PROG -x -c "inode ${inode}" -c "dblock 0" -c "stack" "${SCRATCH_DEV}" | grep -q 'file data block is unmapped' || datab=1
-       $XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${leaf_lblk}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file data block is unmapped' || leafb=1
-       $XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${node_lblk}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file data block is unmapped' || freeb=1
+       #echo "== check dir ${inode} type ${dtype}" ; _scratch_xfs_db -x -c "inode ${inode}" -c "bmap"
+       _scratch_xfs_db -x -c "inode ${inode}" -c "dblock 0" -c "stack" | grep -q 'file data block is unmapped' || datab=1
+       _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${leaf_lblk}" -c "stack" | grep -q 'file data block is unmapped' || leafb=1
+       _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${node_lblk}" -c "stack" | grep -q 'file data block is unmapped' || freeb=1
 
        case "${dtype}" in
        "shortform"|"inline"|"local")
 
        case "${dtype}" in
        "shortform"|"inline"|"local")
@@ -328,15 +325,14 @@ __populate_check_xfs_dir() {
 
 # Check structure of XFS attr
 __populate_check_xfs_attr() {
 
 # Check structure of XFS attr
 __populate_check_xfs_attr() {
-       dev="$1"
-       inode="$2"
-       atype="$3"
+       inode="$1"
+       atype="$2"
 
        datab=0
        leafb=0
 
        datab=0
        leafb=0
-       #echo "== check attr ${inode} type ${dtype}" ; $XFS_DB_PROG -x -c "inode ${inode}" -c "bmap -a" "${SCRATCH_DEV}"
-       $XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 0" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' || datab=1
-       $XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 1" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' || leafb=1
+       #echo "== check attr ${inode} type ${dtype}" ; _scratch_xfs_db -x -c "inode ${inode}" -c "bmap -a"
+       _scratch_xfs_db -x -c "inode ${inode}" -c "ablock 0" -c "stack" | grep -q 'file attr block is unmapped' || datab=1
+       _scratch_xfs_db -x -c "inode ${inode}" -c "ablock 1" -c "stack" | grep -q 'file attr block is unmapped' || leafb=1
 
        case "${atype}" in
        "shortform"|"inline"|"local")
 
        case "${atype}" in
        "shortform"|"inline"|"local")
@@ -378,28 +374,28 @@ _scratch_xfs_populate_check() {
        node_lblk="$((64 * 1073741824 / blksz))"
        umount "${SCRATCH_MNT}"
 
        node_lblk="$((64 * 1073741824 / blksz))"
        umount "${SCRATCH_MNT}"
 
-       __populate_check_xfs_dformat "${SCRATCH_DEV}" "${extents_file}" "extents"
-       __populate_check_xfs_dformat "${SCRATCH_DEV}" "${btree_file}" "btree"
-       __populate_check_xfs_dir "${SCRATCH_DEV}" "${inline_dir}" "inline"
-       __populate_check_xfs_dir "${SCRATCH_DEV}" "${block_dir}" "block"
-       __populate_check_xfs_dir "${SCRATCH_DEV}" "${leaf_dir}" "leaf"
-       __populate_check_xfs_dir "${SCRATCH_DEV}" "${node_dir}" "node"
-       __populate_check_xfs_dir "${SCRATCH_DEV}" "${btree_dir}" "btree"
-       __populate_check_xfs_dformat "${SCRATCH_DEV}" "${btree_dir}" "btree"
-       __populate_check_xfs_dformat "${SCRATCH_DEV}" "${bdev}" "dev"
-       __populate_check_xfs_dformat "${SCRATCH_DEV}" "${cdev}" "dev"
-       __populate_check_xfs_attr "${SCRATCH_DEV}" "${local_attr}" "local"
-       __populate_check_xfs_attr "${SCRATCH_DEV}" "${leaf_attr}" "leaf"
-       __populate_check_xfs_attr "${SCRATCH_DEV}" "${node_attr}" "node"
-       __populate_check_xfs_attr "${SCRATCH_DEV}" "${btree_attr}" "btree"
-       __populate_check_xfs_aformat "${SCRATCH_DEV}" "${btree_attr}" "btree"
+       __populate_check_xfs_dformat "${extents_file}" "extents"
+       __populate_check_xfs_dformat "${btree_file}" "btree"
+       __populate_check_xfs_dir "${inline_dir}" "inline"
+       __populate_check_xfs_dir "${block_dir}" "block"
+       __populate_check_xfs_dir "${leaf_dir}" "leaf"
+       __populate_check_xfs_dir "${node_dir}" "node"
+       __populate_check_xfs_dir "${btree_dir}" "btree"
+       __populate_check_xfs_dformat "${btree_dir}" "btree"
+       __populate_check_xfs_dformat "${bdev}" "dev"
+       __populate_check_xfs_dformat "${cdev}" "dev"
+       __populate_check_xfs_attr "${local_attr}" "local"
+       __populate_check_xfs_attr "${leaf_attr}" "leaf"
+       __populate_check_xfs_attr "${node_attr}" "node"
+       __populate_check_xfs_attr "${btree_attr}" "btree"
+       __populate_check_xfs_aformat "${btree_attr}" "btree"
 }
 
 # Check data fork format of ext4 file
 __populate_check_ext4_dformat() {
 }
 
 # Check data fork format of ext4 file
 __populate_check_ext4_dformat() {
-       dev="$1"
-       inode="$2"
-       format="$3"
+       dev="${SCRATCH_DEV}"
+       inode="$1"
+       format="$2"
 
        extents=0
        etree=0
 
        extents=0
        etree=0
@@ -424,9 +420,9 @@ __populate_check_ext4_dformat() {
 
 # Check attr fork format of ext4 file
 __populate_check_ext4_aformat() {
 
 # Check attr fork format of ext4 file
 __populate_check_ext4_aformat() {
-       dev="$1"
-       inode="$2"
-       format="$3"
+       dev="${SCRATCH_DEV}"
+       inode="$1"
+       format="$2"
 
        ablock=1
        debugfs -R "stat <${inode}>" "${dev}" 2> /dev/null | grep 'File ACL: 0' -q && ablock=0
 
        ablock=1
        debugfs -R "stat <${inode}>" "${dev}" 2> /dev/null | grep 'File ACL: 0' -q && ablock=0
@@ -445,9 +441,9 @@ __populate_check_ext4_aformat() {
 
 # Check structure of ext4 dir
 __populate_check_ext4_dir() {
 
 # Check structure of ext4 dir
 __populate_check_ext4_dir() {
-       dev="$1"
-       inode="$2"
-       dtype="$3"
+       dev="${SCRATCH_DEV}"
+       inode="$1"
+       dtype="$2"
 
        htree=0
        inline=0
 
        htree=0
        inline=0
@@ -483,13 +479,13 @@ _scratch_ext4_populate_check() {
        block_attr="$(__populate_find_inode "${SCRATCH_MNT}/ATTR.FMT_BLOCK")"
        umount "${SCRATCH_MNT}"
 
        block_attr="$(__populate_find_inode "${SCRATCH_MNT}/ATTR.FMT_BLOCK")"
        umount "${SCRATCH_MNT}"
 
-       __populate_check_ext4_dformat "${SCRATCH_DEV}" "${extents_file}" "extents"
-       __populate_check_ext4_dformat "${SCRATCH_DEV}" "${etree_file}" "etree"
-       __populate_check_ext4_dir "${SCRATCH_DEV}" "${block_dir}" "block"
-       __populate_check_ext4_dir "${SCRATCH_DEV}" "${htree_dir}" "htree"
-       __populate_check_ext4_dformat "${SCRATCH_DEV}" "${extents_slink}" "extents"
-       __populate_check_ext4_aformat "${SCRATCH_DEV}" "${local_attr}" "local"
-       __populate_check_ext4_aformat "${SCRATCH_DEV}" "${block_attr}" "block"
+       __populate_check_ext4_dformat "${extents_file}" "extents"
+       __populate_check_ext4_dformat "${etree_file}" "etree"
+       __populate_check_ext4_dir "${block_dir}" "block"
+       __populate_check_ext4_dir "${htree_dir}" "htree"
+       __populate_check_ext4_dformat "${extents_slink}" "extents"
+       __populate_check_ext4_aformat "${local_attr}" "local"
+       __populate_check_ext4_aformat "${block_attr}" "block"
 }
 
 # Populate a scratch FS and check the contents to make sure we got that
 }
 
 # Populate a scratch FS and check the contents to make sure we got that
index 73387790b3dae2e62d3d8a804e964bd51bc9008b..c3da064a34033d96d7078cf38df7021deb0a7f96 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -1106,6 +1106,11 @@ _scratch_xfs_db_options()
     echo $SCRATCH_OPTIONS $* $SCRATCH_DEV
 }
 
     echo $SCRATCH_OPTIONS $* $SCRATCH_DEV
 }
 
+_scratch_xfs_db()
+{
+       $XFS_DB_PROG "$@" $(_scratch_xfs_db_options)
+}
+
 _scratch_xfs_logprint()
 {
     SCRATCH_OPTIONS=""
 _scratch_xfs_logprint()
 {
     SCRATCH_OPTIONS=""
@@ -2083,7 +2088,7 @@ _require_xfs_db_command()
        fi
        command=$1
 
        fi
        command=$1
 
-       $XFS_DB_PROG -x -c "help" $SCRATCH_DEV | grep $command > /dev/null || \
+       _scratch_xfs_db -x -c "help" | grep $command > /dev/null || \
                _notrun "xfs_db $command support is missing"
 }
 
                _notrun "xfs_db $command support is missing"
 }
 
@@ -3367,11 +3372,11 @@ _require_meta_uuid()
        # This will create a crc fs on $SCRATCH_DEV
        _require_xfs_crc
 
        # This will create a crc fs on $SCRATCH_DEV
        _require_xfs_crc
 
-       $XFS_DB_PROG -x -c "uuid restore" $SCRATCH_DEV 2>&1 \
+       _scratch_xfs_db -x -c "uuid restore" 2>&1 \
           | grep -q "invalid UUID\|supported on V5 fs" \
           && _notrun "Userspace doesn't support meta_uuid feature"
 
           | grep -q "invalid UUID\|supported on V5 fs" \
           && _notrun "Userspace doesn't support meta_uuid feature"
 
-       $XFS_DB_PROG -x -c "uuid generate" $SCRATCH_DEV >/dev/null 2>&1
+       _scratch_xfs_db -x -c "uuid generate" >/dev/null 2>&1
 
        _scratch_mount >/dev/null 2>&1 \
           || _notrun "Kernel doesn't support meta_uuid feature"
 
        _scratch_mount >/dev/null 2>&1 \
           || _notrun "Kernel doesn't support meta_uuid feature"
index c33adae74b42bc5fc76377884d07850237f6f639..2c205f064e2e11db6924378ef45f3a77bd1d726d 100755 (executable)
@@ -44,11 +44,11 @@ _do_bit_test()
        bits="$2"
 
        echo "testing $field with $bits bits"
        bits="$2"
 
        echo "testing $field with $bits bits"
-       $XFS_DB_PROG -x -c "inode $FILE_INO" -c "write $field 0" $SCRATCH_DEV
+       _scratch_xfs_db -x -c "inode $FILE_INO" -c "write $field 0"
        num=1
        for n in `seq 0 1 $bits`; do
        num=1
        for n in `seq 0 1 $bits`; do
-               $XFS_DB_PROG -x -c "inode $FILE_INO" \
-                         -c "write $field $num" $SCRATCH_DEV
+               _scratch_xfs_db -x -c "inode $FILE_INO" \
+                         -c "write $field $num"
                let num=$num*2
        done
        echo
                let num=$num*2
        done
        echo
@@ -89,10 +89,10 @@ _do_bit_test "u.bmx[0].startoff" $BMBT_STARTOFF_BITLEN
 _do_bit_test "u.bmx[0].startblock" $BMBT_STARTBLOCK_BITLEN
 _do_bit_test "u.bmx[0].blockcount" $BMBT_BLOCKCOUNT_BITLEN
 # test setting the 32 bit generation number
 _do_bit_test "u.bmx[0].startblock" $BMBT_STARTBLOCK_BITLEN
 _do_bit_test "u.bmx[0].blockcount" $BMBT_BLOCKCOUNT_BITLEN
 # test setting the 32 bit generation number
-$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen 0x5a" $SCRATCH_DEV
-$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen 0xa5" $SCRATCH_DEV
-$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen 0" $SCRATCH_DEV
-$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen #5a5a" $SCRATCH_DEV
-$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen #a5a5" $SCRATCH_DEV
+_scratch_xfs_db -x -c "inode $FILE_INO" -c "write core.gen 0x5a"
+_scratch_xfs_db -x -c "inode $FILE_INO" -c "write core.gen 0xa5"
+_scratch_xfs_db -x -c "inode $FILE_INO" -c "write core.gen 0"
+_scratch_xfs_db -x -c "inode $FILE_INO" -c "write core.gen #5a5a"
+_scratch_xfs_db -x -c "inode $FILE_INO" -c "write core.gen #a5a5"
 status=0
 exit
 status=0
 exit
index 6dfdd6c7c9ac8d0ae9d28593f009e8c28e8260c8..741117be40787e1bc065936dd0cb936d8a9e5471 100755 (executable)
@@ -62,8 +62,8 @@ _scratch_mkfs_xfs -m crc=0 -d size=128m >> $seqres.full 2>&1 || _fail "mkfs fail
 # Scribble past a couple V4 secondary superblocks to populate sb_crc
 # (We can't write to the structure member because it doesn't exist
 # on a v4 superblock, so we use the data type & "write fill")
 # Scribble past a couple V4 secondary superblocks to populate sb_crc
 # (We can't write to the structure member because it doesn't exist
 # on a v4 superblock, so we use the data type & "write fill")
-$XFS_DB_PROG -x -c "sb 1" -c "type data" -c "write fill 0xff 224 4" $SCRATCH_DEV
-$XFS_DB_PROG -x -c "sb 2" -c "type data" -c "write fill 0xff 224 4" $SCRATCH_DEV
+_scratch_xfs_db -x -c "sb 1" -c "type data" -c "write fill 0xff 224 4"
+_scratch_xfs_db -x -c "sb 2" -c "type data" -c "write fill 0xff 224 4"
 
 _scratch_mount
 
 
 _scratch_mount
 
index e3a48b3eaeb4791e4fe71e124677ff0db725c18e..0ae6effa55f1483a1e630daecf32df290d1d154d 100755 (executable)
@@ -100,8 +100,8 @@ _scratch_mkfs | _filter_mkfs > /dev/null 2> $tmp.mkfs || _fail "mkfs failed"
 . $tmp.mkfs # import agcount
 
 # corrupt the last secondary sb in the fs
 . $tmp.mkfs # import agcount
 
 # corrupt the last secondary sb in the fs
-$XFS_DB_PROG -x -c "sb $((agcount - 1))" -c "type data" \
-       -c "write fill 0xff 0 512" $SCRATCH_DEV
+_scratch_xfs_db -x -c "sb $((agcount - 1))" -c "type data" \
+       -c "write fill 0xff 0 512"
 
 # attempt to repair
 _xfs_repair_noscan
 
 # attempt to repair
 _xfs_repair_noscan
index 007d05de4579616091eaf314ae3c48a296cbc6b4..eba4f085ee4cc17639e0fa35e50fce0e2c0d6d53 100755 (executable)
@@ -64,9 +64,9 @@ _test_uuid()
        ACTION=$1
        EXPECTED_UUID=$2
 
        ACTION=$1
        EXPECTED_UUID=$2
 
-       $XFS_DB_PROG -x -c "uuid $ACTION" $SCRATCH_DEV \
+       _scratch_xfs_db -x -c "uuid $ACTION" \
                                        | _filter_uuid $EXPECTED_UUID
                                        | _filter_uuid $EXPECTED_UUID
-       NEW_UUID=`$XFS_DB_PROG -c "uuid"  $SCRATCH_DEV | awk '{print $NF}'`
+       NEW_UUID=`_scratch_xfs_db -c "uuid"  | awk '{print $NF}'`
        _check_scratch_fs
        _scratch_mount || _fail "Mount failed after UUID $ACTION"
        _scratch_unmount
        _check_scratch_fs
        _scratch_mount || _fail "Mount failed after UUID $ACTION"
        _scratch_unmount
@@ -83,7 +83,7 @@ rm -f $seqres.full
 
 _scratch_mkfs_xfs -m crc=1 >> $seqres.full 2>&1 || _fail "mkfs failed"
 
 
 _scratch_mkfs_xfs -m crc=1 >> $seqres.full 2>&1 || _fail "mkfs failed"
 
-ORIG_UUID=`$XFS_DB_PROG -c "uuid" $SCRATCH_DEV | awk '{print $NF}'`
+ORIG_UUID=`_scratch_xfs_db -c "uuid" | awk '{print $NF}'`
 
 _scratch_mount
 # Put some stuff on the fs
 
 _scratch_mount
 # Put some stuff on the fs
index 143915bafaa1195903d5e10f89ea9da967c0da42..cf0a71a71f97f5e210608614f3586593d4faad32 100755 (executable)
@@ -87,7 +87,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-       $XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+       _scratch_xfs_db -x -c "agf ${ag}" -c "agf ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" >> $seqres.full 2>&1
 done
 
 # Try to append to files; this should fail
 done
 
 # Try to append to files; this should fail
index 97c6680f8492c12f5bc53ee2cdeb1cce456f7575..0bb3ec14901d977145830b811f2e0bcfed3a09f9 100755 (executable)
@@ -86,7 +86,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-       $XFS_DB_PROG -x -c "agi ${ag}" -c "agi ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+       _scratch_xfs_db -x -c "agi ${ag}" -c "agi ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" >> $seqres.full 2>&1
 done
 
 echo "+ mount image"
 done
 
 echo "+ mount image"
index 18bf6ada26f8b7d60039186f394ac59b853ebdcd..d6972a440aec2693c73842ff022d49193d119a51 100755 (executable)
@@ -86,7 +86,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-       $XFS_DB_PROG -x -c "agfl ${ag}" -c "agfl ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+       _scratch_xfs_db -x -c "agfl ${ag}" -c "agfl ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" >> $seqres.full 2>&1
 done
 
 # Try to append to files; this should fail
 done
 
 # Try to append to files; this should fail
index b6e512f4e96e0786311a2266b12069ffbbeafe08..06996a5da2a9528fec33ca41b949fb7bc775065f 100755 (executable)
@@ -86,7 +86,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-       $XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "addr bnoroot" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+       _scratch_xfs_db -x -c "agf ${ag}" -c "agf ${ag}" -c "addr bnoroot" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full 2>&1
 done
 
 # Try to append to files; this should fail
 done
 
 # Try to append to files; this should fail
index f995d9c610902c4a8877fd6bfcada5292c928214..a263cb0890e3ba1d673a6a9bcff5715221126cf3 100755 (executable)
@@ -86,7 +86,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-       $XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "addr cntroot" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+       _scratch_xfs_db -x -c "agf ${ag}" -c "agf ${ag}" -c "addr cntroot" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full 2>&1
 done
 
 # Try to append to files; this should fail
 done
 
 # Try to append to files; this should fail
index 7d4d9b849aef35e47a159d238288e56e05b74667..753231eaefec0e54b35ebafa637e5724c51efcbc 100755 (executable)
@@ -86,7 +86,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-       $XFS_DB_PROG -x -c "agi ${ag}" -c "agi ${ag}" -c "addr root" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+       _scratch_xfs_db -x -c "agi ${ag}" -c "agi ${ag}" -c "addr root" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full 2>&1
 done
 
 echo "+ mount image"
 done
 
 echo "+ mount image"
index f5a8178785629f67b8dd289ce17f504cc0e00aa5..a75f06a4e98ae83e3ebfe1cb387bf25b56d0e40c 100755 (executable)
@@ -89,7 +89,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-       $XFS_DB_PROG -x -c "agi ${ag}" -c "agi ${ag}" -c "addr free_root" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+       _scratch_xfs_db -x -c "agi ${ag}" -c "agi ${ag}" -c "addr free_root" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full 2>&1
 done
 
 echo "+ mount image"
 done
 
 echo "+ mount image"
index 86ec62cedf2e0fb1b4ce130feee2e7a45910a5e2..581377e2efa4c3a9110a00dfbdf5734358bb2531 100755 (executable)
@@ -95,8 +95,8 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ corrupt image"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ corrupt image"
-logstart="$($XFS_DB_PROG -c 'sb 0' -c 'p' "${SCRATCH_DEV}" | grep '^logstart =' | cut -d ' ' -f 3)"
-logstart="$($XFS_DB_PROG -c "convert fsblock ${logstart} byte" "${SCRATCH_DEV}" | sed -e 's/^.*(\([0-9]*\).*$/\1/g')"
+logstart="$(_scratch_xfs_db -c 'sb 0' -c 'p' | grep '^logstart =' | cut -d ' ' -f 3)"
+logstart="$(_scratch_xfs_db -c "convert fsblock ${logstart} byte" | sed -e 's/^.*(\([0-9]*\).*$/\1/g')"
 logblocks="$(xfs_db -c 'sb 0' -c 'p' "${SCRATCH_DEV}" | grep '^logblocks =' | cut -d ' ' -f 3)"
 $XFS_IO_PROG -f -c "pwrite -S 0x62 ${logstart} $((logblocks * blksz))" "${SCRATCH_DEV}" >> $seqres.full
 
 logblocks="$(xfs_db -c 'sb 0' -c 'p' "${SCRATCH_DEV}" | grep '^logblocks =' | cut -d ' ' -f 3)"
 $XFS_IO_PROG -f -c "pwrite -S 0x62 ${logstart} $((logblocks * blksz))" "${SCRATCH_DEV}" >> $seqres.full
 
index 36cf893d0b4054b032cc94570e09496d0a9f7de7..ebc02dd7b4d4851f8ae4dd991504406f7c700cd8 100755 (executable)
@@ -78,7 +78,7 @@ echo "+ check dir"
 __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" block
 
 echo "+ corrupt dir"
 __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" block
 
 echo "+ corrupt dir"
-$XFS_DB_PROG -x -c "inode ${inode}" -c 'dblock 0' -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+_scratch_xfs_db -x -c "inode ${inode}" -c 'dblock 0' -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
 
 echo "+ mount image"
 _scratch_mount
 
 echo "+ mount image"
 _scratch_mount
index 397c61372abffab226458fe1895162e4cdbf47e0..2412c819deeb454892e87e0c65d72f950fc2c613 100755 (executable)
@@ -80,8 +80,8 @@ __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" leaf
 echo "+ corrupt dir"
 loff=0
 while true; do
 echo "+ corrupt dir"
 loff=0
 while true; do
-       $XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file data block is unmapped' && break
-       $XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+       _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" | grep -q 'file data block is unmapped' && break
+       _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
        loff="$((loff + 1))"
 done
 
        loff="$((loff + 1))"
 done
 
index 09af6499151ec5bf89da7efbe773f7620931e605..679940f1fe3a911e088be4e64ff8a68a35ab76a0 100755 (executable)
@@ -78,7 +78,7 @@ echo "+ check dir"
 __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" leaf
 
 echo "+ corrupt dir"
 __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" leaf
 
 echo "+ corrupt dir"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${leaf_lblk}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+_scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${leaf_lblk}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
 
 echo "+ mount image"
 _scratch_mount
 
 echo "+ mount image"
 _scratch_mount
index 5d1965e3c6f243b675b960da15aa53cba6ab632f..8018a9e6189ae4c4cbf4ece12eb2adaa86fff38d 100755 (executable)
@@ -80,8 +80,8 @@ __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" node
 echo "+ corrupt dir"
 loff=0
 while true; do
 echo "+ corrupt dir"
 loff=0
 while true; do
-       $XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file data block is unmapped' && break
-       $XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+       _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" | grep -q 'file data block is unmapped' && break
+       _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
        loff="$((loff + 1))"
 done
 
        loff="$((loff + 1))"
 done
 
index 516639ad57073a0f9c0356bc3bba601de203207b..27ee4b39f98a5119fb891eee287eb478e077a511 100755 (executable)
@@ -80,8 +80,8 @@ __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" node
 echo "+ corrupt dir"
 loff="${leaf_lblk}"
 while true; do
 echo "+ corrupt dir"
 loff="${leaf_lblk}"
 while true; do
-       $XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file data block is unmapped' && break
-       $XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+       _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" | grep -q 'file data block is unmapped' && break
+       _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
        loff="$((loff + 1))"
 done
 
        loff="$((loff + 1))"
 done
 
index f6a41a8fd6d1012cc90992b69f5549f95818aa41..d5a09bbd32d621b87a265b684101d58408c6ab72 100755 (executable)
@@ -64,7 +64,7 @@ INO=`ls -i $SCRATCH_MNT/512 | awk '{print $1}'`
 _scratch_unmount
 
 # Figure out where that middle inode starts
 _scratch_unmount
 
 # Figure out where that middle inode starts
-BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" $SCRATCH_DEV \
+BYTE=`_scratch_xfs_db -c "convert inode $INO byte" \
        | awk '{print $2}' | sed s/[\(\)]//g`
 
 echo Blat inode clusters
        | awk '{print $2}' | sed s/[\(\)]//g`
 
 echo Blat inode clusters
index aa7561e1d4a53203a9e926a72374f967857c3adc..c237f03255c8ea67ccb252c584b92b47ea83b730 100755 (executable)
@@ -80,8 +80,8 @@ __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" node
 echo "+ corrupt dir"
 loff="${node_lblk}"
 while true; do
 echo "+ corrupt dir"
 loff="${node_lblk}"
 while true; do
-       $XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file data block is unmapped' && break
-       $XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+       _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" | grep -q 'file data block is unmapped' && break
+       _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
        loff="$((loff + 1))"
 done
 
        loff="$((loff + 1))"
 done
 
index 8aa339520b3297e7271b3abb9f0da2b21d805bba..6d6e6fd2e1184a71c81daef667b5c1ba6eee6d82 100755 (executable)
@@ -80,8 +80,8 @@ __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" btree
 echo "+ corrupt dir"
 loff=0
 while true; do
 echo "+ corrupt dir"
 loff=0
 while true; do
-       $XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file data block is unmapped' && break
-       $XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+       _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" | grep -q 'file data block is unmapped' && break
+       _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
        loff="$((loff + 1))"
 done
 
        loff="$((loff + 1))"
 done
 
index 27dafd9702fcd67251f3569c6f87ae589f06e890..f251fb3df53507f90acf843c442824d78a3e1e08 100755 (executable)
@@ -85,7 +85,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 seq "${inode}" "$((inode + 64))" | while read ino; do
 
 echo "+ corrupt image"
 seq "${inode}" "$((inode + 64))" | while read ino; do
-       $XFS_DB_PROG -x -c "inode ${ino}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+       _scratch_xfs_db -x -c "inode ${ino}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full 2>&1
 done
 
 echo "+ mount image"
 done
 
 echo "+ mount image"
index 08a461517090d0c708ba57177cc75e0e650389b3..3deece62d85da55518ac177b34350101da8b5ada 100755 (executable)
@@ -75,7 +75,7 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ corrupt image"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ corrupt image"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "addr u.bmbt.ptrs[1]" -c "addr u3.bmbt.ptrs[1]" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+_scratch_xfs_db -x -c "inode ${inode}" -c "addr u.bmbt.ptrs[1]" -c "addr u3.bmbt.ptrs[1]" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
 
 echo "+ mount image"
 _scratch_mount
 
 echo "+ mount image"
 _scratch_mount
index a746d5ca80438d62103c576a1e294500e5a6544e..e6cd8e77415c4806b13688a72940011dbf8b2e04 100755 (executable)
@@ -74,7 +74,7 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ corrupt image"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ corrupt image"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock 0" -c "stack" -c "blocktrash -x 32 -o 256 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+_scratch_xfs_db -x -c "inode ${inode}" -c "dblock 0" -c "stack" -c "blocktrash -x 32 -o 256 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
 
 echo "+ mount image"
 _scratch_mount
 
 echo "+ mount image"
 _scratch_mount
index 239c2462501af9572ef9f522594a077a14033013..cfea2e6fa59eb98dce4327fec79c52f213580ec0 100755 (executable)
@@ -77,13 +77,13 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ check xattr"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ check xattr"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "bmap" "${SCRATCH_DEV}" >> $seqres.full
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 0" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' && _fail "failed to create a block xattr (data)"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${leaf_lblk}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' || _fail "failed to create a block xattr (leaf)"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${node_lblk}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' || _fail "failed to create a block xattr (free)"
+_scratch_xfs_db -x -c "inode ${inode}" -c "bmap" >> $seqres.full
+_scratch_xfs_db -x -c "inode ${inode}" -c "ablock 0" -c "stack" | grep -q 'file attr block is unmapped' && _fail "failed to create a block xattr (data)"
+_scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${leaf_lblk}" -c "stack" | grep -q 'file attr block is unmapped' || _fail "failed to create a block xattr (leaf)"
+_scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${node_lblk}" -c "stack" | grep -q 'file attr block is unmapped' || _fail "failed to create a block xattr (free)"
 
 echo "+ corrupt xattr"
 
 echo "+ corrupt xattr"
-$XFS_DB_PROG -x -c "inode ${inode}" -c 'ablock 0' -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+_scratch_xfs_db -x -c "inode ${inode}" -c 'ablock 0' -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
 
 echo "+ mount image"
 _scratch_mount
 
 echo "+ mount image"
 _scratch_mount
index cf61e0227a85a6f981c5c7dfe5fb57fea6368f32..3f2f6f00077223a250c0dc063a426b72f3875acc 100755 (executable)
@@ -78,12 +78,12 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ check xattr"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ check xattr"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "bmap" "${SCRATCH_DEV}" >> $seqres.full
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 0" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (index)"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 1" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (data)"
+_scratch_xfs_db -x -c "inode ${inode}" -c "bmap" >> $seqres.full
+_scratch_xfs_db -x -c "inode ${inode}" -c "ablock 0" -c "stack" | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (index)"
+_scratch_xfs_db -x -c "inode ${inode}" -c "ablock 1" -c "stack" | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (data)"
 
 echo "+ corrupt xattr"
 
 echo "+ corrupt xattr"
-$XFS_DB_PROG -x -c "inode ${inode}" -c 'ablock 0' -c "stack" -c "blocktrash -x 32 -o +32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+_scratch_xfs_db -x -c "inode ${inode}" -c 'ablock 0' -c "stack" -c "blocktrash -x 32 -o +32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
 
 echo "+ mount image"
 _scratch_mount
 
 echo "+ mount image"
 _scratch_mount
index ebe84fc83ffbd618bb022679ac32130ba3571cd7..77779e00f16ff73eeb9c508e952a866f6f372fe7 100755 (executable)
@@ -78,15 +78,15 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ check xattr"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ check xattr"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "bmap" "${SCRATCH_DEV}" >> $seqres.full
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 0" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (index)"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 1" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (data)"
+_scratch_xfs_db -x -c "inode ${inode}" -c "bmap" >> $seqres.full
+_scratch_xfs_db -x -c "inode ${inode}" -c "ablock 0" -c "stack" | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (index)"
+_scratch_xfs_db -x -c "inode ${inode}" -c "ablock 1" -c "stack" | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (data)"
 
 echo "+ corrupt xattr"
 loff=1
 while true; do
 
 echo "+ corrupt xattr"
 loff=1
 while true; do
-       $XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' && break
-       $XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+       _scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" | grep -q 'file attr block is unmapped' && break
+       _scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
        loff="$((loff + 1))"
 done
 
        loff="$((loff + 1))"
 done
 
index 48f6a8469a2f4ed9e57d7fc71a6e4d877295a771..1c3d642430fccdb39e4048428a04ab7ee7d8448a 100755 (executable)
@@ -73,9 +73,9 @@ _scratch_xfs_repair -n >> "$seqres.full" 2>&1 || \
 
 echo "+ corrupt image"
 seq 0 $((agcount - 1)) | while read ag; do
 
 echo "+ corrupt image"
 seq 0 $((agcount - 1)) | while read ag; do
-       $XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "addr refcntroot" \
+       _scratch_xfs_db -x -c "agf ${ag}" -c "agf ${ag}" -c "addr refcntroot" \
                -c "stack" -c "blocktrash -x 4096 -y 4096 -z -n 8 -3" \
                -c "stack" -c "blocktrash -x 4096 -y 4096 -z -n 8 -3" \
-               "${SCRATCH_DEV}" >> "$seqres.full" 2>&1
+               >> "$seqres.full" 2>&1
 done
 
 echo "+ mount image"
 done
 
 echo "+ mount image"
index 0487f0e7cb891971b4f4ad0b7f9d9490af523888..01fa4a6e3a9a9745041dc4274a39ccd933a95ae6 100755 (executable)
@@ -60,7 +60,7 @@ _scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
 # (the log is zeroed when cycle == 1).
 for i in 16 32 64 128 256; do
        lsunit=$((i * 1024))
 # (the log is zeroed when cycle == 1).
 for i in 16 32 64 128 256; do
        lsunit=$((i * 1024))
-       $XFS_DB_PROG -x -c "logformat -c 3 -s $lsunit" $SCRATCH_DEV | \
+       _scratch_xfs_db -x -c "logformat -c 3 -s $lsunit" | \
                tee -a $seqres.full
        # don't redirect error output so it causes test failure
        $XFS_LOGPRINT_PROG $SCRATCH_DEV >> $seqres.full
                tee -a $seqres.full
        # don't redirect error output so it causes test failure
        $XFS_LOGPRINT_PROG $SCRATCH_DEV >> $seqres.full
index dec9fc99392a46b764e2c86ee9bfdf26ed7a1fa9..093ef009b7da6759e27010c79540f13ff12f598c 100755 (executable)
@@ -58,7 +58,7 @@ _require_xfs_db_command "logformat"
 _scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
 
 # push the log cycle ahead so we have room to move it backwards later
 _scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
 
 # push the log cycle ahead so we have room to move it backwards later
-$XFS_DB_PROG -x -c "logformat -c 3" $SCRATCH_DEV >> $seqres.full 2>&1
+_scratch_xfs_db -x -c "logformat -c 3" >> $seqres.full 2>&1
 
 # do some work on the fs to update metadata LSNs
 _scratch_mount
 
 # do some work on the fs to update metadata LSNs
 _scratch_mount
@@ -68,13 +68,13 @@ _scratch_unmount
 # Reformat to the current cycle and try to mount. This fails in most cases
 # because the sb LSN is ahead of the current LSN. If it doesn't fail, push the
 # cycle back further and try again.
 # Reformat to the current cycle and try to mount. This fails in most cases
 # because the sb LSN is ahead of the current LSN. If it doesn't fail, push the
 # cycle back further and try again.
-$XFS_DB_PROG -x -c "logformat" $SCRATCH_DEV >> $seqres.full 2>&1
+_scratch_xfs_db -x -c "logformat" >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 if [ $? != 0 ]; then
        echo mount failure detected
 else
        _scratch_unmount
 _scratch_mount >> $seqres.full 2>&1
 if [ $? != 0 ]; then
        echo mount failure detected
 else
        _scratch_unmount
-       $XFS_DB_PROG -x -c "logformat -c 2" $SCRATCH_DEV >> $seqres.full 2>&1
+       _scratch_xfs_db -x -c "logformat -c 2" >> $seqres.full 2>&1
        _scratch_mount >> $seqres.full 2>&1 || echo mount failure detected
 fi
 
        _scratch_mount >> $seqres.full 2>&1 || echo mount failure detected
 fi
 
index 18459cb396e41c3b3adef593e57d3d479edda620..4aeabb232c850dfdd4dd32485491ec191a82b064 100755 (executable)
@@ -67,9 +67,9 @@ _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
 echo "Change reference count"
 _scratch_unmount
 echo "set refcount to -4" >> $seqres.full
 echo "Change reference count"
 _scratch_unmount
 echo "set refcount to -4" >> $seqres.full
-$XFS_DB_PROG -x -c 'agf 0' -c 'addr refcntroot' -c 'write recs[1].refcount 4294967292' $SCRATCH_DEV >> $seqres.full
+_scratch_xfs_db -x -c 'agf 0' -c 'addr refcntroot' -c 'write recs[1].refcount 4294967292' >> $seqres.full
 echo "check refcount after setting to -4" >> $seqres.full
 echo "check refcount after setting to -4" >> $seqres.full
-$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' $SCRATCH_DEV >> $seqres.full
+_scratch_xfs_db -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' >> $seqres.full
 _scratch_mount >> $seqres.full
 
 echo "Reflink the overlinked file"
 _scratch_mount >> $seqres.full
 
 echo "Reflink the overlinked file"
@@ -82,7 +82,7 @@ _cp_reflink $testdir/file1 $testdir/file7 >> $seqres.full
 echo "Check scratch fs"
 _scratch_unmount
 echo "check refcount after reflinking 5 more times" >> $seqres.full
 echo "Check scratch fs"
 _scratch_unmount
 echo "check refcount after reflinking 5 more times" >> $seqres.full
-$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' $SCRATCH_DEV >> $seqres.full
+_scratch_xfs_db -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' >> $seqres.full
 _scratch_mount >> $seqres.full
 
 echo "CoW a couple files"
 _scratch_mount >> $seqres.full
 
 echo "CoW a couple files"
@@ -93,7 +93,7 @@ _pwrite_byte 0x62 0 $blksz $testdir/file7 >> $seqres.full
 echo "Check scratch fs"
 _scratch_unmount
 echo "check refcount after cowing 3 files" >> $seqres.full
 echo "Check scratch fs"
 _scratch_unmount
 echo "check refcount after cowing 3 files" >> $seqres.full
-$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' $SCRATCH_DEV >> $seqres.full
+_scratch_xfs_db -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' >> $seqres.full
 _scratch_mount >> $seqres.full
 
 echo "Remove reflinked files"
 _scratch_mount >> $seqres.full
 
 echo "Remove reflinked files"
@@ -102,7 +102,7 @@ rm -rf $testdir/file*
 echo "Check scratch fs"
 _scratch_unmount
 echo "check refcount after removing all files" >> $seqres.full
 echo "Check scratch fs"
 _scratch_unmount
 echo "check refcount after removing all files" >> $seqres.full
-$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' $SCRATCH_DEV >> $seqres.full
+_scratch_xfs_db -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' >> $seqres.full
 _scratch_xfs_repair -o force_geometry -n >> $seqres.full 2>&1
 res=$?
 if [ $res -eq 0 ]; then
 _scratch_xfs_repair -o force_geometry -n >> $seqres.full 2>&1
 res=$?
 if [ $res -eq 0 ]; then
index 192a8c8225d71f68153b99c59acb44c7dba0b163..4b36ae68348033bc62ff28b70088023d041b7123 100755 (executable)
@@ -98,8 +98,8 @@ _print_inode()
 {
        echo ""
        echo "================================="
 {
        echo ""
        echo "================================="
-       $XFS_DB_PROG -c "version" $SCRATCH_DEV 2>&1 | _filter_version
-       $XFS_DB_PROG -c "inode $inum" -c p $SCRATCH_DEV 2>&1 | _filter_inode
+       _scratch_xfs_db -c "version" 2>&1 | _filter_version
+       _scratch_xfs_db -c "inode $inum" -c p 2>&1 | _filter_inode
        echo "================================="
 }
 
        echo "================================="
 }
 
@@ -136,7 +136,7 @@ _changeto_attr1()
        echo ""
        echo "Try setting attr1 by db"
        echo ""
        echo ""
        echo "Try setting attr1 by db"
        echo ""
-       $XFS_DB_PROG -x -c "version attr1" $SCRATCH_DEV | _filter_version
+       _scratch_xfs_db -x -c "version attr1" | _filter_version
 }
 
 # get standard environment, filters and checks
 }
 
 # get standard environment, filters and checks
@@ -173,7 +173,7 @@ fi
 
 # set inum to root dir ino
 # we'll add in dirents and EAs into the root directory
 
 # set inum to root dir ino
 # we'll add in dirents and EAs into the root directory
-eval `$XFS_DB_PROG -r -c 'sb 0' -c 'p rootino' $SCRATCH_DEV | $SED_PROG 's/ //g'`
+eval `_scratch_xfs_db -r -c 'sb 0' -c 'p rootino' | $SED_PROG 's/ //g'`
 inum=$rootino
 fork_dir=$SCRATCH_MNT
 _print_inode
 inum=$rootino
 fork_dir=$SCRATCH_MNT
 _print_inode
index 836b9244550728ae747a5957f152ddae98637edf..07ef3ae1678e4c3f9ad4b2d69e9b5dd558ddad08 100755 (executable)
@@ -76,7 +76,7 @@ export MKFS_LAZY="-m crc=0 -l lazy-count=1 -i projid32bit=0"
 # Make sure that when we think we are testing with morebits off
 # that we really are.
 _scratch_mkfs -i attr=1 $MKFS_NO_LAZY  >/dev/null 2>&1
 # Make sure that when we think we are testing with morebits off
 # that we really are.
 _scratch_mkfs -i attr=1 $MKFS_NO_LAZY  >/dev/null 2>&1
-$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 >$tmp.db
+_scratch_xfs_db -c version 2>&1 >$tmp.db
 if grep -i morebits $tmp.db
 then
        echo ""
 if grep -i morebits $tmp.db
 then
        echo ""
@@ -91,13 +91,13 @@ echo ""
 echo "attr2 fs"
 echo ""
 _scratch_mkfs -i attr=2 $MKFS_NO_LAZY >/dev/null 2>&1
 echo "attr2 fs"
 echo ""
 _scratch_mkfs -i attr=2 $MKFS_NO_LAZY >/dev/null 2>&1
-$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
+_scratch_xfs_db -r -c version 2>&1 | _filter_version
 echo ""
 echo "noattr2 fs"
 echo ""
 _scratch_mount -o noattr2
 $UMOUNT_PROG $SCRATCH_MNT
 echo ""
 echo "noattr2 fs"
 echo ""
 _scratch_mount -o noattr2
 $UMOUNT_PROG $SCRATCH_MNT
-$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
+_scratch_xfs_db -r -c version 2>&1 | _filter_version
 
 # adding an EA will ensure the ATTR1 flag is turned on
 echo ""
 
 # adding an EA will ensure the ATTR1 flag is turned on
 echo ""
@@ -106,7 +106,7 @@ echo ""
 echo "attr2 fs"
 echo ""
 _scratch_mkfs -i attr=2 $MKFS_NO_LAZY >/dev/null 2>&1
 echo "attr2 fs"
 echo ""
 _scratch_mkfs -i attr=2 $MKFS_NO_LAZY >/dev/null 2>&1
-$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
+_scratch_xfs_db -r -c version 2>&1 | _filter_version
 echo ""
 echo "noattr2 fs"
 echo ""
 echo ""
 echo "noattr2 fs"
 echo ""
@@ -117,7 +117,7 @@ $SETFATTR_PROG -n user.test -v 0xbabe testfile
 $GETFATTR_PROG testfile
 cd $here
 $UMOUNT_PROG $SCRATCH_MNT
 $GETFATTR_PROG testfile
 cd $here
 $UMOUNT_PROG $SCRATCH_MNT
-$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
+_scratch_xfs_db -r -c version 2>&1 | _filter_version
 
 echo ""
 echo "*** 3. test noattr2 mount and lazy sb ***"
 
 echo ""
 echo "*** 3. test noattr2 mount and lazy sb ***"
@@ -126,7 +126,7 @@ echo ""
 echo "attr2 fs"
 echo ""
 _scratch_mkfs -i attr=2 $MKFS_LAZY >/dev/null 2>&1
 echo "attr2 fs"
 echo ""
 _scratch_mkfs -i attr=2 $MKFS_LAZY >/dev/null 2>&1
-$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
+_scratch_xfs_db -r -c version 2>&1 | _filter_version
 echo ""
 echo "noattr2 fs"
 echo ""
 echo ""
 echo "noattr2 fs"
 echo ""
@@ -135,7 +135,7 @@ cd $SCRATCH_MNT
 touch testfile
 cd $here
 $UMOUNT_PROG $SCRATCH_MNT
 touch testfile
 cd $here
 $UMOUNT_PROG $SCRATCH_MNT
-$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
+_scratch_xfs_db -r -c version 2>&1 | _filter_version
 
 # success, all done
 status=0
 
 # success, all done
 status=0
index ef51d226bc831c52c7307b6bee0194e56a79e039..88101f2de8eec6268f28da15d42c82806d4660ca 100755 (executable)
@@ -71,9 +71,9 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || \
 
 echo "+ corrupt image"
 seq 0 $((agcount - 1)) | while read ag; do
 
 echo "+ corrupt image"
 seq 0 $((agcount - 1)) | while read ag; do
-       $XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "addr rmaproot" \
+       _scratch_xfs_db -x -c "agf ${ag}" -c "agf ${ag}" -c "addr rmaproot" \
                -c "stack" -c "blocktrash -x 4096 -y 4096 -z -n 8 -3" \
                -c "stack" -c "blocktrash -x 4096 -y 4096 -z -n 8 -3" \
-               ${SCRATCH_DEV} >> $seqres.full 2>&1
+               >> $seqres.full 2>&1
 done
 
 echo "+ mount image"
 done
 
 echo "+ mount image"
index 766c91e66c16bee71b7a5e810ab534bdb8d0b562..13424bae282a9f3f3b0ab6757a2b162a0f107801 100755 (executable)
@@ -46,10 +46,9 @@ _cleanup()
 
 _print_projid()
 {
 
 _print_projid()
 {
-       $XFS_DB_PROG -r -c "inode $1" \
+       _scratch_xfs_db -r -c "inode $1" \
                -c "print core.projid_lo" \
                -c "print core.projid_lo" \
-               -c "print core.projid_hi" \
-               $SCRATCH_DEV
+               -c "print core.projid_hi"
 }
 
 # real QA test starts here
 }
 
 # real QA test starts here
index bb836a0d4fc904781b0a73125e041adbf7cce7b3..770252670b9fdb6087dbadfbd3b12118c7c59a29 100755 (executable)
@@ -82,7 +82,7 @@ while [ $SIZE -lt 1024 ];do
 # umount and check the number of extents on the inode. Should be 0.
        cd
        _scratch_unmount >/dev/null 2>&1
 # umount and check the number of extents on the inode. Should be 0.
        cd
        _scratch_unmount >/dev/null 2>&1
-       $XFS_DB_PROG  -c "inode $inode" -c "p core.nextents" $SCRATCH_DEV
+       _scratch_xfs_db  -c "inode $inode" -c "p core.nextents"
 
        let SIZE=$SIZE+32
 done
 
        let SIZE=$SIZE+32
 done