aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-02-26 22:43:18 -0600
committerEric Sandeen <sandeen@redhat.com>2018-02-26 22:43:18 -0600
commit1048d0e209ca4ad387485e6aeed07dd5870b0f36 (patch)
tree141b56d2ca3ca766265db7629185fb943bf26e71
parent556c739daebc238e585aae4b4c20a34760f6b7ae (diff)
downloadxfsprogs-dev-1048d0e209ca4ad387485e6aeed07dd5870b0f36.tar.gz
xfs: add scrub cross-referencing helpers for the refcount btrees
Source kernel commit: 49db55eca5665e32c9d3e67a7d5694bcc6c274de Add a couple of functions to the refcount btrees that will be used to cross-reference metadata against the refcountbt. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
-rw-r--r--libxfs/xfs_refcount.c19
-rw-r--r--libxfs/xfs_refcount.h3
2 files changed, 22 insertions, 0 deletions
diff --git a/libxfs/xfs_refcount.c b/libxfs/xfs_refcount.c
index 2a57f321c2..24e68a1ddb 100644
--- a/libxfs/xfs_refcount.c
+++ b/libxfs/xfs_refcount.c
@@ -1695,3 +1695,22 @@ out_cursor:
xfs_trans_brelse(tp, agbp);
goto out_trans;
}
+
+/* Is there a record covering a given extent? */
+int
+xfs_refcount_has_record(
+ struct xfs_btree_cur *cur,
+ xfs_agblock_t bno,
+ xfs_extlen_t len,
+ bool *exists)
+{
+ union xfs_btree_irec low;
+ union xfs_btree_irec high;
+
+ memset(&low, 0, sizeof(low));
+ low.rc.rc_startblock = bno;
+ memset(&high, 0xFF, sizeof(high));
+ high.rc.rc_startblock = bno + len - 1;
+
+ return xfs_btree_has_record(cur, &low, &high, exists);
+}
diff --git a/libxfs/xfs_refcount.h b/libxfs/xfs_refcount.h
index eafb9d1f3b..2a731ac68f 100644
--- a/libxfs/xfs_refcount.h
+++ b/libxfs/xfs_refcount.h
@@ -83,4 +83,7 @@ static inline xfs_fileoff_t xfs_refcount_max_unmap(int log_res)
return (log_res * 3 / 4) / XFS_REFCOUNT_ITEM_OVERHEAD;
}
+extern int xfs_refcount_has_record(struct xfs_btree_cur *cur,
+ xfs_agblock_t bno, xfs_extlen_t len, bool *exists);
+
#endif /* __XFS_REFCOUNT_H__ */