Skip to contentSkip to conversation

Three more patches for the 1.4 tree

Ocfs2-devel New Sunil Mushran 2 participants 6 messages Feb 11, 2008 – Feb 21, 2008 OCFS2

lore
Share & tools
lore
#0 lore raw

1. First patch is for forward port of detavolume. I am resending this because few people did not get it the last time around.

2. Workaround to get loop mounts working on enterprise kernels. IIRC this is relevant for SLES too.

3. fops->sendfile() was stripped out of the kernel in 2.6.23. Readding as this tree needs to support older kernels.

Jeff, Please could you ensure the configure changes are ok for SLES.

Thanks
Sunil

#1 lore raw

PATCH 1/3 ocfs2: Add datavolume mount option

This is a forward port of the datavolume mount option in OCFS2 1.2.

---
 fs/ocfs2/ocfs2.h |    3 +++
 fs/ocfs2/super.c |   40 ++++++++++++++++++++++++++++++++++++++--
 2 files changed, 41 insertions(+), 2 deletions(-)
fs/ocfs2/ocfs2.h +3 -0
index d084805..b9eafc0 100644
@@ -172,6 +172,9 @@ enum ocfs2_mount_options
 	OCFS2_MOUNT_ERRORS_PANIC = 1 << 3, /* Panic on errors */
 	OCFS2_MOUNT_DATA_WRITEBACK = 1 << 4, /* No data ordering */
 	OCFS2_MOUNT_LOCALFLOCKS = 1 << 5, /* No cluster aware user file locks */
+#ifdef OCFS2_ORACORE_WORKAROUNDS
+	OCFS2_MOUNT_COMPAT_OCFS = 1 << 30, /* ocfs1 compatibility mode */
+#endif
 };
 
 #define OCFS2_OSB_SOFT_RO	0x0001
fs/ocfs2/super.c +38 -2
index 6791be8..d5e2644 100644
@@ -143,6 +143,10 @@ static const struct super_operations ocfs2_sops = {
 	.show_options   = ocfs2_show_options,
 };
 
+#ifdef OCFS2_ORACORE_WORKAROUNDS
+# define OCFS_SUPER_MAGIC		0xa156f7eb
+#endif
+
 enum {
 	Opt_barrier,
 	Opt_err_panic,
@@ -158,6 +162,9 @@ enum {
 	Opt_commit,
 	Opt_localalloc,
 	Opt_localflocks,
+#ifdef OCFS2_ORACORE_WORKAROUNDS
+	Opt_datavolume,
+#endif
 	Opt_err,
 };
 
@@ -176,6 +183,9 @@ static match_table_t tokens = {
 	{Opt_commit, "commit=%u"},
 	{Opt_localalloc, "localalloc=%d"},
 	{Opt_localflocks, "localflocks"},
+#ifdef OCFS2_ORACORE_WORKAROUNDS
+	{Opt_datavolume, "datavolume"},
+#endif
 	{Opt_err, NULL}
 };
 
@@ -613,7 +623,12 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
 	osb->osb_commit_interval = parsed_options.commit_interval;
 	osb->local_alloc_size = parsed_options.localalloc_opt;
 
-	sb->s_magic = OCFS2_SUPER_MAGIC;
+#ifdef OCFS2_ORACORE_WORKAROUNDS
+	if (osb->s_mount_opt & OCFS2_MOUNT_COMPAT_OCFS)
+		sb->s_magic = OCFS_SUPER_MAGIC;
+	else
+#endif
+		sb->s_magic = OCFS2_SUPER_MAGIC;
 
 	/* Hard readonly mode only if: bdev_read_only, MS_RDONLY,
 	 * heartbeat=none */
@@ -826,6 +841,17 @@ static int ocfs2_parse_options(struct super_block *sb,
 		case Opt_data_writeback:
 			mopt->mount_opt |= OCFS2_MOUNT_DATA_WRITEBACK;
 			break;
+#ifdef OCFS2_ORACORE_WORKAROUNDS
+		case Opt_datavolume:
+			if (is_remount) {
+				mlog(ML_ERROR, "Cannot specify datavolume "
+				     "on remount.\n");
+				status = 0;
+				goto bail;
+			}
+			mopt->mount_opt |= OCFS2_MOUNT_COMPAT_OCFS;
+			break;
+#endif
 		case Opt_atime_quantum:
 			if (match_int(&args[0], &option)) {
 				status = 0;
@@ -920,6 +946,11 @@ static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt)
 	else
 		seq_printf(s, ",errors=remount-ro");
 
+#ifdef OCFS2_ORACORE_WORKAROUNDS
+	if (opts & OCFS2_MOUNT_COMPAT_OCFS)
+		seq_printf(s, ",datavolume");
+#endif
+
 	if (osb->preferred_slot != OCFS2_INVALID_SLOT)
 		seq_printf(s, ",preferred_slot=%d", osb->preferred_slot);
 
@@ -1048,7 +1079,12 @@ static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf)
 	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 = dentry->d_sb->s_blocksize;
 	buf->f_namelen = OCFS2_MAX_FILENAME_LEN;
 	buf->f_blocks = ((sector_t) numbits) *
Signature · 1 line
1.5.3.4
#2 lore raw

PATCH 2/3 ocfs2: Detect and use MS_LOOP_NO_AOPS

In reply to Sunil Mushran

Some vendor kernels provide a superblock flag, MS_LOOP_NO_AOPS which will enable writable loopback support for ocfs2 1.4. Detect that flag and use it if possible.

This patch was forward-ported from 1.2.

---
 Config.make.in    |    1 +
 configure.in      |    5 +++++
 fs/ocfs2/Makefile |    4 ++++
 fs/ocfs2/super.c  |    4 ++++
 4 files changed, 14 insertions(+), 0 deletions(-)
Config.make.in +1 -0
index 0d6b2df..a9740e8 100644
@@ -93,6 +93,7 @@ INVALIDATEPAGE_RETURNS_INT = @INVALIDATEPAGE_RETURNS_INT@
 DIO_OLD_GET_BLOCKS = @DIO_OLD_GET_BLOCKS@
 NO_LINUX_UACCESS_H = @NO_LINUX_UACCESS_H@
 NO_SYSTEM_UTSNAME = @NO_SYSTEM_UTSNAME@
+HAS_MS_LOOP_NO_AOPS  = @HAS_MS_LOOP_NO_AOPS@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
configure.in +5 -0
index 29ab597..a1c5d19 100644
@@ -410,6 +410,11 @@ OCFS2_CHECK_KERNEL([system_utsname in utsname.h], utsname.h, ,
   NO_SYSTEM_UTSNAME=yes, [^extern struct new_utsname system_utsname])
 AC_SUBST(NO_SYSTEM_UTSNAME)
 
+HAS_MS_LOOP_NO_AOPS=
+OCFS2_CHECK_KERNEL([MS_LOOP_NO_AOPS flag defined], fs.h,
+  HAS_MS_LOOP_NO_AOPS==yes, , [MS_LOOP_NO_AOPS])
+AC_SUBST(HAS_MS_LOOP_NO_AOPS)
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
fs/ocfs2/Makefile +4 -0
index c80e2a0..05a94c7 100644
@@ -160,6 +160,10 @@ ifdef NO_LINUX_UACCESS_H
 EXTRA_CFLAGS += -DNO_LINUX_UACCESS_H
 endif
 
+ifdef HAS_MS_LOOP_NO_AOPS
+EXTRA_CFLAGS += -DHAS_MS_LOOP_NO_AOPS
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
fs/ocfs2/super.c +4 -0
index d5e2644..9ce5cc8 100644
@@ -724,6 +724,10 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
 	atomic_set(&osb->vol_state, VOLUME_MOUNTED);
 	wake_up(&osb->osb_mount_event);
 
+#ifdef HAS_MS_LOOP_NO_AOPS
+	/* OCFS2's prepare and commit write operations don't do any locking. */
+	sb->s_flags |= MS_LOOP_NO_AOPS;
+#endif
 	mlog_exit(status);
 	return status;
 
Signature · 1 line
1.5.3.4
#3 lore raw

PATCH 2/3 ocfs2: Detect and use MS_LOOP_NO_AOPS

fs/ocfs2/super.c static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) · line 728

