xfs
[Top] [All Lists]

Re: [PATCH 24/26] implement generic xfs_btree_getrec

To: Christoph Hellwig <hch@xxxxxx>, xfs@xxxxxxxxxxx
Subject: Re: [PATCH 24/26] implement generic xfs_btree_getrec
From: Christoph Hellwig <hch@xxxxxx>
Date: Tue, 5 Aug 2008 03:47:13 +0200
In-reply-to: <20080805014306.GO6119@disturbed>
References: <20080804013556.GY8819@xxxxxx> <20080805014306.GO6119@disturbed>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.3.28i
On Tue, Aug 05, 2008 at 11:43:06AM +1000, Dave Chinner wrote:
> On Mon, Aug 04, 2008 at 03:35:56AM +0200, Christoph Hellwig wrote:
> > Not really much reason to make it generic given that it's so small,
> > but this is the last non-method in xfs_alloc_btree.c and xfs_ialloc_btree.c,
> > so it makes the whole btree implementation more structured.
> ....
> > +int                                        /* error */
> > +xfs_btree_getrec(
> > +   struct xfs_btree_cur    *cur,   /* btree cursor */
> > +   union xfs_btree_rec     **recp, /* output: btree record */
> > +   int                     *stat)  /* output: success/failure */
> > +{
> > +   struct xfs_btree_block  *block; /* btree block */
> > +   int                     ptr;    /* record number */
> > +#ifdef DEBUG
> > +   int                     error;  /* error return value */
> > +#endif
> > +
> > +   ptr = cur->bc_ptrs[0];
> > +   block = XFS_BUF_TO_BLOCK(cur->bc_bufs[0]);
> 
> Would it make more sense to use:
> 
>       block = xfs_btree_get_block(cur, 0, &bp);
> 
> > +
> > +#ifdef DEBUG
> > +   error = xfs_btree_check_block(cur, block, 0, cur->bc_bufs[0]);
> 
> and then pass bp here? I'd rather use the helpers to do this than
> open code it like everything else does....

Thanks, updated.


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