ocfs2: Add the 'inode64' mount option.
authorJoel Becker <joel.becker@oracle.com>
Thu, 4 Sep 2008 03:03:40 +0000 (20:03 -0700)
committerMark Fasheh <mfasheh@suse.com>
Mon, 13 Oct 2008 23:57:08 +0000 (16:57 -0700)
Now that ocfs2 limits inode numbers to 32bits, add a mount option to
disable the limit.  This parallels XFS.  64bit systems can handle the
larger inode numbers.

[ Added description of inode64 mount option in ocfs2.txt. --Mark ]

Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Documentation/filesystems/ocfs2.txt
fs/ocfs2/ocfs2.h
fs/ocfs2/suballoc.c
fs/ocfs2/super.c

index c318a8bbb1ef1efdbd68930ed687595f3c397121..6acf1b4f24669bfe653abf4edfaf9c72b7de0d72 100644 (file)
@@ -76,3 +76,7 @@ localalloc=8(*)               Allows custom localalloc size in MB. If the value is too
                        large, the fs will silently revert it to the default.
                        Localalloc is not enabled for local mounts.
 localflocks            This disables cluster aware flock.
+inode64                        Indicates that Ocfs2 is allowed to create inodes at
+                       any location in the filesystem, including those which
+                       will result in inode numbers occupying more than 32
+                       bits of significance.
index 6d3c10ddf489a81bd224eb51068f03b2d1e59466..78ae4f87e6b034a2c65cfc45238932f73d22ab3f 100644 (file)
@@ -189,6 +189,7 @@ enum ocfs2_mount_options
        OCFS2_MOUNT_DATA_WRITEBACK = 1 << 4, /* No data ordering */
        OCFS2_MOUNT_LOCALFLOCKS = 1 << 5, /* No cluster aware user file locks */
        OCFS2_MOUNT_NOUSERXATTR = 1 << 6, /* No user xattr */
+       OCFS2_MOUNT_INODE64 = 1 << 7,   /* Allow inode numbers > 2^32 */
 };
 
 #define OCFS2_OSB_SOFT_RO      0x0001
index 213bdca16fe48c7f814348abed5c42cb5d365071..d7a6f928c31726731ee0d58a839f5b6daf427676 100644 (file)
@@ -601,9 +601,10 @@ int ocfs2_reserve_new_inode(struct ocfs2_super *osb,
        /*
         * stat(2) can't handle i_ino > 32bits, so we tell the
         * lower levels not to allocate us a block group past that
-        * limit.
+        * limit.  The 'inode64' mount option avoids this behavior.
         */
-       (*ac)->ac_max_block = (u32)~0U;
+       if (!(osb->s_mount_opt & OCFS2_MOUNT_INODE64))
+               (*ac)->ac_max_block = (u32)~0U;
 
        /*
         * slot is set when we successfully steal inode from other nodes.
index c85e525950a99d7e751bdfe1533b1d2e066a6b23..1a51c8c53bef142059cda132c52af568102c85da 100644 (file)
@@ -157,6 +157,7 @@ enum {
        Opt_stack,
        Opt_user_xattr,
        Opt_nouser_xattr,
+       Opt_inode64,
        Opt_err,
 };
 
@@ -178,6 +179,7 @@ static const match_table_t tokens = {
        {Opt_stack, "cluster_stack=%s"},
        {Opt_user_xattr, "user_xattr"},
        {Opt_nouser_xattr, "nouser_xattr"},
+       {Opt_inode64, "inode64"},
        {Opt_err, NULL}
 };
 
@@ -411,6 +413,15 @@ static int ocfs2_remount(struct super_block *sb, int *flags, char *data)
                goto out;
        }
 
+       /* Probably don't want this on remount; it might
+        * mess with other nodes */
+       if (!(osb->s_mount_opt & OCFS2_MOUNT_INODE64) &&
+           (parsed_options.mount_opt & OCFS2_MOUNT_INODE64)) {
+               ret = -EINVAL;
+               mlog(ML_ERROR, "Cannot enable inode64 on remount\n");
+               goto out;
+       }
+
        /* We're going to/from readonly mode. */
        if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) {
                /* Lock here so the check of HARD_RO and the potential
@@ -930,6 +941,9 @@ static int ocfs2_parse_options(struct super_block *sb,
                               OCFS2_STACK_LABEL_LEN);
                        mopt->cluster_stack[OCFS2_STACK_LABEL_LEN] = '\0';
                        break;
+               case Opt_inode64:
+                       mopt->mount_opt |= OCFS2_MOUNT_INODE64;
+                       break;
                default:
                        mlog(ML_ERROR,
                             "Unrecognized mount option \"%s\" "
@@ -994,6 +1008,9 @@ static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt)
                seq_printf(s, ",cluster_stack=%.*s", OCFS2_STACK_LABEL_LEN,
                           osb->osb_cluster_stack);
 
+       if (opts & OCFS2_MOUNT_INODE64)
+               seq_printf(s, ",inode64");
+
        return 0;
 }