echo "df gave: blocks=$blocks used=$used avail=$avail" >>$seqres.full
echo "blocksize from mkfs is '$dbsize'" >>$seqres.full
-xfs_db -r -c "freesp -s" $SCRATCH_DEV >$tmp.xfs_db
+_scratch_xfs_db -r -c "freesp -s" >$tmp.xfs_db
echo "xfs_db for $SCRATCH_DEV" >>$seqres.full
cat $tmp.xfs_db >>$seqres.full
grep $qino_2 | awk '{print $NF}'`
echo "*** Usage before quotarm ***"
- xfs_db -c "inode $QINO_1" -c "p core.nblocks" $SCRATCH_DEV
- xfs_db -c "inode $QINO_2" -c "p core.nblocks" $SCRATCH_DEV
+ _scratch_xfs_db -c "inode $QINO_1" -c "p core.nblocks"
+ _scratch_xfs_db -c "inode $QINO_2" -c "p core.nblocks"
_qmount
echo "*** turn off $off_opts quotas"
_scratch_unmount
echo "*** Usage after quotarm ***"
- xfs_db -c "inode $QINO_1" -c "p core.nblocks" $SCRATCH_DEV
- xfs_db -c "inode $QINO_2" -c "p core.nblocks" $SCRATCH_DEV
+ _scratch_xfs_db -c "inode $QINO_1" -c "p core.nblocks"
+ _scratch_xfs_db -c "inode $QINO_2" -c "p core.nblocks"
}
echo "*** dump attributes (1)"
-xfs_db -r -c "inode $inum_1" -c "print a.sfattr" $SCRATCH_DEV | \
+_scratch_xfs_db -r -c "inode $inum_1" -c "print a.sfattr" | \
sed -e '/secure = /d' | sed -e '/parent = /d'
echo "*** dump attributes (2)"
# There is a fair bit of filtering here to convert v5 filesystem output
# into the v4 format that holds the meaningful information for the test.
-xfs_db -r -c "inode $inum_2" -c "a a.bmx[0].startblock" -c print $SCRATCH_DEV \
+_scratch_xfs_db -r -c "inode $inum_2" -c "a a.bmx[0].startblock" -c print \
| perl -ne '
s/,secure//;
s/,parent//;
_check_require_logdev
echo "*** set uuid"
-xfs_db -x $SCRATCH_DEV -l $SCRATCH_LOGDEV -c "uuid 02020202-0202-0202-0202-020202020202"
+_scratch_xfs_db -x -l $SCRATCH_LOGDEV -c "uuid 02020202-0202-0202-0202-020202020202"
[ $? -ne 0 ] && _unexpected
_check_mount
_scratch_unmount
# note - does (insitu) conversion from fs blocks to 1K blocks
-xfs_db -rc "dquot -$type $id" -c p $SCRATCH_DEV | tee -a $seqres.full | perl -ne '
+_scratch_xfs_db -rc "dquot -$type $id" -c p | tee -a $seqres.full | perl -ne '
if (/^diskdq.bcount = (\d+)$/) {
print "used_blocks=", $1 * '$dbsize' / 1024, "\n";
}
_scratch_mkfs >/dev/null 2>&1
_scratch_mount "-o uquota"
_scratch_unmount
-xfs_db -r -c sb -c print $SCRATCH_DEV | grep qflags
+_scratch_xfs_db -r -c sb -c print | grep qflags
_scratch_mount
_scratch_unmount
-xfs_db -r -c sb -c print $SCRATCH_DEV | grep qflags
+_scratch_xfs_db -r -c sb -c print | grep qflags
# success, all done
status=0
_print_inode()
{
_scratch_unmount
- xfs_db -r -c "inode $inum" -c "print" $SCRATCH_DEV |\
+ _scratch_xfs_db -r -c "inode $inum" -c "print" |\
awk '
/nextents/ { print; next }
/naextents/ { print; next }
_print_inode_u()
{
_scratch_unmount
- xfs_db -r -c "inode $inum" -c "print u" $SCRATCH_DEV
+ _scratch_xfs_db -r -c "inode $inum" -c "print u"
_scratch_mount
}
_print_inode_a()
{
_scratch_unmount
- xfs_db -r -c "inode $inum" -c "print a" $SCRATCH_DEV
+ _scratch_xfs_db -r -c "inode $inum" -c "print a"
_scratch_mount
}
get_features()
{
- xfs_db -x $SCRATCH_DEV -c "sb" -c "print $1" | awk '// {print $3}'
+ _scratch_xfs_db -x -c "sb" -c "print $1" | awk '// {print $3}'
}
# clear any mkfs options so that we can directly specify the options we need to
# Now clear the normal flags
#
echo "Clearing features2:"
-xfs_db -x $SCRATCH_DEV -c 'sb' -c 'write features2 0'
+_scratch_xfs_db -x -c 'sb' -c 'write features2 0'
_scratch_mount
_scratch_unmount
# Clear the normal flags again for the second rount.
#
echo "Clearing features2:"
-xfs_db -x $SCRATCH_DEV -c 'sb' -c 'write features2 0'
+_scratch_xfs_db -x -c 'sb' -c 'write features2 0'
#
# And print the flags after a mount ro and remount rw
echo "Silence is goodness..."
# Corrupt DIR
-xfs_db -x -c "inode $DIR_INO" -c "write u.sfdir2.list[0].inumber.i4 0" $SCRATCH_DEV >> $seqres.full
-xfs_db -x -c "inode $DIR_INO" -c "write u.sfdir2.list[0].name 0" $SCRATCH_DEV >> $seqres.full
-xfs_db -x -c "inode $DIR_INO" -c "write u.sfdir2.list[0].offset 0" $SCRATCH_DEV >> $seqres.full
-xfs_db -x -c "inode $DIR_INO" -c "write u.sfdir2.list[0].namelen 0" $SCRATCH_DEV >> $seqres.full
-xfs_db -x -c "inode $DIR_INO" -c "write u.sfdir2.hdr.parent.i4 0" $SCRATCH_DEV >> $seqres.full
-xfs_db -x -c "inode $DIR_INO" -c "write core.nlinkv2 0" $SCRATCH_DEV >> $seqres.full
+_scratch_xfs_db -x -c "inode $DIR_INO" -c "write u.sfdir2.list[0].inumber.i4 0" >> $seqres.full
+_scratch_xfs_db -x -c "inode $DIR_INO" -c "write u.sfdir2.list[0].name 0" >> $seqres.full
+_scratch_xfs_db -x -c "inode $DIR_INO" -c "write u.sfdir2.list[0].offset 0" >> $seqres.full
+_scratch_xfs_db -x -c "inode $DIR_INO" -c "write u.sfdir2.list[0].namelen 0" >> $seqres.full
+_scratch_xfs_db -x -c "inode $DIR_INO" -c "write u.sfdir2.hdr.parent.i4 0" >> $seqres.full
+_scratch_xfs_db -x -c "inode $DIR_INO" -c "write core.nlinkv2 0" >> $seqres.full
# Corrupt SUBDIR
-xfs_db -x -c "inode $SUBDIR_INO" -c "write u.sfdir2.hdr.parent.i4 0" $SCRATCH_DEV >> $seqres.full
-xfs_db -x -c "inode $SUBDIR_INO" -c "write core.nlinkv2 0" $SCRATCH_DEV >> $seqres.full
+_scratch_xfs_db -x -c "inode $SUBDIR_INO" -c "write u.sfdir2.hdr.parent.i4 0" >> $seqres.full
+_scratch_xfs_db -x -c "inode $SUBDIR_INO" -c "write core.nlinkv2 0" >> $seqres.full
echo "===== BEGIN of xfs_repair =====" >> $seqres.full
echo "" >>$seqres.full
# Take a look at freespace for any post-mortem on the test
_scratch_unmount
-xfs_db -r -c freesp $SCRATCH_DEV >> $seqres.full 2>&1
+_scratch_xfs_db -r -c freesp >> $seqres.full 2>&1
_scratch_mount
# Step 2: Make a bunch of (hopefully fragmented) multiblock
field="$1"
shift
- xfs_db -c 'agf 1' "$@" -c "p $field" $SCRATCH_DEV | awk '{print $3}'
+ _scratch_xfs_db -c 'agf 1' "$@" -c "p $field" | awk '{print $3}'
}
_set_agf_data() {
value="$2"
shift; shift
- xfs_db -x -c 'agf 1' "$@" -c "write $field -- $value" $SCRATCH_DEV >> $seqres.full
+ _scratch_xfs_db -x -c 'agf 1' "$@" -c "write $field -- $value" >> $seqres.full
}
_get_sb_data() {
field="$1"
shift
- xfs_db -c 'sb 0' "$@" -c "p $field" $SCRATCH_DEV | awk '{print $3}'
+ _scratch_xfs_db -c 'sb 0' "$@" -c "p $field" | awk '{print $3}'
}
_set_sb_data() {
value="$2"
shift; shift
- xfs_db -x -c 'sb 0' "$@" -c "write $field -- $value" $SCRATCH_DEV >> $seqres.full
+ _scratch_xfs_db -x -c 'sb 0' "$@" -c "write $field -- $value" >> $seqres.full
}
_filter_leftover() {
_dump_status() {
echo "** " "$@"
- xfs_db -c 'sb 0' -c p $SCRATCH_DEV
+ _scratch_xfs_db -c 'sb 0' -c p
echo "** agf header"
- xfs_db -c 'agf 1' -c p $SCRATCH_DEV
+ _scratch_xfs_db -c 'agf 1' -c p
echo "** refcntbt"
- xfs_db -c 'agf 1' -c 'addr refcntroot' -c p $SCRATCH_DEV
+ _scratch_xfs_db -c 'agf 1' -c 'addr refcntroot' -c p
echo "** rmapbt"
- test $is_rmap -gt 0 && xfs_db -c 'agf 1' -c 'addr rmaproot' -c p $SCRATCH_DEV
+ test $is_rmap -gt 0 && _scratch_xfs_db -c 'agf 1' -c 'addr rmaproot' -c p
echo "** bnobt"
- xfs_db -c 'agf 1' -c 'addr bnoroot' -c p $SCRATCH_DEV
+ _scratch_xfs_db -c 'agf 1' -c 'addr bnoroot' -c p
echo "** cntbt"
- xfs_db -c 'agf 1' -c 'addr cntroot' -c p $SCRATCH_DEV
+ _scratch_xfs_db -c 'agf 1' -c 'addr cntroot' -c p
}
echo "We need AG1 to have a single free extent"
field="$1"
shift
- xfs_db -c 'agf 1' "$@" -c "p $field" $SCRATCH_DEV | awk '{print $3}'
+ _scratch_xfs_db -c 'agf 1' "$@" -c "p $field" | awk '{print $3}'
}
_set_agf_data() {
value="$2"
shift; shift
- xfs_db -x -c 'agf 1' "$@" -c "write $field -- $value" $SCRATCH_DEV >> $seqres.full
+ _scratch_xfs_db -x -c 'agf 1' "$@" -c "write $field -- $value" >> $seqres.full
}
_get_sb_data() {
field="$1"
shift
- xfs_db -c 'sb 0' "$@" -c "p $field" $SCRATCH_DEV | awk '{print $3}'
+ _scratch_xfs_db -c 'sb 0' "$@" -c "p $field" | awk '{print $3}'
}
_set_sb_data() {
value="$2"
shift; shift
- xfs_db -x -c 'sb 0' "$@" -c "write $field -- $value" $SCRATCH_DEV >> $seqres.full
+ _scratch_xfs_db -x -c 'sb 0' "$@" -c "write $field -- $value" >> $seqres.full
}
_filter_leftover() {
_dump_status() {
echo "** " "$@"
- xfs_db -c 'sb 0' -c p $SCRATCH_DEV
+ _scratch_xfs_db -c 'sb 0' -c p
echo "** agf header"
- xfs_db -c 'agf 1' -c p $SCRATCH_DEV
+ _scratch_xfs_db -c 'agf 1' -c p
echo "** refcntbt"
- xfs_db -c 'agf 1' -c 'addr refcntroot' -c p $SCRATCH_DEV
+ _scratch_xfs_db -c 'agf 1' -c 'addr refcntroot' -c p
echo "** rmapbt"
- test $is_rmap -gt 0 && xfs_db -c 'agf 1' -c 'addr rmaproot' -c p $SCRATCH_DEV
+ test $is_rmap -gt 0 && _scratch_xfs_db -c 'agf 1' -c 'addr rmaproot' -c p
echo "** bnobt"
- xfs_db -c 'agf 1' -c 'addr bnoroot' -c p $SCRATCH_DEV
+ _scratch_xfs_db -c 'agf 1' -c 'addr bnoroot' -c p
echo "** cntbt"
- xfs_db -c 'agf 1' -c 'addr cntroot' -c p $SCRATCH_DEV
+ _scratch_xfs_db -c 'agf 1' -c 'addr cntroot' -c p
}
echo "We need AG1 to have a single free extent"