Whamcloud - gitweb
LU-136 change "force_over_16tb" mount option to "force_over_128tb"
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-misc-rhel6.patch
1 Index: linux-stage/fs/ext4/ext4.h
2 ===================================================================
3 --- linux-stage.orig/fs/ext4/ext4.h     2011-05-20 10:59:32.000000000 +0300
4 +++ linux-stage/fs/ext4/ext4.h  2011-05-20 11:01:06.000000000 +0300
5 @@ -1191,6 +1191,9 @@ EXT4_INODE_BIT_FNS(state, state_flags)
6  
7  #define NEXT_ORPHAN(inode) EXT4_I(inode)->i_dtime
8  
9 +/* Has been moved to linux/magic.h but we need it for Lustre */
10 +#define EXT4_SUPER_MAGIC       0xEF53
11 +
12  /*
13   * Codes for operating systems
14   */
15 @@ -1630,6 +1633,9 @@ extern void ext4_mb_put_buddy_cache_lock
16                                                 ext4_group_t, int);
17  extern int ext4_trim_fs(struct super_block *, struct fstrim_range *);
18  
19 +extern void ext4_mb_discard_inode_preallocations(struct inode *);
20 +
21 +
22  /* inode.c */
23  int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
24                 struct buffer_head *bh, ext4_fsblk_t blocknr);
25 Index: linux-stage/fs/ext4/ext4_extents.h
26 ===================================================================
27 --- linux-stage.orig/fs/ext4/ext4_extents.h     2011-05-20 10:59:30.000000000 +0300
28 +++ linux-stage/fs/ext4/ext4_extents.h  2011-05-20 11:00:01.000000000 +0300
29 @@ -58,6 +58,12 @@
30   */
31  #define EXT_STATS_
32  
33 +/*
34 + * define EXT4_ALLOC_NEEDED to 0 since block bitmap, group desc. and sb
35 + * are now accounted in ext4_ext_calc_credits_for_insert()
36 + */
37 +#define EXT4_ALLOC_NEEDED 0
38 +#define HAVE_EXT_PREPARE_CB_EXTENT
39  
40  /*
41   * ext4_inode has i_block array (60 bytes total).
42 @@ -160,6 +166,7 @@ typedef int (*ext_prepare_callback)(stru
43  #define EXT_INIT_MAX_LEN       (1UL << 15)
44  #define EXT_UNINIT_MAX_LEN     (EXT_INIT_MAX_LEN - 1)
45  
46 +#define EXT4_EXT_HAS_NO_TREE   /* ext4_extents_tree struct is not used*/
47  
48  #define EXT_FIRST_EXTENT(__hdr__) \
49         ((struct ext4_extent *) (((char *) (__hdr__)) +         \
50 @@ -239,6 +246,8 @@ extern int ext4_extent_tree_init(handle_
51  extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode,
52                                                    int num,
53                                                    struct ext4_ext_path *path);
54 +extern int ext4_ext_calc_credits_for_insert(struct inode *,
55 +                                           struct ext4_ext_path *);
56  extern int ext4_can_extents_be_merged(struct inode *inode,
57                                       struct ext4_extent *ex1,
58                                       struct ext4_extent *ex2);
59 Index: linux-stage/fs/ext4/ext4_jbd2.c
60 ===================================================================
61 --- linux-stage.orig/fs/ext4/ext4_jbd2.c        2011-05-20 10:59:29.000000000 +0300
62 +++ linux-stage/fs/ext4/ext4_jbd2.c     2011-05-20 11:00:01.000000000 +0300
63 @@ -31,6 +31,7 @@ int __ext4_journal_get_write_access(cons
64         }
65         return err;
66  }
67 +EXPORT_SYMBOL(__ext4_journal_get_write_access);
68  
69  int __ext4_journal_forget(const char *where, handle_t *handle,
70                                 struct buffer_head *bh)
71 @@ -107,3 +108,4 @@ int __ext4_handle_dirty_metadata(const c
72         }
73         return err;
74  }
75 +EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
76 Index: linux-stage/fs/ext4/ext4_jbd2.h
77 ===================================================================
78 --- linux-stage.orig/fs/ext4/ext4_jbd2.h        2011-05-20 10:59:29.000000000 +0300
79 +++ linux-stage/fs/ext4/ext4_jbd2.h     2011-05-20 11:00:01.000000000 +0300
80 @@ -35,6 +35,8 @@
81         (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)   \
82          ? 27U : 8U)
83  
84 +#define ext4_journal_dirty_metadata(handle, bh)  \
85 +               ext4_handle_dirty_metadata(handle, NULL, bh)
86  /* Extended attribute operations touch at most two data buffers,
87   * two bitmap buffers, and two group summaries, in addition to the inode
88   * and the superblock, which are already accounted for. */
89 Index: linux-stage/fs/ext4/extents.c
90 ===================================================================
91 --- linux-stage.orig/fs/ext4/extents.c
92 +++ linux-stage/fs/ext4/extents.c
93 @@ -2133,6 +2133,55 @@ int ext4_ext_calc_credits_for_single_ext
94  }
95  
96  /*
97 + * This routine returns max. credits extent tree can consume.
98 + * It should be OK for low-performance paths like ->writepage()
99 + * To allow many writing process to fit a single transaction,
100 + * caller should calculate credits under truncate_mutex and
101 + * pass actual path.
102 + */
103 +int ext4_ext_calc_credits_for_insert(struct inode *inode,
104 +                                    struct ext4_ext_path *path)
105 +{
106 +       int depth, needed;
107 +
108 +       if (path) {
109 +               /* probably there is space in leaf? */
110 +               depth = ext_depth(inode);
111 +               if (le16_to_cpu(path[depth].p_hdr->eh_entries)
112 +                               < le16_to_cpu(path[depth].p_hdr->eh_max))
113 +                       return 1;
114 +       }
115 +
116 +       /*
117 +        * given 32bit logical block (4294967296 blocks), max. tree
118 +        * can be 4 levels in depth -- 4 * 340^4 == 53453440000.
119 +        * let's also add one more level for imbalance.
120 +        */
121 +       depth = 5;
122 +
123 +       /* allocation of new data block(s) */
124 +       needed = 2;
125 +
126 +       /*
127 +        * tree can be full, so it'd need to grow in depth:
128 +        * we need one credit to modify old root, credits for
129 +        * new root will be added in split accounting
130 +        */
131 +       needed += 1;
132 +       /*
133 +        * Index split can happen, we'd need:
134 +        *    allocate intermediate indexes (bitmap + group)
135 +        *  + change two blocks at each level, but root (already included)
136 +        */
137 +       needed += (depth * 2) + (depth * 2);
138 +
139 +       /* any allocation modifies superblock */
140 +       needed += 1;
141 +
142 +       return needed;
143 +}
144 +
145 +/*
146   * How many index/leaf blocks need to change/allocate to modify nrblocks?
147   *
148   * if nrblocks are fit in a single extent (chunk flag is 1), then
149 @@ -4029,3 +4079,14 @@ int ext4_fiemap(struct inode *inode, str
150         return error;
151  }
152  
153 +EXPORT_SYMBOL(ext4_ext_store_pblock);
154 +EXPORT_SYMBOL(ext4_ext_search_right);
155 +EXPORT_SYMBOL(ext4_ext_search_left);
156 +EXPORT_SYMBOL(ext_pblock);
157 +EXPORT_SYMBOL(ext4_ext_insert_extent);
158 +EXPORT_SYMBOL(ext4_mb_new_blocks);
159 +EXPORT_SYMBOL(ext4_ext_calc_credits_for_insert);
160 +EXPORT_SYMBOL(ext4_mark_inode_dirty);
161 +EXPORT_SYMBOL(ext4_ext_walk_space);
162 +EXPORT_SYMBOL(ext4_ext_find_extent);
163 +EXPORT_SYMBOL(ext4_ext_drop_refs);
164 +
165 Index: linux-stage/fs/ext4/inode.c
166 ===================================================================
167 --- linux-stage.orig/fs/ext4/inode.c    2011-05-20 10:59:31.000000000 +0300
168 +++ linux-stage/fs/ext4/inode.c 2011-05-20 11:00:01.000000000 +0300
169 @@ -5249,6 +5249,7 @@ bad_inode:
170         iget_failed(inode);
171         return ERR_PTR(ret);
172  }
173 +EXPORT_SYMBOL(ext4_iget);
174  
175  static int ext4_inode_blocks_set(handle_t *handle,
176                                 struct ext4_inode *raw_inode,
177 Index: linux-stage/fs/ext4/mballoc.c
178 ===================================================================
179 --- linux-stage.orig/fs/ext4/mballoc.c  2011-05-20 10:59:32.000000000 +0300
180 +++ linux-stage/fs/ext4/mballoc.c       2011-05-20 11:00:01.000000000 +0300
181 @@ -4044,6 +4044,7 @@ repeat:
182         if (ac)
183                 kmem_cache_free(ext4_ac_cachep, ac);
184  }
185 +EXPORT_SYMBOL(ext4_discard_preallocations);
186  
187  /*
188   * finds all preallocated spaces and return blocks being freed to them
189 @@ -5029,3 +5030,6 @@ int ext4_trim_fs(struct super_block *sb,
190  
191         return ret;
192  }
193 +
194 +EXPORT_SYMBOL(ext4_free_blocks);
195 +
196 Index: linux-stage/fs/ext4/super.c
197 ===================================================================
198 --- linux-stage.orig/fs/ext4/super.c    2011-05-20 10:59:31.000000000 +0300
199 +++ linux-stage/fs/ext4/super.c 2011-05-20 11:00:01.000000000 +0300
200 @@ -128,6 +128,7 @@ __u32 ext4_itable_unused_count(struct su
201                 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
202                  (__u32)le16_to_cpu(bg->bg_itable_unused_hi) << 16 : 0);
203  }
204 +EXPORT_SYMBOL(ext4_itable_unused_count);
205  
206  void ext4_block_bitmap_set(struct super_block *sb,
207                            struct ext4_group_desc *bg, ext4_fsblk_t blk)
208 @@ -1500,11 +1501,13 @@ enum {
209         Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
210         Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota,
211         Opt_noquota, Opt_ignore, Opt_barrier, Opt_nobarrier, Opt_err,
212 +       Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
213         Opt_resize, Opt_usrquota, Opt_grpquota, Opt_i_version,
214         Opt_stripe, Opt_delalloc, Opt_nodelalloc,
215         Opt_block_validity, Opt_noblock_validity,
216         Opt_inode_readahead_blks, Opt_journal_ioprio,
217         Opt_discard, Opt_nodiscard,
218 +       Opt_mballoc,
219  };
220  
221  static const match_table_t tokens = {
222 @@ -1556,6 +1559,9 @@ static const match_table_t tokens = {
223         {Opt_noquota, "noquota"},
224         {Opt_quota, "quota"},
225         {Opt_usrquota, "usrquota"},
226 +       {Opt_iopen, "iopen"},
227 +       {Opt_noiopen, "noiopen"},
228 +       {Opt_iopen_nopriv, "iopen_nopriv"},
229         {Opt_barrier, "barrier=%u"},
230         {Opt_barrier, "barrier"},
231         {Opt_nobarrier, "nobarrier"},
232 @@ -1571,6 +1577,7 @@ static const match_table_t tokens = {
233         {Opt_auto_da_alloc, "auto_da_alloc=%u"},
234         {Opt_auto_da_alloc, "auto_da_alloc"},
235         {Opt_noauto_da_alloc, "noauto_da_alloc"},
236 +       {Opt_mballoc, "mballoc"},
237         {Opt_discard, "discard"},
238         {Opt_nodiscard, "nodiscard"},
239         {Opt_err, NULL},
240 @@ -1928,6 +1935,10 @@ set_qf_format:
241                         else
242                                 clear_opt(sbi->s_mount_opt, BARRIER);
243                         break;
244 +               case Opt_iopen:
245 +               case Opt_noiopen:
246 +               case Opt_iopen_nopriv:
247 +                       break;
248                 case Opt_ignore:
249                         break;
250                 case Opt_resize:
251 @@ -2011,6 +2022,8 @@ set_qf_format:
252                 case Opt_nodiscard:
253                         clear_opt(sbi->s_mount_opt, DISCARD);
254                         break;
255 +               case Opt_mballoc:
256 +                       break;
257                 default:
258                         ext4_msg(sb, KERN_ERR,
259                                "Unrecognized mount option \"%s\" "