Whamcloud - gitweb
6529fbc26ddb9e4dac2eabdeeaf66005f322c5bf
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-force_over_8tb-rhel5.patch
1 Index: linux-2.6.18-128.1.6/fs/ext4/super.c
2 ===================================================================
3 --- linux-2.6.18-128.1.6.orig/fs/ext4/super.c
4 +++ linux-2.6.18-128.1.6/fs/ext4/super.c
5 @@ -47,6 +47,8 @@
6  #include "namei.h"
7  #include "group.h"
8  
9 +static int force_over_8tb;
10 +
11  static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
12                              unsigned long journal_devnum);
13  static int ext4_create_journal(struct super_block *, struct ext4_super_block *,
14 @@ -1227,6 +1229,7 @@ enum {
15         Opt_grpquota, Opt_extents, Opt_noextents, Opt_i_version,
16         Opt_mballoc, Opt_nomballoc, Opt_stripe,
17         Opt_iopen, Opt_noiopen, Opt_iopen_nopriv, Opt_bigendian_extents,
18 +       Opt_force_over_8tb,
19  };
20  
21  static match_table_t tokens = {
22 @@ -1289,6 +1292,7 @@ static match_table_t tokens = {
23         {Opt_stripe, "stripe=%u"},
24         {Opt_resize, "resize"},
25         {Opt_bigendian_extents, "bigendian_extents"},
26 +       {Opt_force_over_8tb, "force_over_8tb"},
27         {Opt_err, NULL},
28  };
29  
30 @@ -1690,6 +1694,9 @@ clear_qf_name:
31                 case Opt_bigendian_extents:
32                         bigendian_extents = 1;
33                         break;
34 +               case Opt_force_over_8tb:
35 +                       force_over_8tb = 1;
36 +                       break;
37                 default:
38                         printk(KERN_ERR
39                                "EXT4-fs: Unrecognized mount option \"%s\" "
40 @@ -2534,6 +2541,17 @@ static int ext4_fill_super(struct super_
41                 goto failed_mount;
42         }
43  
44 +       if (ext4_blocks_count(es) >
45 +           ((0x80000000000ULL >> sb->s_blocksize_bits) - 1)) {
46 +               if (force_over_8tb == 0) {
47 +                       printk(KERN_ERR "EXT4-fs does not support filesystems "
48 +                              "greater than 8TB and can cause data corruption."
49 +                              "Use \"force_over_8tb\" mount option to override."
50 +                              "\n");
51 +                       goto failed_mount;
52 +               }
53 +       }
54 +
55         if (EXT4_BLOCKS_PER_GROUP(sb) == 0)
56                 goto cantfind_ext4;
57