[Ocfs2-tools-devel] [patch 3/9] Adds some output information in command "stats" for slot remove, take 4

tao.ma at oracle.com tao.ma at oracle.com
Wed Jul 11 02:09:36 PDT 2007


Let debugfs.ocfs2 outputs the incompat flag and tunefs flag for 
aborted slot remove.
===================================================================
--- new.ocfs2-tools.orig/debugfs.ocfs2/dump.c	2007-07-10 16:35:22.000000000 -0400
+++ new.ocfs2-tools/debugfs.ocfs2/dump.c	2007-07-10 16:36:36.000000000 -0400
@@ -39,10 +39,12 @@ void dump_super_block(FILE *out, struct 
 	GString *compat = NULL;
 	GString *incompat = NULL;
 	GString *rocompat = NULL;
+	GString *tunefs_flag = NULL;
 
 	compat = g_string_new(NULL);
 	incompat = g_string_new(NULL);
 	rocompat = g_string_new(NULL);
+	tunefs_flag = g_string_new(NULL);
 
 	fprintf(out, "\tRevision: %u.%u\n", sb->s_major_rev_level, sb->s_minor_rev_level);
 	fprintf(out, "\tMount Count: %u   Max Mount Count: %u\n", sb->s_mnt_count,
@@ -57,12 +59,16 @@ void dump_super_block(FILE *out, struct 
 
 	get_compat_flag(sb->s_feature_compat, compat);
 	get_incompat_flag(sb->s_feature_incompat, incompat);
+	get_tunefs_flag(sb->s_feature_incompat,
+			sb->s_tunefs_flag, tunefs_flag);
 	get_rocompat_flag(sb->s_feature_ro_compat, rocompat);
 
 	fprintf(out, "\tFeature Compat: %u %s\n", sb->s_feature_compat,
 		compat->str);
 	fprintf(out, "\tFeature Incompat: %u %s\n", sb->s_feature_incompat,
 		incompat->str);
+	fprintf(out, "\tTunefs Incomplete: %u %s\n", sb->s_tunefs_flag,
+		tunefs_flag->str);
 	fprintf(out, "\tFeature RO compat: %u %s\n", sb->s_feature_ro_compat,
 		rocompat->str);
 
===================================================================
--- new.ocfs2-tools.orig/debugfs.ocfs2/utils.c	2007-07-10 16:35:22.000000000 -0400
+++ new.ocfs2-tools/debugfs.ocfs2/utils.c	2007-07-10 16:36:36.000000000 -0400
@@ -42,10 +42,15 @@ void get_incompat_flag(uint32_t flag, GS
 	if (flag & OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC)
 		g_string_append(str, "Sparse ");
 
+	if (flag & OCFS2_FEATURE_INCOMPAT_TUNEFS_INPROG) {
+		g_string_append(str, "AbortedTunefs ");
+	}
+
 	if (flag & ~(OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV |
 		     OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG |
 		     OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT |
-		     OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC))
+		     OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC |
+		     OCFS2_FEATURE_INCOMPAT_TUNEFS_INPROG))
 		g_string_append(str, "Unknown ");
 
 	if (!str->len)
@@ -54,6 +59,22 @@ void get_incompat_flag(uint32_t flag, GS
 	return;
 }
 
+void get_tunefs_flag(uint32_t incompat_flag, uint16_t flag, GString *str)
+{
+	if (!(incompat_flag & OCFS2_FEATURE_INCOMPAT_TUNEFS_INPROG)) {
+		g_string_append(str, "None");
+		return;
+	}
+
+	if (flag & OCFS2_TUNEFS_INPROG_REMOVE_SLOT)
+		g_string_append(str, "RemoveSlot ");
+
+	if (flag & ~OCFS2_TUNEFS_INPROG_REMOVE_SLOT)
+		g_string_append(str, "Unknown ");
+
+	return;
+}
+
 void get_compat_flag(uint32_t flag, GString *str)
 {
 	if (flag & OCFS2_FEATURE_COMPAT_BACKUP_SB)
===================================================================
--- new.ocfs2-tools.orig/debugfs.ocfs2/include/utils.h	2007-07-10 16:35:22.000000000 -0400
+++ new.ocfs2-tools/debugfs.ocfs2/include/utils.h	2007-07-10 16:36:36.000000000 -0400
@@ -34,6 +34,7 @@ typedef struct _rdump_opts {
 } rdump_opts;
 
 void get_incompat_flag(uint32_t flag, GString *str);
+void get_tunefs_flag(uint32_t incompat_flag, uint16_t flag, GString *str);
 void get_compat_flag(uint32_t flag, GString *str);
 void get_rocompat_flag(uint32_t flag, GString *str);
 void get_vote_flag (uint32_t flag, GString *str);

-- 



More information about the Ocfs2-tools-devel mailing list