[Ocfs2-tools-devel] [PATCH 1/1] ocfs2-tools: add testi command support for debugfs.ocfs2

Jeff Liu jeff.liu at oracle.com
Thu Mar 19 01:41:09 PDT 2009


This patch add testi command for debugfs.ocfs2, it used for testing
if the inode filespec is marked as allocated in the inode bitmap.

Signed-off-by: Jeff Liu <jeff.liu at oracle.com>
---
 debugfs.ocfs2/commands.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/debugfs.ocfs2/commands.c b/debugfs.ocfs2/commands.c
index 0dea23f..b78bceb 100644
--- a/debugfs.ocfs2/commands.c
+++ b/debugfs.ocfs2/commands.c
@@ -74,6 +74,7 @@ static void do_icheck (char **args);
 static void do_dlm_locks (char **args);
 static void do_controld(char **args);
 static void do_dirblocks(char **args);
+static void do_testi(char **args);
 
 dbgfs_gbls gbls;
 
@@ -110,6 +111,7 @@ static Command commands[] = {
 	{ "encode",	do_encode_lockres },
 	{ "decode",	do_decode_lockres },
 	{ "dirblocks",	do_dirblocks },
+	{ "testi",	do_testi },
 };
 
 /*
@@ -1769,3 +1771,30 @@ static void do_icheck(char **args)
 
 	return;
 }
+
+/*
+ * do_testi()
+ *
+ */
+static void do_testi(char **args)
+{
+	errcode_t ret = 0;
+	uint64_t blkno;
+	int set;
+
+	if (process_inode_args(args, &blkno) != 0)
+		return ;
+
+	ret = ocfs2_test_inode_allocated(gbls.fs, blkno, &set);
+	if (ret) {
+		com_err(args[0], ret, "while reading inode %"PRIu64"", blkno);
+		return ;
+	}
+
+	if (set)
+		com_err(args[0], ret, "Inode %"PRIu64" is marked in use", blkno);
+	else
+		com_err(args[0], ret, "Inode %"PRIu64" is not in use", blkno);
+
+	return ;
+}
-- 
1.5.4.3




More information about the Ocfs2-tools-devel mailing list