[XFS] implement generic xfs_btree_lookup
From: Dave Chinner <dgc@sgi.com> [hch: split out from bigger patch and minor adaptions] SGI-PV: 985583 SGI-Modid: xfs-linux-melb:xfs-kern:32192a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com> Signed-off-by: Bill O'Donnell <billodo@sgi.com> Signed-off-by: David Chinner <david@fromorbit.com>
This commit is contained in:
committed by
Lachlan McIlroy
parent
8df4da4a0a
commit
fe033cc848
@@ -89,6 +89,54 @@ STATIC int xfs_alloc_ag_vextent_small(xfs_alloc_arg_t *,
|
||||
* Internal functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Lookup the record equal to [bno, len] in the btree given by cur.
|
||||
*/
|
||||
STATIC int /* error */
|
||||
xfs_alloc_lookup_eq(
|
||||
struct xfs_btree_cur *cur, /* btree cursor */
|
||||
xfs_agblock_t bno, /* starting block of extent */
|
||||
xfs_extlen_t len, /* length of extent */
|
||||
int *stat) /* success/failure */
|
||||
{
|
||||
cur->bc_rec.a.ar_startblock = bno;
|
||||
cur->bc_rec.a.ar_blockcount = len;
|
||||
return xfs_btree_lookup(cur, XFS_LOOKUP_EQ, stat);
|
||||
}
|
||||
|
||||
/*
|
||||
* Lookup the first record greater than or equal to [bno, len]
|
||||
* in the btree given by cur.
|
||||
*/
|
||||
STATIC int /* error */
|
||||
xfs_alloc_lookup_ge(
|
||||
struct xfs_btree_cur *cur, /* btree cursor */
|
||||
xfs_agblock_t bno, /* starting block of extent */
|
||||
xfs_extlen_t len, /* length of extent */
|
||||
int *stat) /* success/failure */
|
||||
{
|
||||
cur->bc_rec.a.ar_startblock = bno;
|
||||
cur->bc_rec.a.ar_blockcount = len;
|
||||
return xfs_btree_lookup(cur, XFS_LOOKUP_GE, stat);
|
||||
}
|
||||
|
||||
/*
|
||||
* Lookup the first record less than or equal to [bno, len]
|
||||
* in the btree given by cur.
|
||||
*/
|
||||
STATIC int /* error */
|
||||
xfs_alloc_lookup_le(
|
||||
struct xfs_btree_cur *cur, /* btree cursor */
|
||||
xfs_agblock_t bno, /* starting block of extent */
|
||||
xfs_extlen_t len, /* length of extent */
|
||||
int *stat) /* success/failure */
|
||||
{
|
||||
cur->bc_rec.a.ar_startblock = bno;
|
||||
cur->bc_rec.a.ar_blockcount = len;
|
||||
return xfs_btree_lookup(cur, XFS_LOOKUP_LE, stat);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Compute aligned version of the found extent.
|
||||
* Takes alignment and min length into account.
|
||||
|
||||
Reference in New Issue
Block a user