Whamcloud - gitweb
4ea9b247832645d5095a7af3218ce407c15fd223
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-force_over_16tb-rhel5.patch
1 Index: linux-2.6.18-164.6.1/fs/ext4/super.c
2 ===================================================================
3 --- linux-2.6.18-164.6.1.orig/fs/ext4/super.c
4 +++ linux-2.6.18-164.6.1/fs/ext4/super.c
5 @@ -51,6 +51,8 @@
6  
7  struct proc_dir_entry *ext4_proc_root;
8  
9 +static int force_over_16tb;
10 +
11  static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
12                              unsigned long journal_devnum);
13  static int ext4_commit_super(struct super_block *sb,
14 @@ -1343,6 +1345,7 @@ enum {
15         Opt_stripe, Opt_delalloc, Opt_nodelalloc,
16         Opt_inode_readahead_blks, Opt_journal_ioprio,
17         Opt_iopen, Opt_noiopen, Opt_iopen_nopriv, Opt_bigendian_extents,
18 +       Opt_force_over_16tb,
19  };
20  
21  static match_table_t tokens = {
22 @@ -1410,6 +1413,7 @@ static match_table_t tokens = {
23         {Opt_auto_da_alloc, "auto_da_alloc"},
24         {Opt_noauto_da_alloc, "noauto_da_alloc"},
25         {Opt_bigendian_extents, "bigendian_extents"},
26 +       {Opt_force_over_16tb, "force_over_16tb"},
27         {Opt_err, NULL},
28  };
29  
30 @@ -1837,6 +1841,9 @@ set_qf_format:
31                         break;
32                 case Opt_mballoc:
33                         break;
34 +               case Opt_force_over_16tb:
35 +                       force_over_16tb = 1;
36 +                       break;
37                 default:
38                         printk(KERN_ERR
39                                "EXT4-fs: Unrecognized mount option \"%s\" "
40 @@ -2692,6 +2699,16 @@ static int ext4_fill_super(struct super_
41                 goto failed_mount;
42         }
43  
44 +       if (ext4_blocks_count(es) >= (1ULL << 32)) {
45 +               if (force_over_16tb == 0) {
46 +                       printk(KERN_ERR "EXT4-fs does not support filesystems "
47 +                              "greater than 16TB and can cause data corruption."
48 +                              "Use \"force_over_16tb\" mount option to override."
49 +                              "\n");
50 +                       goto failed_mount;
51 +               }
52 +       }
53 +
54         if (EXT4_BLOCKS_PER_GROUP(sb) == 0)
55                 goto cantfind_ext4;
56