[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [gfs2-utils PATCH 12/47] fsck.gfs2: Move function to read directory hash table to util.c



This patch moves function get_dir_hash from metawalk.c to util.c.
This was done because a future patch will need access to the function.
---
 gfs2/fsck/metawalk.c | 18 ------------------
 gfs2/fsck/util.c     | 19 +++++++++++++++++++
 gfs2/fsck/util.h     |  1 +
 3 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index e76c35f..5a13c6f 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -639,24 +639,6 @@ out_copy_old_leaf:
 	return 1;
 }
 
-static uint64_t *get_dir_hash(struct gfs2_inode *ip)
-{
-	unsigned hsize = (1 << ip->i_di.di_depth) * sizeof(uint64_t);
-	int ret;
-	uint64_t *tbl = malloc(hsize);
-
-	if (tbl == NULL)
-		return NULL;
-
-	ret = gfs2_readi(ip, tbl, 0, hsize);
-	if (ret != hsize) {
-		free(tbl);
-		return NULL;
-	}
-
-	return tbl;
-}
-
 static int u64cmp(const void *p1, const void *p2)
 {
 	uint64_t a = *(uint64_t *)p1;
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
index 94d532e..5be260c 100644
--- a/gfs2/fsck/util.c
+++ b/gfs2/fsck/util.c
@@ -654,3 +654,22 @@ uint64_t find_free_blk(struct gfs2_sbd *sdp)
 	}
 	return 0;
 }
+
+uint64_t *get_dir_hash(struct gfs2_inode *ip)
+{
+	unsigned hsize = (1 << ip->i_di.di_depth) * sizeof(uint64_t);
+	int ret;
+	uint64_t *tbl = malloc(hsize);
+
+	if (tbl == NULL)
+		return NULL;
+
+	ret = gfs2_readi(ip, tbl, 0, hsize);
+	if (ret != hsize) {
+		free(tbl);
+		return NULL;
+	}
+
+	return tbl;
+}
+
diff --git a/gfs2/fsck/util.h b/gfs2/fsck/util.h
index 1a4811c..7b587d4 100644
--- a/gfs2/fsck/util.h
+++ b/gfs2/fsck/util.h
@@ -185,6 +185,7 @@ extern char generic_interrupt(const char *caller, const char *where,
                        const char *answers);
 extern char gfs2_getch(void);
 extern uint64_t find_free_blk(struct gfs2_sbd *sdp);
+extern uint64_t *get_dir_hash(struct gfs2_inode *ip);
 
 #define stack log_debug("<backtrace> - %s()\n", __func__)
 
-- 
1.7.11.7


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]