]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
repair: add inline function to get ino tree node
authorCarlos Maiolino <cmaiolino@redhat.com>
Wed, 9 Nov 2011 16:54:06 +0000 (14:54 -0200)
committerChristoph Hellwig <hch@lst.de>
Thu, 10 Nov 2011 11:09:06 +0000 (11:09 +0000)
Add 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.

Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
repair/incore.h

index ee0e86acd7b61ca760c19884e6e22a971adf7825..8e311c9e40bd38edde17cfd6de1151d6e981eaae 100644 (file)
@@ -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)
 {