common/rc: factor out _scratch_xfs_[get|set]_sb_field

It's common to get and set the values of fields in XFS super block,
so factor them out as scratch_xfs_[get|set]_sb_field, reimplement
them based on _scratch_xfs_[get|set]_metadata_field, and update the
related test cases accordingly.

Also move _scratch_xfs_[get|set]_metadata_field from common/fuzzy to
common/xfs.

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Hou Tao
2018-01-11 14:49:33 +08:00
committed by Eryu Guan
parent b237e01b12
commit 20cb5f1199
10 changed files with 64 additions and 72 deletions
+3 -3
View File
@@ -59,9 +59,9 @@ ln $SCRATCH_MNT/f3 $SCRATCH_MNT/f4
_scratch_unmount
echo "Corrupt fs"
rrmapino=$(_scratch_xfs_db -c 'sb 0' -c 'p rrmapino' | awk '{print $3}')
_scratch_xfs_db -x -c 'sb 0' -c 'addr rootino' \
-c "write u3.sfdir3.list[3].inumber.i4 $rrmapino" >> $seqres.full
rrmapino=`_scratch_xfs_get_sb_field rrmapino`
_scratch_xfs_set_metadata_field "u3.sfdir3.list[3].inumber.i4" $rrmapino \
'sb 0' 'addr rootino' >> $seqres.full
_scratch_mount
echo "Check files"