Quoted 2 lines · Sunil Mushran
fs/ocfs2/super.c +2 -0
+#ifdef HAS_MS_LOOP_NO_AOPS
+	/* OCFS2's prepare and commit write operations don't do any locking. */

We might want to change this comment to something like:

	/* Ocfs2 1.4 doesn't provide prepare and commit write operations */

otherwise, the patch looks fine (sob)

	--Mark

--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]

#4 lore raw

PATCH 3/3 ocfs2: Add fops->sendfile()

In reply to Sunil Mushran

fops->sendfile() was removed in 2.6.23. Re-adding as this version of the fs is meant to also work with older kernels.

---
 Config.make.in    |    1 +
 configure.in      |    5 +++++
 fs/ocfs2/Makefile |    4 ++++
 fs/ocfs2/file.c   |   42 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 52 insertions(+), 0 deletions(-)
Config.make.in +1 -0
index a9740e8..b7d553d 100644
@@ -94,6 +94,7 @@ DIO_OLD_GET_BLOCKS = @DIO_OLD_GET_BLOCKS@
 NO_LINUX_UACCESS_H = @NO_LINUX_UACCESS_H@
 NO_SYSTEM_UTSNAME = @NO_SYSTEM_UTSNAME@
 HAS_MS_LOOP_NO_AOPS  = @HAS_MS_LOOP_NO_AOPS@
+HAS_FOPS_SENDFILE = @HAS_FOPS_SENDFILE@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
configure.in +5 -0
index a1c5d19..f3544b0 100644
@@ -415,6 +415,11 @@ OCFS2_CHECK_KERNEL([MS_LOOP_NO_AOPS flag defined], fs.h,
   HAS_MS_LOOP_NO_AOPS==yes, , [MS_LOOP_NO_AOPS])
 AC_SUBST(HAS_MS_LOOP_NO_AOPS)
 
+HAS_FOPS_SENDFILE=
+OCFS2_CHECK_KERNEL([fops->sendfile() in fs.h], fs.h,
+  HAS_FOPS_SENDFILE=yes, , [^.*ssize_t (\*sendfile)])
+AC_SUBST(HAS_FOPS_SENDFILE)
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
fs/ocfs2/Makefile +4 -0
index 05a94c7..0b90da3 100644
@@ -164,6 +164,10 @@ ifdef HAS_MS_LOOP_NO_AOPS
 EXTRA_CFLAGS += -DHAS_MS_LOOP_NO_AOPS
 endif
 
+ifdef HAS_FOPS_SENDFILE
+EXTRA_CFLAGS += -DHAS_FOPS_SENDFILE
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
fs/ocfs2/file.c +42 -0

54 lines not on this page · raw message

Signature · 1 line
1.5.3.4