[Ocfs2-commits] jlbec commits r1156 - trunk/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Sun Jun 20 04:35:22 CDT 2004
Author: jlbec
Date: 2004-06-20 03:35:20 -0500 (Sun, 20 Jun 2004)
New Revision: 1156
Modified:
trunk/src/ocfs.h
trunk/src/ocfs2_fs.h
trunk/src/super.c
Log:
o Add feature checks.
Modified: trunk/src/ocfs.h
===================================================================
--- trunk/src/ocfs.h 2004-06-19 01:23:25 UTC (rev 1155)
+++ trunk/src/ocfs.h 2004-06-20 08:35:20 UTC (rev 1156)
@@ -314,6 +314,7 @@
#endif
#define OCFS_SB(sb) ((ocfs_super *)OCFS_GENERIC_SB_MEMBER(sb))
+#define OCFS2_SB(sb) ((ocfs_super *)OCFS_GENERIC_SB_MEMBER(sb))
#define DLOCK_FLAG_OPEN_MAP (0x1)
@@ -591,6 +592,9 @@
u8 *uuid;
u8 *vol_label;
+ u32 s_feature_compat;
+ u32 s_feature_incompat;
+ u32 s_feature_ro_compat;
ocfs_vol_node_map *vol_node_map;
struct semaphore cfg_lock;
Modified: trunk/src/ocfs2_fs.h
===================================================================
--- trunk/src/ocfs2_fs.h 2004-06-19 01:23:25 UTC (rev 1155)
+++ trunk/src/ocfs2_fs.h 2004-06-20 08:35:20 UTC (rev 1156)
@@ -56,6 +56,31 @@
#define OCFS2_FILE_ENTRY_SIGNATURE "INODE01"
#define OCFS2_EXTENT_BLOCK_SIGNATURE "EXBLK01"
+/* Compatibility flags */
+#define OCFS2_HAS_COMPAT_FEATURE(sb,mask) \
+ ( OCFS2_SB(sb)->s_feature_compat & (mask) )
+#define OCFS2_HAS_RO_COMPAT_FEATURE(sb,mask) \
+ ( OCFS2_SB(sb)->s_feature_ro_compat & (mask) )
+#define OCFS2_HAS_INCOMPAT_FEATURE(sb,mask) \
+ ( OCFS2_SB(sb)->s_feature_incompat & (mask) )
+#define OCFS2_SET_COMPAT_FEATURE(sb,mask) \
+ OCFS2_SB(sb)->s_feature_compat |= (mask)
+#define OCFS2_SET_RO_COMPAT_FEATURE(sb,mask) \
+ OCFS2_SB(sb)->s_feature_ro_compat |= (mask)
+#define OCFS2_SET_INCOMPAT_FEATURE(sb,mask) \
+ OCFS2_SB(sb)->s_feature_incompat |= (mask)
+#define OCFS2_CLEAR_COMPAT_FEATURE(sb,mask) \
+ OCFS2_SB(sb)->s_feature_compat &= ~(mask)
+#define OCFS2_CLEAR_RO_COMPAT_FEATURE(sb,mask) \
+ OCFS2_SB(sb)->s_feature_ro_compat &= ~(mask)
+#define OCFS2_CLEAR_INCOMPAT_FEATURE(sb,mask) \
+ OCFS2_SB(sb)->s_feature_incompat &= ~(mask)
+
+#define OCFS2_FEATURE_COMPAT_SUPP 0
+#define OCFS2_FEATURE_INCOMPAT_SUPP 0
+#define OCFS2_FEATURE_RO_COMPAT_SUPP 0
+
+
/*
* Flags on ocfs2_dinode.i_flags
*/
Modified: trunk/src/super.c
===================================================================
--- trunk/src/super.c 2004-06-19 01:23:25 UTC (rev 1155)
+++ trunk/src/super.c 2004-06-20 08:35:20 UTC (rev 1156)
@@ -1394,6 +1394,26 @@
osb->max_nodes = le32_to_cpu(di->id2.i_super.s_max_nodes);
printk("max_nodes for this device: %u\n", osb->max_nodes);
+ osb->s_feature_compat =
+ le32_to_cpu(OCFS2_RAW_SB(di)->s_feature_compat);
+ osb->s_feature_ro_compat =
+ le32_to_cpu(OCFS2_RAW_SB(di)->s_feature_ro_compat);
+ osb->s_feature_incompat =
+ le32_to_cpu(OCFS2_RAW_SB(di)->s_feature_incompat);
+
+ if ((i = OCFS2_HAS_INCOMPAT_FEATURE(osb->sb, ~OCFS2_FEATURE_INCOMPAT_SUPP))) {
+ LOG_ERROR_ARGS("couldn't mount because of unsupported "
+ "optional features (%x).\n", i);
+ goto done_nojournal;
+ }
+ if (!(osb->sb->s_flags & MS_RDONLY) &&
+ (i = OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, ~OCFS2_FEATURE_RO_COMPAT_SUPP))) {
+ LOG_ERROR_ARGS("couldn't mount RDWR because of "
+ "unsupported optional features (%x).\n",
+ i);
+ goto done_nojournal;
+ }
+
/* FIXME
* This should be done in ocfs_journal_init(), but unknown
* ordering issues will cause the filesystem to crash.
@@ -1761,7 +1781,7 @@
* 0 on success
*/
static int ocfs_verify_volume(ocfs2_dinode *di, struct buffer_head *bh,
- __u32 sectsize)
+ __u32 blksz)
{
int status = -EAGAIN;
@@ -1770,16 +1790,16 @@
if (memcmp(di->i_signature, OCFS2_SUPER_BLOCK_SIGNATURE,
strlen(OCFS2_SUPER_BLOCK_SIGNATURE)) == 0) {
status = -EINVAL;
- if ((1 << le32_to_cpu(di->id2.i_super.s_blocksize_bits)) != sectsize) {
- LOG_ERROR_ARGS("found superblock with incorrect sectorsize: "
+ if ((1 << le32_to_cpu(di->id2.i_super.s_blocksize_bits)) != blksz) {
+ LOG_ERROR_ARGS("found superblock with incorrect block size: "
"found %u, should be %u\n",
1 << le32_to_cpu(di->id2.i_super.s_blocksize_bits),
- sectsize);
+ blksz);
} else if (le16_to_cpu(di->id2.i_super.s_major_rev_level) !=
OCFS2_MAJOR_REV_LEVEL ||
le16_to_cpu(di->id2.i_super.s_minor_rev_level) !=
OCFS2_MINOR_REV_LEVEL) {
-#warning dont know what is appropriate on minor rev difference and also need to check compat flags
+#warning dont know what is appropriate on minor rev difference
LOG_ERROR_ARGS("found superblock with bad version: "
"found %u.%u, should be %u.%u\n",
le16_to_cpu(di->id2.i_super.s_major_rev_level),
More information about the Ocfs2-commits
mailing list