Whamcloud - gitweb
Branch b1_8
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-big-endian-check-2.6-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 @@ -70,6 +70,8 @@ struct page *ext4_zero_page;
6  
7  struct proc_dir_entry *proc_root_ext4;
8  
9 +static int bigendian_extents;
10 +
11  ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
12                                struct ext4_group_desc *bg)
13  {
14 @@ -1222,7 +1224,7 @@ enum {
15         Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota,
16         Opt_grpquota, Opt_extents, Opt_noextents, Opt_i_version,
17         Opt_mballoc, Opt_nomballoc, Opt_stripe,
18 -       Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
19 +       Opt_iopen, Opt_noiopen, Opt_iopen_nopriv, Opt_bigendian_extents,
20  };
21  
22  static match_table_t tokens = {
23 @@ -1284,6 +1286,7 @@ static match_table_t tokens = {
24         {Opt_nomballoc, "nomballoc"},
25         {Opt_stripe, "stripe=%u"},
26         {Opt_resize, "resize"},
27 +       {Opt_bigendian_extents, "bigendian_extents"},
28         {Opt_err, NULL},
29  };
30  
31 @@ -1682,6 +1685,9 @@ clear_qf_name:
32                                 return 0;
33                         sbi->s_stripe = option;
34                         break;
35 +               case Opt_bigendian_extents:
36 +                       bigendian_extents = 1;
37 +                       break;
38                 default:
39                         printk(KERN_ERR
40                                "EXT4-fs: Unrecognized mount option \"%s\" "
41 @@ -2561,6 +2567,15 @@ static int ext4_fill_super(struct super_
42                 goto failed_mount;
43         }
44  
45 +#ifdef __BIG_ENDIAN
46 +       if (bigendian_extents == 0) {
47 +               printk(KERN_ERR "EXT4-fs: extents feature is not guaranteed to "
48 +                      "work on big-endian systems. Use \"bigendian_extents\" "
49 +                      "mount option to override.\n");
50 +               goto failed_mount;
51 +       }
52 +#endif
53 +
54         bgl_lock_init(&sbi->s_blockgroup_lock);
55  
56         sbi->s_last_alloc_group = -1;