Whamcloud - gitweb
b=22769 improve error message for dx_probe
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext3-get-raid-stripe-from-sb.patch
1 Index: linux-2.6.18-53.1.14/fs/ext3/super.c
2 ===================================================================
3 --- linux-2.6.18-53.1.14.orig/fs/ext3/super.c
4 +++ linux-2.6.18-53.1.14/fs/ext3/super.c
5 @@ -1900,6 +1900,34 @@ static int ext3_max_dir_size_write(struc
6         return count;
7  }
8  
9 +/*
10 + * ext3_get_stripe_size: Get the stripe size.
11 + * @sbi: In memory super block info
12 + *
13 + * If we have specified it via mount option, then
14 + * use the mount option value. If the value specified at mount time is
15 + * greater than the blocks per group use the super block value.
16 + * If the super block value is greater than blocks per group return 0.
17 + * Allocator needs it be less than blocks per group.
18 + */
19 +static unsigned long ext3_get_stripe_size(struct ext3_sb_info *sbi)
20 +{
21 +       unsigned long stride = le16_to_cpu(sbi->s_es->s_raid_stride);
22 +       unsigned long stripe_width =
23 +                       le32_to_cpu(sbi->s_es->s_raid_stripe_width);
24 +
25 +       if (sbi->s_stripe && sbi->s_stripe <= sbi->s_blocks_per_group)
26 +               return sbi->s_stripe;
27 +
28 +       if (stripe_width <= sbi->s_blocks_per_group)
29 +               return stripe_width;
30 +
31 +       if (stride <= sbi->s_blocks_per_group)
32 +               return stride;
33 +
34 +       return 0;
35 +}
36 +
37  static int ext3_fill_super (struct super_block *sb, void *data, int silent)
38  {
39         struct buffer_head * bh;
40 @@ -2221,6 +2249,8 @@ static int ext3_fill_super (struct super
41         sbi->s_rsv_window_head.rsv_goal_size = 0;
42         ext3_rsv_window_add(sb, &sbi->s_rsv_window_head);
43  
44 +        sbi->s_stripe = ext3_get_stripe_size(sbi);
45 +
46         /*
47          * set up enough so that it can read an inode
48          */
49