[Ocfs2-tools-devel] [PATCH 6/9] mkfs.ocfs2: Add FEATURE_COMPAT_JBD2_SB.

Joel Becker joel.becker at oracle.com
Tue Sep 9 17:57:13 PDT 2008


All filesystems that support FEATURE_COMPAT_JBD2_SB can handle journal
superblock features.  We use this feature to prevent older fsck/tunefs
from loading journal features they don't understand (since they never
checked).  The code at this point will check for unknown features, and
it doesn't know any.  Thus it can safely fsck/tune JBD2_SB filesystems
it creates.

Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
 include/ocfs2-kernel/ocfs2_fs.h |    8 +++++++-
 libocfs2/feature_string.c       |   10 +++++++---
 mkfs.ocfs2/mkfs.c               |    2 +-
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/include/ocfs2-kernel/ocfs2_fs.h b/include/ocfs2-kernel/ocfs2_fs.h
index 6b5f639..e454099 100644
--- a/include/ocfs2-kernel/ocfs2_fs.h
+++ b/include/ocfs2-kernel/ocfs2_fs.h
@@ -85,7 +85,8 @@
 #define OCFS2_CLEAR_INCOMPAT_FEATURE(sb,mask)			\
 	OCFS2_SB(sb)->s_feature_incompat &= ~(mask)
 
-#define OCFS2_FEATURE_COMPAT_SUPP	OCFS2_FEATURE_COMPAT_BACKUP_SB
+#define OCFS2_FEATURE_COMPAT_SUPP	(OCFS2_FEATURE_COMPAT_BACKUP_SB \
+					 | OCFS2_FEATURE_COMPAT_JBD2_SB)
 #define OCFS2_FEATURE_INCOMPAT_SUPP	(OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT \
 					 | OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC \
 					 | OCFS2_FEATURE_INCOMPAT_INLINE_DATA \
@@ -149,6 +150,11 @@
 #define OCFS2_FEATURE_COMPAT_BACKUP_SB		0x0001
 
 /*
+ * The filesystem will correctly handle journal feature bits.
+ */
+#define OCFS2_FEATURE_COMPAT_JBD2_SB		0x0002
+
+/*
  * Unwritten extents support.
  */
 #define OCFS2_FEATURE_RO_COMPAT_UNWRITTEN	0x0001
diff --git a/libocfs2/feature_string.c b/libocfs2/feature_string.c
index 5f1b566..7b1f93e 100644
--- a/libocfs2/feature_string.c
+++ b/libocfs2/feature_string.c
@@ -61,15 +61,15 @@ static struct feature_level_translation ocfs2_feature_levels_table[] = {
 };
 
 static ocfs2_fs_options feature_level_defaults[] = {
-	{OCFS2_FEATURE_COMPAT_BACKUP_SB,
+	{OCFS2_FEATURE_COMPAT_BACKUP_SB | OCFS2_FEATURE_COMPAT_JBD2_SB,
 	 OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC,
 	 OCFS2_FEATURE_RO_COMPAT_UNWRITTEN},  /* OCFS2_FEATURE_LEVEL_DEFAULT */
 
-	{OCFS2_FEATURE_COMPAT_BACKUP_SB,
+	{OCFS2_FEATURE_COMPAT_BACKUP_SB | OCFS2_FEATURE_COMPAT_JBD2_SB,
 	 0,
 	 0}, /* OCFS2_FEATURE_LEVEL_MAX_COMPAT */
 
-	{OCFS2_FEATURE_COMPAT_BACKUP_SB,
+	{OCFS2_FEATURE_COMPAT_BACKUP_SB | OCFS2_FEATURE_COMPAT_JBD2_SB,
 	 OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC |
 	 OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP |
 	 OCFS2_FEATURE_INCOMPAT_INLINE_DATA,
@@ -165,6 +165,10 @@ static struct feature_name ocfs2_feature_names[] = {
 		.fn_flag = {0, OCFS2_FEATURE_INCOMPAT_INLINE_DATA, 0},
 	},
 	{
+		.fn_name = "JBD2SuperBlock",
+		.fn_flag = {OCFS2_FEATURE_COMPAT_JBD2_SB, 0, 0},
+	},
+	{
 		.fn_name = NULL,
 	},
 };
diff --git a/mkfs.ocfs2/mkfs.c b/mkfs.ocfs2/mkfs.c
index 77f6209..2cded13 100644
--- a/mkfs.ocfs2/mkfs.c
+++ b/mkfs.ocfs2/mkfs.c
@@ -1875,7 +1875,7 @@ format_superblock(State *s, SystemFileDiskRecord *rec,
 	if (s->hb_dev) {
 		s->feature_flags.opt_incompat =
 				 	OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV;
-		s->feature_flags.opt_compat = 0;
+		s->feature_flags.opt_compat = OCFS2_FEATURE_COMPAT_JBD2_SB;
 		s->feature_flags.opt_ro_compat = 0;
 	}
 
-- 
1.5.6.3




More information about the Ocfs2-tools-devel mailing list