Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 124791
b: refs/heads/master
c: 8df4da4
h: refs/heads/master
i:
  124789: faa2dc7
  124787: 0e0cc70
  124783: dcf66d0
v: v3
  • Loading branch information
Christoph Hellwig authored and Lachlan McIlroy committed Oct 30, 2008
1 parent 0bf7294 commit f7c0460
Show file tree
Hide file tree
Showing 12 changed files with 138 additions and 293 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 637aa50f461b8ea6b1e8bf9877b0d13d00085043
refs/heads/master: 8df4da4a0a642d3a016028c0d922bcb4d5a4a6d7
12 changes: 6 additions & 6 deletions trunk/fs/xfs/xfs_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ xfs_alloc_ag_vextent_near(
args->minlen, &ltbnoa, &ltlena);
if (ltlena >= args->minlen)
break;
if ((error = xfs_alloc_decrement(bno_cur_lt, 0, &i)))
if ((error = xfs_btree_decrement(bno_cur_lt, 0, &i)))
goto error0;
if (!i) {
xfs_btree_del_cursor(bno_cur_lt,
Expand Down Expand Up @@ -1162,7 +1162,7 @@ xfs_alloc_ag_vextent_near(
/*
* Fell off the left end.
*/
if ((error = xfs_alloc_decrement(
if ((error = xfs_btree_decrement(
bno_cur_lt, 0, &i)))
goto error0;
if (!i) {
Expand Down Expand Up @@ -1321,7 +1321,7 @@ xfs_alloc_ag_vextent_size(
bestflen = flen;
bestfbno = fbno;
for (;;) {
if ((error = xfs_alloc_decrement(cnt_cur, 0, &i)))
if ((error = xfs_btree_decrement(cnt_cur, 0, &i)))
goto error0;
if (i == 0)
break;
Expand Down Expand Up @@ -1416,7 +1416,7 @@ xfs_alloc_ag_vextent_small(
xfs_extlen_t flen;
int i;

if ((error = xfs_alloc_decrement(ccur, 0, &i)))
if ((error = xfs_btree_decrement(ccur, 0, &i)))
goto error0;
if (i) {
if ((error = xfs_alloc_get_rec(ccur, &fbno, &flen, &i)))
Expand Down Expand Up @@ -1607,7 +1607,7 @@ xfs_free_ag_extent(
/*
* Move the by-block cursor back to the left neighbor.
*/
if ((error = xfs_alloc_decrement(bno_cur, 0, &i)))
if ((error = xfs_btree_decrement(bno_cur, 0, &i)))
goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
#ifdef DEBUG
Expand Down Expand Up @@ -1653,7 +1653,7 @@ xfs_free_ag_extent(
* Back up the by-block cursor to the left neighbor, and
* update its length.
*/
if ((error = xfs_alloc_decrement(bno_cur, 0, &i)))
if ((error = xfs_btree_decrement(bno_cur, 0, &i)))
goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
nbno = ltbno;
Expand Down
98 changes: 7 additions & 91 deletions trunk/fs/xfs/xfs_alloc_btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ xfs_alloc_delrec(
xfs_btree_setbuf(cur, level, NULL);
cur->bc_nlevels--;
} else if (level > 0 &&
(error = xfs_alloc_decrement(cur, level, &i)))
(error = xfs_btree_decrement(cur, level, &i)))
return error;
*stat = 1;
return 0;
Expand All @@ -272,7 +272,7 @@ xfs_alloc_delrec(
* the minimum, we're done.
*/
if (numrecs >= XFS_ALLOC_BLOCK_MINRECS(level, cur)) {
if (level > 0 && (error = xfs_alloc_decrement(cur, level, &i)))
if (level > 0 && (error = xfs_btree_decrement(cur, level, &i)))
return error;
*stat = 1;
return 0;
Expand Down Expand Up @@ -336,7 +336,7 @@ xfs_alloc_delrec(
xfs_btree_del_cursor(tcur,
XFS_BTREE_NOERROR);
if (level > 0 &&
(error = xfs_alloc_decrement(cur, level,
(error = xfs_btree_decrement(cur, level,
&i)))
return error;
*stat = 1;
Expand All @@ -352,7 +352,7 @@ xfs_alloc_delrec(
if (lbno != NULLAGBLOCK) {
i = xfs_btree_firstrec(tcur, level);
XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
if ((error = xfs_alloc_decrement(tcur, level, &i)))
if ((error = xfs_btree_decrement(tcur, level, &i)))
goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
}
Expand All @@ -368,7 +368,7 @@ xfs_alloc_delrec(
*/
i = xfs_btree_firstrec(tcur, level);
XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
if ((error = xfs_alloc_decrement(tcur, level, &i)))
if ((error = xfs_btree_decrement(tcur, level, &i)))
goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
xfs_btree_firstrec(tcur, level);
Expand Down Expand Up @@ -468,7 +468,7 @@ xfs_alloc_delrec(
* Just return. This is probably a logic error, but it's not fatal.
*/
else {
if (level > 0 && (error = xfs_alloc_decrement(cur, level, &i)))
if (level > 0 && (error = xfs_btree_decrement(cur, level, &i)))
return error;
*stat = 1;
return 0;
Expand Down Expand Up @@ -1779,90 +1779,6 @@ xfs_alloc_updkey(
* Externally visible routines.
*/

/*
* Decrement cursor by one record at the level.
* For nonzero levels the leaf-ward information is untouched.
*/
int /* error */
xfs_alloc_decrement(
xfs_btree_cur_t *cur, /* btree cursor */
int level, /* level in btree, 0 is leaf */
int *stat) /* success/failure */
{
xfs_alloc_block_t *block; /* btree block */
int error; /* error return value */
int lev; /* btree level */

ASSERT(level < cur->bc_nlevels);
/*
* Read-ahead to the left at this level.
*/
xfs_btree_readahead(cur, level, XFS_BTCUR_LEFTRA);
/*
* Decrement the ptr at this level. If we're still in the block
* then we're done.
*/
if (--cur->bc_ptrs[level] > 0) {
*stat = 1;
return 0;
}
/*
* Get a pointer to the btree block.
*/
block = XFS_BUF_TO_ALLOC_BLOCK(cur->bc_bufs[level]);
#ifdef DEBUG
if ((error = xfs_btree_check_sblock(cur, block, level,
cur->bc_bufs[level])))
return error;
#endif
/*
* If we just went off the left edge of the tree, return failure.
*/
if (be32_to_cpu(block->bb_leftsib) == NULLAGBLOCK) {
*stat = 0;
return 0;
}
/*
* March up the tree decrementing pointers.
* Stop when we don't go off the left edge of a block.
*/
for (lev = level + 1; lev < cur->bc_nlevels; lev++) {
if (--cur->bc_ptrs[lev] > 0)
break;
/*
* Read-ahead the left block, we're going to read it
* in the next loop.
*/
xfs_btree_readahead(cur, lev, XFS_BTCUR_LEFTRA);
}
/*
* If we went off the root then we are seriously confused.
*/
ASSERT(lev < cur->bc_nlevels);
/*
* Now walk back down the tree, fixing up the cursor's buffer
* pointers and key numbers.
*/
for (block = XFS_BUF_TO_ALLOC_BLOCK(cur->bc_bufs[lev]); lev > level; ) {
xfs_agblock_t agbno; /* block number of btree block */
xfs_buf_t *bp; /* buffer pointer for block */

agbno = be32_to_cpu(*XFS_ALLOC_PTR_ADDR(block, cur->bc_ptrs[lev], cur));
if ((error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp,
cur->bc_private.a.agno, agbno, 0, &bp,
XFS_ALLOC_BTREE_REF)))
return error;
lev--;
xfs_btree_setbuf(cur, lev, bp);
block = XFS_BUF_TO_ALLOC_BLOCK(bp);
if ((error = xfs_btree_check_sblock(cur, block, lev, bp)))
return error;
cur->bc_ptrs[lev] = be16_to_cpu(block->bb_numrecs);
}
*stat = 1;
return 0;
}

/*
* Delete the record pointed to by cur.
* The cursor refers to the place where the record was (could be inserted)
Expand All @@ -1889,7 +1805,7 @@ xfs_alloc_delete(
if (i == 0) {
for (level = 1; level < cur->bc_nlevels; level++) {
if (cur->bc_ptrs[level] == 0) {
if ((error = xfs_alloc_decrement(cur, level, &i)))
if ((error = xfs_btree_decrement(cur, level, &i)))
return error;
break;
}
Expand Down
6 changes: 0 additions & 6 deletions trunk/fs/xfs/xfs_alloc_btree.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,6 @@ typedef struct xfs_btree_sblock xfs_alloc_block_t;
#define XFS_ALLOC_PTR_ADDR(bb,i,cur) \
XFS_BTREE_PTR_ADDR(xfs_alloc, bb, i, XFS_ALLOC_BLOCK_MAXRECS(1, cur))

/*
* Decrement cursor by one record at the level.
* For nonzero levels the leaf-ward information is untouched.
*/
extern int xfs_alloc_decrement(struct xfs_btree_cur *cur, int level, int *stat);

/*
* Delete the record pointed to by cur.
* The cursor refers to the place where the record was (could be inserted)
Expand Down
14 changes: 7 additions & 7 deletions trunk/fs/xfs/xfs_bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ xfs_bmap_add_extent_delay_real(
if ((error = xfs_bmbt_delete(cur, &i)))
goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done);
if ((error = xfs_bmbt_decrement(cur, 0, &i)))
if ((error = xfs_btree_decrement(cur, 0, &i)))
goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done);
if ((error = xfs_bmbt_update(cur, LEFT.br_startoff,
Expand Down Expand Up @@ -1381,13 +1381,13 @@ xfs_bmap_add_extent_unwritten_real(
if ((error = xfs_bmbt_delete(cur, &i)))
goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done);
if ((error = xfs_bmbt_decrement(cur, 0, &i)))
if ((error = xfs_btree_decrement(cur, 0, &i)))
goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done);
if ((error = xfs_bmbt_delete(cur, &i)))
goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done);
if ((error = xfs_bmbt_decrement(cur, 0, &i)))
if ((error = xfs_btree_decrement(cur, 0, &i)))
goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done);
if ((error = xfs_bmbt_update(cur, LEFT.br_startoff,
Expand Down Expand Up @@ -1430,7 +1430,7 @@ xfs_bmap_add_extent_unwritten_real(
if ((error = xfs_bmbt_delete(cur, &i)))
goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done);
if ((error = xfs_bmbt_decrement(cur, 0, &i)))
if ((error = xfs_btree_decrement(cur, 0, &i)))
goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done);
if ((error = xfs_bmbt_update(cur, LEFT.br_startoff,
Expand Down Expand Up @@ -1473,7 +1473,7 @@ xfs_bmap_add_extent_unwritten_real(
if ((error = xfs_bmbt_delete(cur, &i)))
goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done);
if ((error = xfs_bmbt_decrement(cur, 0, &i)))
if ((error = xfs_btree_decrement(cur, 0, &i)))
goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done);
if ((error = xfs_bmbt_update(cur, new->br_startoff,
Expand Down Expand Up @@ -1556,7 +1556,7 @@ xfs_bmap_add_extent_unwritten_real(
PREV.br_blockcount - new->br_blockcount,
oldext)))
goto done;
if ((error = xfs_bmbt_decrement(cur, 0, &i)))
if ((error = xfs_btree_decrement(cur, 0, &i)))
goto done;
if (xfs_bmbt_update(cur, LEFT.br_startoff,
LEFT.br_startblock,
Expand Down Expand Up @@ -2108,7 +2108,7 @@ xfs_bmap_add_extent_hole_real(
if ((error = xfs_bmbt_delete(cur, &i)))
goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done);
if ((error = xfs_bmbt_decrement(cur, 0, &i)))
if ((error = xfs_btree_decrement(cur, 0, &i)))
goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done);
if ((error = xfs_bmbt_update(cur, left.br_startoff,
Expand Down
Loading

0 comments on commit f7c0460

Please sign in to comment.