Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 124782
b: refs/heads/master
c: 8186e51
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Hellwig authored and Lachlan McIlroy committed Oct 30, 2008
1 parent 6f5cf7f commit 14da98d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 21 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: de227dd9604934d2a6d33cd332d1be431719c93e
refs/heads/master: 8186e517fab1854554c48955cdbcbb6710e7baef
1 change: 1 addition & 0 deletions trunk/fs/xfs/xfs_bmap_btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -2656,6 +2656,7 @@ xfs_bmbt_init_cursor(
cur->bc_blocklog = mp->m_sb.sb_blocklog;

cur->bc_ops = &xfs_bmbt_ops;
cur->bc_flags = XFS_BTREE_ROOT_IN_INODE;

cur->bc_private.b.forksize = XFS_IFORK_SIZE(ip, whichfork);
cur->bc_private.b.ip = ip;
Expand Down
47 changes: 27 additions & 20 deletions trunk/fs/xfs/xfs_btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,33 +421,40 @@ xfs_btree_dup_cursor(
return 0;
}

/*
* Get a the root block which is stored in the inode.
*
* For now this btree implementation assumes the btree root is always
* stored in the if_broot field of an inode fork.
*/
STATIC struct xfs_btree_block *
xfs_btree_get_iroot(
struct xfs_btree_cur *cur)
{
struct xfs_ifork *ifp;

ifp = XFS_IFORK_PTR(cur->bc_private.b.ip, cur->bc_private.b.whichfork);
return (struct xfs_btree_block *)ifp->if_broot;
}

/*
* Retrieve the block pointer from the cursor at the given level.
* This may be a bmap btree root or from a buffer.
* This may be an inode btree root or from a buffer.
*/
STATIC xfs_btree_block_t * /* generic btree block pointer */
STATIC struct xfs_btree_block * /* generic btree block pointer */
xfs_btree_get_block(
xfs_btree_cur_t *cur, /* btree cursor */
struct xfs_btree_cur *cur, /* btree cursor */
int level, /* level in btree */
xfs_buf_t **bpp) /* buffer containing the block */
struct xfs_buf **bpp) /* buffer containing the block */
{
xfs_btree_block_t *block; /* return value */
xfs_buf_t *bp; /* return buffer */
xfs_ifork_t *ifp; /* inode fork pointer */
int whichfork; /* data or attr fork */

if (cur->bc_btnum == XFS_BTNUM_BMAP && level == cur->bc_nlevels - 1) {
whichfork = cur->bc_private.b.whichfork;
ifp = XFS_IFORK_PTR(cur->bc_private.b.ip, whichfork);
block = (xfs_btree_block_t *)ifp->if_broot;
bp = NULL;
} else {
bp = cur->bc_bufs[level];
block = XFS_BUF_TO_BLOCK(bp);
if ((cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) &&
(level == cur->bc_nlevels - 1)) {
*bpp = NULL;
return xfs_btree_get_iroot(cur);
}
ASSERT(block != NULL);
*bpp = bp;
return block;

*bpp = cur->bc_bufs[level];
return XFS_BUF_TO_BLOCK(*bpp);
}

/*
Expand Down
5 changes: 5 additions & 0 deletions trunk/fs/xfs/xfs_btree.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ typedef struct xfs_btree_cur
struct xfs_trans *bc_tp; /* transaction we're in, if any */
struct xfs_mount *bc_mp; /* file system mount struct */
const struct xfs_btree_ops *bc_ops;
uint bc_flags; /* btree features - below */
union {
xfs_alloc_rec_incore_t a;
xfs_bmbt_irec_t b;
Expand Down Expand Up @@ -201,6 +202,10 @@ typedef struct xfs_btree_cur
} bc_private; /* per-btree type data */
} xfs_btree_cur_t;

/* cursor flags */
#define XFS_BTREE_ROOT_IN_INODE (1<<1) /* root may be variable size */


#define XFS_BTREE_NOERROR 0
#define XFS_BTREE_ERROR 1

Expand Down

0 comments on commit 14da98d

Please sign in to comment.