Whamcloud - gitweb
LU-2473 ldiskfs: Reorganize ldiskfs kernel patches
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel6.3 / ext4-force_over_128tb.patch
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-force_over_128tb.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-force_over_128tb.patch
new file mode 100644 (file)
index 0000000..e0254b4
--- /dev/null
@@ -0,0 +1,57 @@
+Index: linux-stage/fs/ext4/super.c
+===================================================================
+--- linux-stage.orig/fs/ext4/super.c   2011-03-11 15:35:15.680343230 +0800
++++ linux-stage/fs/ext4/super.c        2011-03-11 15:44:45.037632078 +0800
+@@ -55,6 +55,8 @@
+ struct proc_dir_entry *ext4_proc_root;
+ static struct kset *ext4_kset;
++static int force_over_128tb;
++
+ static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
+                            unsigned long journal_devnum);
+ static int ext4_commit_super(struct super_block *sb, int sync);
+@@ -1494,7 +1496,7 @@
+       Opt_stripe, Opt_delalloc, Opt_nodelalloc,
+       Opt_block_validity, Opt_noblock_validity,
+       Opt_inode_readahead_blks, Opt_journal_ioprio,
+-      Opt_mballoc, Opt_bigendian_extents,
++      Opt_mballoc, Opt_bigendian_extents, Opt_force_over_128tb,
+       Opt_discard, Opt_nodiscard,
+       Opt_init_inode_table, Opt_noinit_inode_table,
+ };
+@@ -1562,6 +1564,7 @@
+       {Opt_auto_da_alloc, "auto_da_alloc"},
+       {Opt_noauto_da_alloc, "noauto_da_alloc"},
+       {Opt_bigendian_extents, "bigendian_extents"},
++      {Opt_force_over_128tb, "force_over_128tb"},
+       {Opt_mballoc, "mballoc"},
+       {Opt_discard, "discard"},
+       {Opt_nodiscard, "nodiscard"},
+@@ -2008,6 +2011,9 @@
+                       break;
+               case Opt_mballoc:
+                       break;
++              case Opt_force_over_128tb:
++                      force_over_128tb = 1;
++                      break;
+               default:
+                       ext4_msg(sb, KERN_ERR,
+                              "Unrecognized mount option \"%s\" "
+@@ -3031,6 +3037,16 @@
+               goto failed_mount;
+       }
++      if (ext4_blocks_count(es) > (8ULL << 32)) {
++              if (force_over_128tb == 0) {
++                      printk(KERN_ERR "EXT4-fs does not support filesystems "
++                             "greater than 128TB and can cause data corruption."
++                             "Use \"force_over_128tb\" mount option to override."
++                             "\n");
++                      goto failed_mount;
++              }
++      }
++
+       if (EXT4_BLOCKS_PER_GROUP(sb) == 0)
+               goto cantfind_ext4;