public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 06/15] add a long pointers flag to xfs_btree_cur
@ 2008-07-23 20:08 Christoph Hellwig
  2008-07-24 23:29 ` Dave Chinner
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2008-07-23 20:08 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-btree-long-flag --]
[-- Type: text/plain, Size: 2855 bytes --]

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


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6-xfs/fs/xfs/xfs_btree.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_btree.c	2008-07-11 11:12:37.000000000 +0200
+++ linux-2.6-xfs/fs/xfs/xfs_btree.c	2008-07-11 11:13:15.000000000 +0200
@@ -90,7 +90,7 @@ xfs_btree_check_block(
 	int			level,	/* level of the btree block */
 	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,
 			bp);
 	else
@@ -500,7 +500,7 @@ xfs_btree_islastblock(
 
 	block = xfs_btree_get_block(cur, 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;
 	else
 		return be32_to_cpu(block->bb_u.s.bb_rightsib) == NULLAGBLOCK;
@@ -792,7 +792,7 @@ xfs_btree_setbuf(
 	if (!bp)
 		return;
 	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)
 			cur->bc_ra[lev] |= XFS_BTCUR_LEFTRA;
 		if (be64_to_cpu(b->bb_u.l.bb_rightsib) == NULLDFSBNO)
Index: linux-2.6-xfs/fs/xfs/xfs_btree.h
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_btree.h	2008-07-11 11:12:37.000000000 +0200
+++ linux-2.6-xfs/fs/xfs/xfs_btree.h	2008-07-11 11:13:15.000000000 +0200
@@ -121,11 +121,6 @@ union xfs_btree_rec {
 #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.
  */
 extern const __uint32_t	xfs_magics[];
@@ -211,6 +206,7 @@ typedef struct xfs_btree_cur
 } xfs_btree_cur_t;
 
 /* 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 */
 
 
Index: linux-2.6-xfs/fs/xfs/xfs_bmap_btree.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_bmap_btree.c	2008-07-11 11:12:37.000000000 +0200
+++ linux-2.6-xfs/fs/xfs/xfs_bmap_btree.c	2008-07-11 11:13:15.000000000 +0200
@@ -2667,7 +2667,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_flags = XFS_BTREE_LONG_PTRS | XFS_BTREE_ROOT_IN_INODE;
 
 	cur->bc_private.b.forksize = XFS_IFORK_SIZE(ip, whichfork);
 	cur->bc_private.b.ip = ip;

-- 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 06/15] add a long pointers flag to xfs_btree_cur
  2008-07-23 20:08 [PATCH 06/15] add a long pointers flag to xfs_btree_cur Christoph Hellwig
@ 2008-07-24 23:29 ` Dave Chinner
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Chinner @ 2008-07-24 23:29 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Wed, Jul 23, 2008 at 10:08:53PM +0200, Christoph Hellwig wrote:
> Add a flag to the xfs btree cursor when using long (64bit) block pointers
> instead of checking btnum == XFS_BTNUM_BMAP.

Very sane idea ;)

Looks good.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-24 23:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-23 20:08 [PATCH 06/15] add a long pointers flag to xfs_btree_cur Christoph Hellwig
2008-07-24 23:29 ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox