xfs
[Top] [All Lists]

Re: xfs_db: bug in bmap command?

To: Peter Watkins <treestem@xxxxxxxxx>
Subject: Re: xfs_db: bug in bmap command?
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Fri, 3 Aug 2012 12:37:11 +1000
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20120802233025.GP2877@dastard>
References: <CAH4wwdGbecJ42ONkk3WQRhqUuLUALaSHP-+Ran0Lu8aofW5M8A@xxxxxxxxxxxxxx> <20120802233025.GP2877@dastard>
User-agent: Mutt/1.5.21 (2010-09-15)
On Fri, Aug 03, 2012 at 09:30:25AM +1000, Dave Chinner wrote:
> > diff --git a/db/bmap.c b/db/bmap.c
> > index ddad49c..0ef7a62 100644
> > --- a/db/bmap.c
> > +++ b/db/bmap.c
> > @@ -101,9 +101,9 @@ bmap(
> >                     block = (struct xfs_btree_block *)iocur_top->data;
> >                     if (be16_to_cpu(block->bb_level) == 0)
> >                             break;
> > -                   pp = XFS_BMDR_PTR_ADDR(block, 1,
> > +                   pp = XFS_BMBT_PTR_ADDR(mp, block, 1,
> >                             xfs_bmbt_maxrecs(mp, mp->m_sb.sb_blocksize, 0));
> > -                   kp = XFS_BMDR_KEY_ADDR(block, 1);
> > +                   kp = XFS_BMBT_KEY_ADDR(mp, block, 1);
> 
> That, I'm pretty sure, is wrong, too, because the root block is a
> different format to the tree blocks. IOWs,the old code parses
> tree node blocks with the root block format macro, while your code
> parses the root node with tree block format macros. Both are wrong.
> The original was also wrong in that it used xfs_bmbt_maxrecs()
> instead of xfs_bmdr_maxrecs() for the number of records in the inode
> root block.

Ignore this, I misread the code in bmap(). the root block is already
dealt with before entering the first loop, so it will never come
across the root block and so have to handle it. My mistake, the
patch as is should work just fine.

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>