xfs
[Top] [All Lists]

Re: [PATCH 19/25] xfs: add xfs_da_node verification

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 19/25] xfs: add xfs_da_node verification
From: Phil White <pwhite@xxxxxxx>
Date: Tue, 30 Oct 2012 06:30:26 -0700
Cc: xfs@xxxxxxxxxxx
In-reply-to: <1351146854-19343-20-git-send-email-david@xxxxxxxxxxxxx>
References: <1351146854-19343-1-git-send-email-david@xxxxxxxxxxxxx> <1351146854-19343-20-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, Oct 25, 2012 at 05:34:08PM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
> ---
>  fs/xfs/xfs_attr.c      |   22 ++++------
>  fs/xfs/xfs_attr_leaf.c |   12 +++---
>  fs/xfs/xfs_attr_leaf.h |    8 ++--
>  fs/xfs/xfs_da_btree.c  |  108 
> ++++++++++++++++++++++++++++++++++++------------
>  fs/xfs/xfs_da_btree.h  |    3 ++
>  fs/xfs/xfs_dir2_leaf.c |    2 +-
>  fs/xfs/xfs_dir2_priv.h |    1 +
>  7 files changed, 106 insertions(+), 50 deletions(-)

Reviewed-by: Phil White <pwhite@xxxxxxx>

One minor comment:

> diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
> index a46035b..e950192 100644
> --- a/fs/xfs/xfs_da_btree.c
> +++ b/fs/xfs/xfs_da_btree.c
> @@ -91,6 +91,67 @@ STATIC int xfs_da_blk_unlink(xfs_da_state_t *state,
>                                 xfs_da_state_blk_t *save_blk);
>  STATIC void  xfs_da_state_kill_altpath(xfs_da_state_t *state);
>  
> +static void
> +__xfs_da_node_verify(
> +     struct xfs_buf          *bp)
> +{
> +     struct xfs_mount        *mp = bp->b_target->bt_mount;
> +     struct xfs_da_node_hdr *hdr = bp->b_addr;
> +     int                     block_ok = 0;
> +
> +     block_ok = hdr->info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC);
> +     block_ok |= hdr->level > 0;
> +     block_ok |= hdr->count > 0;

This particular assignment seemed a little inconsistent, compared to
other usages.  Functionally, it's fine though.

-Phil

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