xfs
[Top] [All Lists]

Re: [PATCH 21/27] xfs: cleanup struct xfs_dir2_leaf

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 21/27] xfs: cleanup struct xfs_dir2_leaf
From: Alex Elder <aelder@xxxxxxx>
Date: Tue, 5 Jul 2011 22:44:33 -0500
Cc: <xfs@xxxxxxxxxxx>
In-reply-to: <20110701094606.567693269@xxxxxxxxxxxxxxxxxxxxxx>
References: <20110701094321.936534538@xxxxxxxxxxxxxxxxxxxxxx> <20110701094606.567693269@xxxxxxxxxxxxxxxxxxxxxx>
Reply-to: <aelder@xxxxxxx>
On Fri, 2011-07-01 at 05:43 -0400, Christoph Hellwig wrote:
> Simplify the confusing xfs_dir2_leaf structure.  It is supposed to describe
> an XFS dir2 leaf format btree block, but due to the variable sized nature
> of almost all elements in it it can't actuall do anything close to that
> job.   Remove the members that are after the first variable sized array,
> given that they could only be used for sizeof expressions that can as well
> just use the underlying types directly, and make the ents array a real
> C99 variable sized array.
> 
> Also factor out the xfs_dir2_leaf_size, to make the sizing of a leaf
> entry which already was convoluted somewhat readable after using the
> longer type names in the sizeof expressions.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

One comment below, otherwise looks good.

Reviewed-by: Alex Elder <aelder@xxxxxxx>

. . .

> Index: xfs/fs/xfs/xfs_dir2_leaf.h
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_dir2_leaf.h   2011-06-30 09:18:07.263416117 +0200
> +++ xfs/fs/xfs/xfs_dir2_leaf.h        2011-06-30 09:38:44.723400763 +0200
> @@ -72,10 +72,7 @@ typedef struct xfs_dir2_leaf_tail {
>   */

A comment explaining the implied/variable-offset
fields is needed here.

>  typedef struct xfs_dir2_leaf {
>       xfs_dir2_leaf_hdr_t     hdr;            /* leaf header */
> -     xfs_dir2_leaf_entry_t   ents[1];        /* entries */
> -                                             /* ... */
> -     xfs_dir2_data_off_t     bests[1];       /* best free counts */
> -     xfs_dir2_leaf_tail_t    tail;           /* leaf tail */
> +     xfs_dir2_leaf_entry_t   ents[]; /* entries */
>  } xfs_dir2_leaf_t;
>  
>  /*
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs



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