Commit e99ab90d authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Lachlan McIlroy

[XFS] add a long pointers flag to xfs_btree_cur

Add a flag to the xfs btree cursor when using long (64bit) block pointers
instead of checking btnum == XFS_BTNUM_BMAP.

SGI-PV: 985583

SGI-Modid: xfs-linux-melb:xfs-kern:32181a
Signed-off-by: default avatarChristoph Hellwig <hch@infradead.org>
Signed-off-by: default avatarLachlan McIlroy <lachlan@sgi.com>
Signed-off-by: default avatarBill O'Donnell <billodo@sgi.com>
Signed-off-by: default avatarDavid Chinner <david@fromorbit.com>
parent 8186e517
...@@ -2656,7 +2656,7 @@ xfs_bmbt_init_cursor( ...@@ -2656,7 +2656,7 @@ xfs_bmbt_init_cursor(
cur->bc_blocklog = mp->m_sb.sb_blocklog; cur->bc_blocklog = mp->m_sb.sb_blocklog;
cur->bc_ops = &xfs_bmbt_ops; cur->bc_ops = &xfs_bmbt_ops;
cur->bc_flags = XFS_BTREE_ROOT_IN_INODE; cur->bc_flags = XFS_BTREE_LONG_PTRS | XFS_BTREE_ROOT_IN_INODE;
cur->bc_private.b.forksize = XFS_IFORK_SIZE(ip, whichfork); cur->bc_private.b.forksize = XFS_IFORK_SIZE(ip, whichfork);
cur->bc_private.b.ip = ip; cur->bc_private.b.ip = ip;
......
...@@ -90,7 +90,7 @@ xfs_btree_check_block( ...@@ -90,7 +90,7 @@ xfs_btree_check_block(
int level, /* level of the btree block */ int level, /* level of the btree block */
xfs_buf_t *bp) /* buffer containing block, if any */ xfs_buf_t *bp) /* buffer containing block, if any */
{ {
if (XFS_BTREE_LONG_PTRS(cur->bc_btnum)) if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
xfs_btree_check_lblock(cur, (xfs_btree_lblock_t *)block, level, xfs_btree_check_lblock(cur, (xfs_btree_lblock_t *)block, level,
bp); bp);
else else
...@@ -516,7 +516,7 @@ xfs_btree_islastblock( ...@@ -516,7 +516,7 @@ xfs_btree_islastblock(
block = xfs_btree_get_block(cur, level, &bp); block = xfs_btree_get_block(cur, level, &bp);
xfs_btree_check_block(cur, block, level, bp); xfs_btree_check_block(cur, block, level, bp);
if (XFS_BTREE_LONG_PTRS(cur->bc_btnum)) if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
return be64_to_cpu(block->bb_u.l.bb_rightsib) == NULLDFSBNO; return be64_to_cpu(block->bb_u.l.bb_rightsib) == NULLDFSBNO;
else else
return be32_to_cpu(block->bb_u.s.bb_rightsib) == NULLAGBLOCK; return be32_to_cpu(block->bb_u.s.bb_rightsib) == NULLAGBLOCK;
...@@ -808,7 +808,7 @@ xfs_btree_setbuf( ...@@ -808,7 +808,7 @@ xfs_btree_setbuf(
if (!bp) if (!bp)
return; return;
b = XFS_BUF_TO_BLOCK(bp); b = XFS_BUF_TO_BLOCK(bp);
if (XFS_BTREE_LONG_PTRS(cur->bc_btnum)) { if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
if (be64_to_cpu(b->bb_u.l.bb_leftsib) == NULLDFSBNO) if (be64_to_cpu(b->bb_u.l.bb_leftsib) == NULLDFSBNO)
cur->bc_ra[lev] |= XFS_BTCUR_LEFTRA; cur->bc_ra[lev] |= XFS_BTCUR_LEFTRA;
if (be64_to_cpu(b->bb_u.l.bb_rightsib) == NULLDFSBNO) if (be64_to_cpu(b->bb_u.l.bb_rightsib) == NULLDFSBNO)
......
...@@ -115,11 +115,6 @@ union xfs_btree_rec { ...@@ -115,11 +115,6 @@ union xfs_btree_rec {
#define XFS_BB_NUM_BITS 5 #define XFS_BB_NUM_BITS 5
#define XFS_BB_ALL_BITS ((1 << XFS_BB_NUM_BITS) - 1) #define XFS_BB_ALL_BITS ((1 << XFS_BB_NUM_BITS) - 1)
/*
* Boolean to select which form of xfs_btree_block_t.bb_u to use.
*/
#define XFS_BTREE_LONG_PTRS(btnum) ((btnum) == XFS_BTNUM_BMAP)
/* /*
* Magic numbers for btree blocks. * Magic numbers for btree blocks.
*/ */
...@@ -203,6 +198,7 @@ typedef struct xfs_btree_cur ...@@ -203,6 +198,7 @@ typedef struct xfs_btree_cur
} xfs_btree_cur_t; } xfs_btree_cur_t;
/* cursor flags */ /* cursor flags */
#define XFS_BTREE_LONG_PTRS (1<<0) /* pointers are 64bits long */
#define XFS_BTREE_ROOT_IN_INODE (1<<1) /* root may be variable size */ #define XFS_BTREE_ROOT_IN_INODE (1<<1) /* root may be variable size */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment