[Ocfs2-commits] manish commits r2432 - trunk/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Jun 28 16:07:59 CDT 2005


Author: manish
Signed-off-by: mfasheh
Date: 2005-06-26 17:55:48 -0500 (Sun, 26 Jun 2005)
New Revision: 2432

Modified:
   trunk/fs/ocfs2/file.c
   trunk/fs/ocfs2/mmap.c
   trunk/fs/ocfs2/ocfs2.h
   trunk/fs/ocfs2/super.c
Log:
Add a "datavolume" mount option, and only enable the ocfs1 compat workarounds
when that mount option is specified.

Signed-off-by: mfasheh


Modified: trunk/fs/ocfs2/file.c
===================================================================
--- trunk/fs/ocfs2/file.c	2005-06-25 00:59:43 UTC (rev 2431)
+++ trunk/fs/ocfs2/file.c	2005-06-26 22:55:48 UTC (rev 2432)
@@ -183,9 +183,6 @@
 	struct inode *inode = dentry->d_inode;
 	struct ocfs2_write_lock_info info = {0, };
 	DECLARE_BUFFER_LOCK_CTXT(ctxt);
-#ifdef OCFS2_ORACORE_WORKAROUNDS
-	unsigned int saved_flags;
-#endif
 
 	mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", filp, buf,
 		   (unsigned int)count,
@@ -214,16 +211,20 @@
 	down_read(&OCFS2_I(inode)->ip_alloc_sem);
 
 #ifdef OCFS2_ORACORE_WORKAROUNDS
-	saved_flags = filp->f_flags;
-	if (info.wl_do_direct_io) 
-		filp->f_flags |= O_DIRECT;
-	else
-		filp->f_flags &= ~O_DIRECT;
+	if (osb->s_mount_opt & OCFS2_MOUNT_COMPAT_OCFS) {
+		unsigned int saved_flags = filp->f_flags;
+
+		if (info.wl_do_direct_io) 
+			filp->f_flags |= O_DIRECT;
+		else
+			filp->f_flags &= ~O_DIRECT;
+
+		ret = generic_file_write_nolock(filp, &local_iov, 1, ppos);
+
+		filp->f_flags = saved_flags;
+	} else
 #endif
-	ret = generic_file_write_nolock(filp, &local_iov, 1, ppos);
-#ifdef OCFS2_ORACORE_WORKAROUNDS
-	filp->f_flags = saved_flags;
-#endif
+		ret = generic_file_write_nolock(filp, &local_iov, 1, ppos);
 
 	up_read(&OCFS2_I(inode)->ip_alloc_sem);
 
@@ -268,14 +269,16 @@
 	osb = OCFS2_SB(inode->i_sb);
 
 #ifdef OCFS2_ORACORE_WORKAROUNDS
