From be957968f6fade15d0a7a6058ae270141263bd64 Mon Sep 17 00:00:00 2001 From: Ziyang Zhang Date: Mon, 12 Dec 2022 13:56:44 +0800 Subject: common/xfs: Add a helper to export inode core size Some xfs test cases need the number of bytes reserved for only the inode record, excluding the immediate fork areas. Now the value is hard-coded and it is not a good chioce. Add a helper in common/xfs to export the inode core size. Reviewed-by: Allison Henderson Reviewed-by: Darrick J. Wong Signed-off-by: Ziyang Zhang Signed-off-by: Zorro Lang --- common/xfs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'common/xfs') diff --git a/common/xfs b/common/xfs index f466d2c4..04ae121d 100644 --- a/common/xfs +++ b/common/xfs @@ -1495,3 +1495,18 @@ _require_xfsrestore_xflag() $XFSRESTORE_PROG -h 2>&1 | grep -q -e '-x' || \ _notrun 'xfsrestore does not support -x flag.' } + +# Number of bytes reserved for only the inode record, excluding the +# immediate fork areas. +_xfs_get_inode_core_bytes() +{ + local dir="$1" + + if _xfs_has_feature "$dir" crc; then + # v5 filesystems + echo 176 + else + # v4 filesystems + echo 96 + fi +} -- cgit v1.2.3