[Ocfs2-tools-devel] [PATCH 02/11] inline-data: debugfs.ocfs2 updates

Tao Ma tao.ma at oracle.com
Tue Jul 22 15:52:21 PDT 2008


Add strings for the incompat bit and the dyn_features flags. Debugfs will
print i_dyn_features now on stat of an inode.

For data-in-inode inodes it'll print the non-data contents of id2.i_data
instead of traversing the extent list.

Signed-off-by: Mark Fasheh <mfasheh at suse.com>
Signed-off-by: Tao Ma <tao.ma at oracle.com>
Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
 debugfs.ocfs2/commands.c |    2 +-
 debugfs.ocfs2/dump.c     |   21 +++++++++++++++++++++
 debugfs.ocfs2/utils.c    |    1 +
 3 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/debugfs.ocfs2/commands.c b/debugfs.ocfs2/commands.c
index c8f4278..74dd5e5 100644
--- a/debugfs.ocfs2/commands.c
+++ b/debugfs.ocfs2/commands.c
@@ -998,7 +998,7 @@ static void do_stat (char **args)
 		dump_fast_symlink(out, (char *)inode->id2.i_symlink);
 	else if (inode->i_flags & OCFS2_DEALLOC_FL)
 		dump_truncate_log(out, &(inode->id2.i_dealloc));
-	else
+	else if (!(inode->i_dyn_features & OCFS2_INLINE_DATA_FL))
 		ret = traverse_extents(gbls.fs, &(inode->id2.i_list), out);
 
 	if (ret)
diff --git a/debugfs.ocfs2/dump.c b/debugfs.ocfs2/dump.c
index b998211..8a9ebef 100644
--- a/debugfs.ocfs2/dump.c
+++ b/debugfs.ocfs2/dump.c
@@ -165,6 +165,7 @@ void dump_inode(FILE *out, struct ocfs2_dinode *in)
 	char *str;
 	uint16_t mode;
 	GString *flags = NULL;
+	GString *dyn_features = NULL;
 	char tmp_str[30];
 	time_t tm;
 
@@ -213,6 +214,16 @@ void dump_inode(FILE *out, struct ocfs2_dinode *in)
 	if (in->i_flags & OCFS2_DEALLOC_FL)
 		g_string_append (flags, "Dealloc ");
 
+	dyn_features = g_string_new(NULL);
+	if (in->i_dyn_features & OCFS2_INLINE_DATA_FL)
+		g_string_append(dyn_features, "InlineData ");
+	if (in->i_dyn_features & OCFS2_HAS_XATTR_FL)
+		g_string_append(dyn_features, "HasXattr ");
+	if (in->i_dyn_features & OCFS2_INLINE_XATTR_FL)
+		g_string_append(dyn_features, "InlineXattr ");
+	if (in->i_dyn_features & OCFS2_INDEXED_DIR_FL)
+		g_string_append(dyn_features, "IndexedDir ");
+
 	fprintf(out, "\tInode: %"PRIu64"   Mode: 0%0o   Generation: %u (0x%x)\n",
 		(uint64_t)in->i_blkno, mode, in->i_generation, in->i_generation);
 
@@ -222,6 +233,9 @@ void dump_inode(FILE *out, struct ocfs2_dinode *in)
 	fprintf(out, "\tType: %s   Attr: 0x%x   Flags: %s\n", str, in->i_attr,
 		flags->str);
 
+	fprintf(out, "\tDynamic Features: (0x%x) %s\n", in->i_dyn_features,
+		dyn_features->str);
+
 	pw = getpwuid(in->i_uid);
 	gr = getgrgid(in->i_gid);
 	fprintf(out, "\tUser: %d (%s)   Group: %d (%s)   Size: %"PRIu64"\n",
@@ -267,8 +281,15 @@ void dump_inode(FILE *out, struct ocfs2_dinode *in)
 		fprintf(out, "\n");
 	}
 
+	if (in->i_dyn_features & OCFS2_INLINE_DATA_FL) {
+		fprintf(out, "\tInline Data Max: %u\n",
+			in->id2.i_data.id_count);
+	}
+
 	if (flags)
 		g_string_free (flags, 1);
+	if (dyn_features)
+		g_string_free(dyn_features, 1);
 	return ;
 }
 
diff --git a/debugfs.ocfs2/utils.c b/debugfs.ocfs2/utils.c
index 5eb6e90..1853e7d 100644
--- a/debugfs.ocfs2/utils.c
+++ b/debugfs.ocfs2/utils.c
@@ -53,6 +53,7 @@ void get_incompat_flag(uint32_t flag, GString *str)
 	test_feature(OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK,
 		     "UserspaceClusterStack");
 	test_feature(OCFS2_FEATURE_INCOMPAT_TUNEFS_INPROG, "AbortedTunefs");
+	test_feature(OCFS2_FEATURE_INCOMPAT_INLINE_DATA, "InlineData");
 
         /* test_feature() clears out known flags */
 	if (flag)
-- 
1.5.4.GIT




More information about the Ocfs2-tools-devel mailing list