|
|
@@ -167,7 +167,7 @@ xfs_alloc_lookup_ge(
|
|
|
* Lookup the first record less than or equal to [bno, len]
|
|
|
* in the btree given by cur.
|
|
|
*/
|
|
|
-static int /* error */
|
|
|
+int /* error */
|
|
|
xfs_alloc_lookup_le(
|
|
|
struct xfs_btree_cur *cur, /* btree cursor */
|
|
|
xfs_agblock_t bno, /* starting block of extent */
|
|
|
@@ -2996,3 +2996,22 @@ xfs_verify_fsbno(
|
|
|
return false;
|
|
|
return xfs_verify_agbno(mp, agno, XFS_FSB_TO_AGBNO(mp, fsbno));
|
|
|
}
|
|
|
+
|
|
|
+/* Is there a record covering a given extent? */
|
|
|
+int
|
|
|
+xfs_alloc_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.a.ar_startblock = bno;
|
|
|
+ memset(&high, 0xFF, sizeof(high));
|
|
|
+ high.a.ar_startblock = bno + len - 1;
|
|
|
+
|
|
|
+ return xfs_btree_has_record(cur, &low, &high, exists);
|
|
|
+}
|