From: Guru Anbalagane Date: Wed, 28 Sep 2011 21:46:14 +0000 (-0700) Subject: ocfs2: Add datavolume mount option X-Git-Tag: v2.6.39-400.9.0~881 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=817dad08bb52afd451cb5be43618a13bc714c736;p=users%2Fjedix%2Flinux-maple.git ocfs2: Add datavolume mount option Signed-off-by: Guru Anbalagane --- diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index 409285854f647..0d06f354db544 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h @@ -272,6 +272,7 @@ enum ocfs2_mount_options writes */ OCFS2_MOUNT_HB_NONE = 1 << 13, /* No heartbeat */ OCFS2_MOUNT_HB_GLOBAL = 1 << 14, /* Global heartbeat */ + OCFS2_MOUNT_COMPAT_OCFS = 1 << 30, /* ocfs1 compatibility mode */ }; #define OCFS2_OSB_SOFT_RO 0x0001 diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 56f61027236b6..a1c0f41e432e1 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -184,6 +184,7 @@ enum { Opt_coherency_full, Opt_resv_level, Opt_dir_resv_level, + Opt_datavolume, Opt_err, }; @@ -215,6 +216,7 @@ static const match_table_t tokens = { {Opt_coherency_full, "coherency=full"}, {Opt_resv_level, "resv_level=%u"}, {Opt_dir_resv_level, "dir_resv_level=%u"}, + {Opt_datavolume, "datavolume"}, {Opt_err, NULL} }; @@ -1070,7 +1072,11 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) if (status) goto read_super_error; - sb->s_magic = OCFS2_SUPER_MAGIC; +# define OCFS_SUPER_MAGIC 0xa156f7eb + if (osb->s_mount_opt & OCFS2_MOUNT_COMPAT_OCFS) + sb->s_magic = OCFS_SUPER_MAGIC; + else + sb->s_magic = OCFS2_SUPER_MAGIC; sb->s_flags = (sb->s_flags & ~(MS_POSIXACL | MS_NOSEC)) | ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); @@ -1506,6 +1512,15 @@ static int ocfs2_parse_options(struct super_block *sb, option < OCFS2_MAX_RESV_LEVEL) mopt->dir_resv_level = option; break; + 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; default: mlog(ML_ERROR, "Unrecognized mount option \"%s\" " @@ -1613,6 +1628,9 @@ static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt) if (osb->osb_dir_resv_level != osb->osb_resv_level) seq_printf(s, ",dir_resv_level=%d", osb->osb_resv_level); + if (opts & OCFS2_MOUNT_COMPAT_OCFS) + seq_printf(s, ",datavolume"); + return 0; } @@ -1721,7 +1739,10 @@ 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; + if (osb->s_mount_opt & OCFS2_MOUNT_COMPAT_OCFS) + buf->f_type = OCFS_SUPER_MAGIC; + else + 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) *