xfs
[Top] [All Lists]

Re: [PATCH 24/26] implement generic xfs_btree_getrec

To: Christoph Hellwig <hch@xxxxxx>
Subject: Re: [PATCH 24/26] implement generic xfs_btree_getrec
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Tue, 5 Aug 2008 11:43:06 +1000
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20080804013556.GY8819@xxxxxx>
Mail-followup-to: Christoph Hellwig <hch@xxxxxx>, xfs@xxxxxxxxxxx
References: <20080804013556.GY8819@xxxxxx>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.18 (2008-05-17)
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....

Otherwise it looks good.

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx


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