summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_types.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/libxfs/xfs_types.c')
-rw-r--r--fs/xfs/libxfs/xfs_types.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_types.c b/fs/xfs/libxfs/xfs_types.c
index b254fbeaaa50..b2cf57187456 100644
--- a/fs/xfs/libxfs/xfs_types.c
+++ b/fs/xfs/libxfs/xfs_types.c
@@ -46,6 +46,26 @@ xfs_verify_agbno(
}
/*
+ * Verify that an AG extent is fully contained inside the AG and does not point
+ * at static metadata.
+ */
+bool
+xfs_verify_agbext(
+ struct xfs_mount *mp,
+ xfs_agnumber_t agno,
+ xfs_agblock_t agbno,
+ xfs_agblock_t len)
+{
+ if (agbno + len <= agbno)
+ return false;
+
+ if (!xfs_verify_agbno(mp, agno, agbno))
+ return false;
+
+ return xfs_verify_agbno(mp, agno, agbno + len - 1);
+}
+
+/*
* Verify that an FS block number pointer neither points outside the
* filesystem nor points at static AG metadata.
*/