This commit adds helpers to obtain status of reflink and rmapbt features of a filesystem. The status of these features are obtained by invoking $XFS_INFO_PROG program. Signed-off-by: Chandan Babu R <chandanrlinux@xxxxxxxxx> --- common/xfs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/common/xfs b/common/xfs index c5e39427..e9f84b56 100644 --- a/common/xfs +++ b/common/xfs @@ -1099,6 +1099,40 @@ _xfs_mount_agcount() $XFS_INFO_PROG "$1" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g' } +# Get reflink status of a filesystem +_xfs_is_reflink_enabled() +{ + local status + + $XFS_INFO_PROG "$1" | grep -q reflink >> $seqres.full + [[ $? != 0 ]] && return 1 + + status=$($XFS_INFO_PROG "$1" | grep reflink= | \ + sed -e 's/^.*reflink=\([0-1]\).*$/\1/g') + if [[ $status == 1 ]]; then + return 0 + else + return 1 + fi +} + +# Get rmapbt status of a filesystem +_xfs_is_rmapbt_enabled() +{ + local status + + $XFS_INFO_PROG "$1" | grep -q rmapbt >> $seqres.full + [[ $? != 0 ]] && return 1 + + status=$($XFS_INFO_PROG "$1" | grep rmapbt= | \ + sed -e 's/^.*rmapbt=\([0-1]\).*$/\1/g') + if [[ $status == 1 ]]; then + return 0 + else + return 1 + fi +} + # Wipe the superblock of each XFS AGs _try_wipe_scratch_xfs() { -- 2.30.2