]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
repair: helpers for finding in-core inode records w/ free inodes
authorBrian Foster <bfoster@redhat.com>
Mon, 26 May 2014 23:07:06 +0000 (09:07 +1000)
committerDave Chinner <david@fromorbit.com>
Mon, 26 May 2014 23:07:06 +0000 (09:07 +1000)
Add the findfirst_free_inode_rec() and next_free_ino_rec() helpers
to assist scanning the in-core inode records for records with at
least one free inode. These will be used to determine what records
are included in the free inode btree.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/incore.h

index 541988453372a283d15cfcdf66d60fe9f5dc6741..5f8c188aea6d3168e65d75614c232068d9ed6f4d 100644 (file)
@@ -380,6 +380,33 @@ void                       clear_uncertain_ino_cache(xfs_agnumber_t agno);
 #define next_link_rec(ino_node_ptr)    \
                ((ino_tree_node_t *) ((ino_node_ptr)->avl_node.avl_forw))
 
+/*
+ * finobt helpers
+ */
+static inline ino_tree_node_t *
+findfirst_free_inode_rec(xfs_agnumber_t agno)
+{
+       ino_tree_node_t *ino_rec;
+
+       ino_rec = findfirst_inode_rec(agno);
+
+       while (ino_rec && !ino_rec->ir_free)
+               ino_rec = next_ino_rec(ino_rec);
+
+       return ino_rec;
+}
+
+static inline ino_tree_node_t *
+next_free_ino_rec(ino_tree_node_t *ino_rec)
+{
+       ino_rec = next_ino_rec(ino_rec);
+
+       while (ino_rec && !ino_rec->ir_free)
+               ino_rec = next_ino_rec(ino_rec);
+
+       return ino_rec;
+}
+
 /*
  * Has an inode been processed for phase 6 (reference count checking)?
  *