mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[XFS] split up xfs_btree_init_cursor
xfs_btree_init_cursor contains close to little shared code for the different btrees and will get even more non-common code in the future. Split it up into one routine per btree type. Because xfs_btree_dup_cursor needs to call the init routine for a generic btree cursor add a new btree operation vector that contains a dup_cursor method that initializes a new cursor based on an existing one. The btree operations vector is based on an idea and code from Dave Chinner and will grow more entries later during this series. SGI-PV: 985583 SGI-Modid: xfs-linux-melb:xfs-kern:32176a 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:
parent
f2277f06e6
commit
561f7d1739
12 changed files with 196 additions and 158 deletions
|
@ -640,8 +640,8 @@ xfs_alloc_ag_vextent_exact(
|
|||
/*
|
||||
* Allocate/initialize a cursor for the by-number freespace btree.
|
||||
*/
|
||||
bno_cur = xfs_btree_init_cursor(args->mp, args->tp, args->agbp,
|
||||
args->agno, XFS_BTNUM_BNO, NULL, 0);
|
||||
bno_cur = xfs_allocbt_init_cursor(args->mp, args->tp, args->agbp,
|
||||
args->agno, XFS_BTNUM_BNO);
|
||||
/*
|
||||
* Lookup bno and minlen in the btree (minlen is irrelevant, really).
|
||||
* Look for the closest free block <= bno, it must contain bno
|
||||
|
@ -696,8 +696,8 @@ xfs_alloc_ag_vextent_exact(
|
|||
* We are allocating agbno for rlen [agbno .. end]
|
||||
* Allocate/initialize a cursor for the by-size btree.
|
||||
*/
|
||||
cnt_cur = xfs_btree_init_cursor(args->mp, args->tp, args->agbp,
|
||||
args->agno, XFS_BTNUM_CNT, NULL, 0);
|
||||
cnt_cur = xfs_allocbt_init_cursor(args->mp, args->tp, args->agbp,
|
||||
args->agno, XFS_BTNUM_CNT);
|
||||
ASSERT(args->agbno + args->len <=
|
||||
be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_length));
|
||||
if ((error = xfs_alloc_fixup_trees(cnt_cur, bno_cur, fbno, flen,
|
||||
|
@ -759,8 +759,8 @@ xfs_alloc_ag_vextent_near(
|
|||
/*
|
||||
* Get a cursor for the by-size btree.
|
||||
*/
|
||||
cnt_cur = xfs_btree_init_cursor(args->mp, args->tp, args->agbp,
|
||||
args->agno, XFS_BTNUM_CNT, NULL, 0);
|
||||
cnt_cur = xfs_allocbt_init_cursor(args->mp, args->tp, args->agbp,
|
||||
args->agno, XFS_BTNUM_CNT);
|
||||
ltlen = 0;
|
||||
bno_cur_lt = bno_cur_gt = NULL;
|
||||
/*
|
||||
|
@ -886,8 +886,8 @@ xfs_alloc_ag_vextent_near(
|
|||
/*
|
||||
* Set up a cursor for the by-bno tree.
|
||||
*/
|
||||
bno_cur_lt = xfs_btree_init_cursor(args->mp, args->tp,
|
||||
args->agbp, args->agno, XFS_BTNUM_BNO, NULL, 0);
|
||||
bno_cur_lt = xfs_allocbt_init_cursor(args->mp, args->tp,
|
||||
args->agbp, args->agno, XFS_BTNUM_BNO);
|
||||
/*
|
||||
* Fix up the btree entries.
|
||||
*/
|
||||
|
@ -914,8 +914,8 @@ xfs_alloc_ag_vextent_near(
|
|||
/*
|
||||
* Allocate and initialize the cursor for the leftward search.
|
||||
*/
|
||||
bno_cur_lt = xfs_btree_init_cursor(args->mp, args->tp, args->agbp,
|
||||
args->agno, XFS_BTNUM_BNO, NULL, 0);
|
||||
bno_cur_lt = xfs_allocbt_init_cursor(args->mp, args->tp, args->agbp,
|
||||
args->agno, XFS_BTNUM_BNO);
|
||||
/*
|
||||
* Lookup <= bno to find the leftward search's starting point.
|
||||
*/
|
||||
|
@ -1267,8 +1267,8 @@ xfs_alloc_ag_vextent_size(
|
|||
/*
|
||||
* Allocate and initialize a cursor for the by-size btree.
|
||||
*/
|
||||
cnt_cur = xfs_btree_init_cursor(args->mp, args->tp, args->agbp,
|
||||
args->agno, XFS_BTNUM_CNT, NULL, 0);
|
||||
cnt_cur = xfs_allocbt_init_cursor(args->mp, args->tp, args->agbp,
|
||||
args->agno, XFS_BTNUM_CNT);
|
||||
bno_cur = NULL;
|
||||
/*
|
||||
* Look for an entry >= maxlen+alignment-1 blocks.
|
||||
|
@ -1372,8 +1372,8 @@ xfs_alloc_ag_vextent_size(
|
|||
/*
|
||||
* Allocate and initialize a cursor for the by-block tree.
|
||||
*/
|
||||
bno_cur = xfs_btree_init_cursor(args->mp, args->tp, args->agbp,
|
||||
args->agno, XFS_BTNUM_BNO, NULL, 0);
|
||||
bno_cur = xfs_allocbt_init_cursor(args->mp, args->tp, args->agbp,
|
||||
args->agno, XFS_BTNUM_BNO);
|
||||
if ((error = xfs_alloc_fixup_trees(cnt_cur, bno_cur, fbno, flen,
|
||||
rbno, rlen, XFSA_FIXUP_CNT_OK)))
|
||||
goto error0;
|
||||
|
@ -1515,8 +1515,7 @@ xfs_free_ag_extent(
|
|||
/*
|
||||
* Allocate and initialize a cursor for the by-block btree.
|
||||
*/
|
||||
bno_cur = xfs_btree_init_cursor(mp, tp, agbp, agno, XFS_BTNUM_BNO, NULL,
|
||||
0);
|
||||
bno_cur = xfs_allocbt_init_cursor(mp, tp, agbp, agno, XFS_BTNUM_BNO);
|
||||
cnt_cur = NULL;
|
||||
/*
|
||||
* Look for a neighboring block on the left (lower block numbers)
|
||||
|
@ -1575,8 +1574,7 @@ xfs_free_ag_extent(
|
|||
/*
|
||||
* Now allocate and initialize a cursor for the by-size tree.
|
||||
*/
|
||||
cnt_cur = xfs_btree_init_cursor(mp, tp, agbp, agno, XFS_BTNUM_CNT, NULL,
|
||||
0);
|
||||
cnt_cur = xfs_allocbt_init_cursor(mp, tp, agbp, agno, XFS_BTNUM_CNT);
|
||||
/*
|
||||
* Have both left and right contiguous neighbors.
|
||||
* Merge all three into a single free block.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue