xfs
[Top] [All Lists]

Re: [PATCH 1/2] xfs_repair: Add inline function to get avl tree node

To: Carlos Maiolino <cmaiolino@xxxxxxxxxx>
Subject: Re: [PATCH 1/2] xfs_repair: Add inline function to get avl tree node
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Tue, 08 Nov 2011 12:56:19 -0600
Cc: xfs@xxxxxxxxxxx
In-reply-to: <1320777990-6556-2-git-send-email-cmaiolino@xxxxxxxxxx>
References: <1320777990-6556-1-git-send-email-cmaiolino@xxxxxxxxxx> <1320777990-6556-2-git-send-email-cmaiolino@xxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1
On 11/8/11 12:46 PM, Carlos Maiolino wrote:
> dd get_inode_offset() inline function, which will return the offset
> of a specific node in the AVL tree avoiding the need to calculate the
> the offset each time it needs to be used.

might be good to find the open-coded instances of this, and
make them use the helper too.

-Eric

> ---
>  repair/incore.h |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/repair/incore.h b/repair/incore.h
> index ee0e86a..8e311c9 100644
> --- a/repair/incore.h
> +++ b/repair/incore.h
> @@ -311,6 +311,12 @@ void             get_inode_rec(struct xfs_mount *mp, 
> xfs_agnumber_t agno,
>                             ino_tree_node_t *ino_rec);
>  
>  extern avltree_desc_t     **inode_tree_ptrs;
> +
> +static inline int
> +get_inode_offset(struct xfs_mount *mp, xfs_ino_t ino, ino_tree_node_t *irec)
> +{
> +     return XFS_INO_TO_AGINO(mp, ino) - irec->ino_startnum;
> +}
>  static inline ino_tree_node_t *
>  findfirst_inode_rec(xfs_agnumber_t agno)
>  {

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