]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: add scrub cross-referencing helpers for the refcount btrees
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 27 Feb 2018 04:43:18 +0000 (22:43 -0600)
committerEric Sandeen <sandeen@redhat.com>
Tue, 27 Feb 2018 04:43:18 +0000 (22:43 -0600)
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>
libxfs/xfs_refcount.c
libxfs/xfs_refcount.h

index 2a57f321c2b74bc7360c1b4f8382babbe9cc2051..24e68a1ddbf4303232fe0c7512588648fd282eb9 100644 (file)
@@ -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);
+}
index eafb9d1f3b3748bb9943560bf1e10e4dc2723204..2a731ac68fe4872376cd57e82e75e8ff4933a5b6 100644 (file)
@@ -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__ */