xfs
[Top] [All Lists]

Re: [REVIEW] cleanup - refactor xfs_dir2_leafn_lookup_int()

To: Barry Naujok <bnaujok@xxxxxxx>
Subject: Re: [REVIEW] cleanup - refactor xfs_dir2_leafn_lookup_int()
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Wed, 9 Apr 2008 04:17:36 -0400
Cc: "xfs@xxxxxxxxxxx" <xfs@xxxxxxxxxxx>, xfs-dev <xfs-dev@xxxxxxx>
In-reply-to: <op.t9b29ska3jf8g2@pc-bnaujok.melbourne.sgi.com>
References: <op.t9b29ska3jf8g2@pc-bnaujok.melbourne.sgi.com>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.17 (2007-11-01)
On Wed, Apr 09, 2008 at 06:02:06PM +1000, Barry Naujok wrote:
> +     if (curbp) {
> +             /* For addname, giving back a free block. */

Given the function is only for addname anymore the first half of the
comment doesn't make sense anymore.

> +             if (dep->namelen == args->namelen && memcmp(dep->name,
> +                                     args->name, args->namelen) == 0) {
> +                     args->inumber = be64_to_cpu(dep->inumber);
> +                     *indexp = index;
> +                     state->extravalid = 1;
> +                     state->extrablk.bp = curbp;
>                       state->extrablk.blkno = curdb;
> +                     state->extrablk.index = (int)((char *)dep -
> +                                                     (char *)curbp->data);
>                       state->extrablk.magic = XFS_DIR2_DATA_MAGIC;
> +                     return XFS_ERROR(EEXIST);
>               }
>       }
>       /*
> +      * Didn't find a match.
> +      * If we are holding a buffer, give it back in case our caller
> +      * finds it useful.
> +      */
> +     if (curbp) {
> +             /* Giving back a data block. */
> +             state->extravalid = 1;
> +             state->extrablk.bp = curbp;
> +             state->extrablk.index = -1;
> +             state->extrablk.blkno = curdb;
> +             state->extrablk.magic = XFS_DIR2_DATA_MAGIC;

Might be worth factoring these two out using a goto

Otherwise the patch looks good.


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