-	if (filp->f_flags & O_DIRECT) {
-		int sector_size = 1 << osb->s_sectsize_bits;
+	if (osb->s_mount_opt & OCFS2_MOUNT_COMPAT_OCFS) {
+		if (filp->f_flags & O_DIRECT) {
+			int sector_size = 1 << osb->s_sectsize_bits;
 
-		if (((*ppos) & (sector_size - 1)) ||
-		    (count & (sector_size - 1)) || 
-		    ((unsigned long)buf & (sector_size - 1)) ||
-		    (i_size_read(inode) & (sector_size -1))) {
-			filp->f_flags &= ~O_DIRECT;
+			if (((*ppos) & (sector_size - 1)) ||
+			    (count & (sector_size - 1)) || 
+			    ((unsigned long)buf & (sector_size - 1)) ||
+			    (i_size_read(inode) & (sector_size -1))) {
+				filp->f_flags &= ~O_DIRECT;
+			}
 		}
 	}
 #endif

Modified: trunk/fs/ocfs2/mmap.c
===================================================================
--- trunk/fs/ocfs2/mmap.c	2005-06-25 00:59:43 UTC (rev 2431)
+++ trunk/fs/ocfs2/mmap.c	2005-06-26 22:55:48 UTC (rev 2432)
@@ -519,28 +519,32 @@
 		mlog(0, "O_APPEND: inode->i_size=%llu\n", saved_ppos);
 
 #ifdef OCFS2_ORACORE_WORKAROUNDS
-		/* ugh, work around some applications which open
-		 * everything O_DIRECT + O_APPEND and really don't
-		 * mean to use O_DIRECT. */
-		filp->f_flags &= ~O_DIRECT;
+		if (osb->s_mount_opt & OCFS2_MOUNT_COMPAT_OCFS) {
+			/* ugh, work around some applications which open
+			 * everything O_DIRECT + O_APPEND and really don't
+			 * mean to use O_DIRECT. */
+			filp->f_flags &= ~O_DIRECT;
+		}
 #endif
 	}
 
 	if (filp->f_flags & O_DIRECT) {
 #ifdef OCFS2_ORACORE_WORKAROUNDS
-		int sector_size = 1 << osb->s_sectsize_bits;
+		if (osb->s_mount_opt & OCFS2_MOUNT_COMPAT_OCFS) {
+			int sector_size = 1 << osb->s_sectsize_bits;
 
-		if ((saved_ppos & (sector_size - 1)) || 
-		    (count & (sector_size - 1)) || 
-		    ((unsigned long)buf & (sector_size - 1))) {
-			info->wl_do_direct_io = 0;
-			filp->f_flags |= O_SYNC;
-		} else {
+			if ((saved_ppos & (sector_size - 1)) || 
+			    (count & (sector_size - 1)) || 
+			    ((unsigned long)buf & (sector_size - 1))) {
+				info->wl_do_direct_io = 0;
+				filp->f_flags |= O_SYNC;
+			} else {
+				info->wl_do_direct_io = 1;
+			}
+		} else
+#endif
 			info->wl_do_direct_io = 1;
-		}
-#else
-		info->wl_do_direct_io = 1;
-#endif
+
 		mlog(0, "O_DIRECT\n");
 	}
 

Modified: trunk/fs/ocfs2/ocfs2.h
===================================================================
--- trunk/fs/ocfs2/ocfs2.h	2005-06-25 00:59:43 UTC (rev 2431)
+++ trunk/fs/ocfs2/ocfs2.h	2005-06-26 22:55:48 UTC (rev 2432)
@@ -167,7 +167,10 @@
 enum ocfs2_mount_options
 {
 	OCFS2_MOUNT_HB_OK   = 1 << 0,	/* Heartbeat started */
-	OCFS2_MOUNT_BARRIER = 1 << 1	/* Use block barriers */
+	OCFS2_MOUNT_BARRIER = 1 << 1,	/* Use block barriers */
+#ifdef OCFS2_ORACORE_WORKAROUNDS
+	OCFS2_MOUNT_COMPAT_OCFS = 1 << 30, /* ocfs1 compatibility mode */
+#endif
 };
 
 struct _ocfs2_journal;

Modified: trunk/fs/ocfs2/super.c
===================================================================
--- trunk/fs/ocfs2/super.c	2005-06-25 00:59:43 UTC (rev 2431)
+++ trunk/fs/ocfs2/super.c	2005-06-26 22:55:48 UTC (rev 2432)
@@ -132,15 +132,25 @@
 	.get_parent	= ocfs2_get_parent,
 };
 
+#ifdef OCFS2_ORACORE_WORKAROUNDS
+#define OCFS_SUPER_MAGIC		0xa156f7eb
+#endif
+
 enum {
 	Opt_hbok,
 	Opt_barrier,
+#ifdef OCFS2_ORACORE_WORKAROUNDS
+	Opt_datavolume,
+#endif
 	Opt_err,
 };
 
 static match_table_t tokens = {
 	{Opt_hbok, OCFS2_HB_OK},
 	{Opt_barrier, "barrier=%u"},
+#ifdef OCFS2_ORACORE_WORKAROUNDS
+	{Opt_datavolume, "datavolume"},
+#endif
 	{Opt_err, NULL}
 };
 
@@ -363,7 +373,12 @@
 		  goto read_super_error;
 	}
 
-	sb->s_magic = OCFS2_SUPER_MAGIC;
+#ifdef OCFS2_ORACORE_WORKAROUNDS
+	if (mount_opt & OCFS2_MOUNT_COMPAT_OCFS)
+		sb->s_magic = OCFS_SUPER_MAGIC;
+	else
+#endif
+		sb->s_magic = OCFS2_SUPER_MAGIC;
 	sb->s_op = &ocfs2_sops;
 	sb->s_export_op = &ocfs2_export_ops;
 	sb->s_flags |= MS_NOATIME;
@@ -482,6 +497,11 @@
 			else
 				*mount_opt &= ~OCFS2_MOUNT_BARRIER;
 			break;
+#ifdef OCFS2_ORACORE_WORKAROUNDS
+		case Opt_datavolume:
+			*mount_opt |= OCFS2_MOUNT_COMPAT_OCFS;
+			break;
+#endif
 		default:
 			mlog(ML_ERROR,
 			     "Unrecognized mount option \"%s\" "
@@ -615,7 +635,12 @@
 	numbits = le32_to_cpu(bm_lock->id1.bitmap1.i_total);
 	freebits = numbits - le32_to_cpu(bm_lock->id1.bitmap1.i_used);
 
-	buf->f_type = OCFS2_SUPER_MAGIC;
+#ifdef OCFS2_ORACORE_WORKAROUNDS
+	if (osb->s_mount_opt & OCFS2_MOUNT_COMPAT_OCFS)
+		buf->f_type = OCFS_SUPER_MAGIC;
+	else
+#endif
+		buf->f_type = OCFS2_SUPER_MAGIC;
 	buf->f_bsize = sb->s_blocksize;
 	buf->f_namelen = OCFS2_MAX_FILENAME_LEN;
 	buf->f_blocks = ((sector_t) numbits) *



More information about the Ocfs2-commits mailing list