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
+2 -9
View File
@@ -71,18 +71,11 @@ _set_agf_data() {
}
_get_sb_data() {
field="$1"
shift
_scratch_xfs_db -c 'sb 0' "$@" -c "p $field" | awk '{print $3}'
_scratch_xfs_get_sb_field "$@"
}
_set_sb_data() {
field="$1"
value="$2"
shift; shift
_scratch_xfs_db -x -c 'sb 0' "$@" -c "write $field -- $value" >> $seqres.full
_scratch_xfs_set_sb_field "$@" >> $seqres.full
}
_filter_leftover() {