xfs
[Top] [All Lists]

[PATCH v3 17/20] xfsprogs/repair: helpers for finding in-core inode reco

To: xfs@xxxxxxxxxxx
Subject: [PATCH v3 17/20] xfsprogs/repair: helpers for finding in-core inode records w/ free inodes
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Thu, 10 Apr 2014 12:11:07 -0400
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1397146270-42993-1-git-send-email-bfoster@xxxxxxxxxx>
References: <1397146270-42993-1-git-send-email-bfoster@xxxxxxxxxx>
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@xxxxxxxxxx>
---
 repair/incore.h | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/repair/incore.h b/repair/incore.h
index 5419884..5f8c188 100644
--- a/repair/incore.h
+++ b/repair/incore.h
@@ -381,6 +381,33 @@ void                       
clear_uncertain_ino_cache(xfs_agnumber_t agno);
                ((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)?
  *
  * add_inode_refchecked() is set on an inode when it gets traversed
-- 
1.8.3.1

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