Whamcloud - gitweb
LU-1146 build: batch update copyright messages
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-misc-sles11.patch
1 Index: linux-2.6.27.21-0.1/fs/ext4/ext4_jbd2.h
2 ===================================================================
3 --- linux-2.6.27.21-0.1.orig/fs/ext4/ext4_jbd2.h        2009-07-07 14:47:19.000000000 +0530
4 +++ linux-2.6.27.21-0.1/fs/ext4/ext4_jbd2.h     2009-07-07 14:47:22.000000000 +0530
5 @@ -35,6 +35,9 @@
6         (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)   \
7                 || test_opt(sb, EXTENTS) ? 27U : 8U)
8  
9 +/* Indicate that EXT4_SINGLEDATA_TRANS_BLOCKS takes the sb as argument */
10 +#define EXT4_SINGLEDATA_TRANS_BLOCKS_HAS_SB
11 +
12  /* Extended attribute operations touch at most two data buffers,
13   * two bitmap buffers, and two group summaries, in addition to the inode
14   * and the superblock, which are already accounted for. */
15 Index: linux-2.6.27.21-0.1/fs/ext4/extents.c
16 ===================================================================
17 --- linux-2.6.27.21-0.1.orig/fs/ext4/extents.c  2009-07-07 14:47:19.000000000 +0530
18 +++ linux-2.6.27.21-0.1/fs/ext4/extents.c       2009-07-07 14:48:03.000000000 +0530
19 @@ -48,7 +48,7 @@
20   * ext_pblock:
21   * combine low and high parts of physical block number into ext4_fsblk_t
22   */
23 -static ext4_fsblk_t ext_pblock(struct ext4_extent *ex)
24 +ext4_fsblk_t ext_pblock(struct ext4_extent *ex)
25  {
26         ext4_fsblk_t block;
27  
28 @@ -58,6 +58,17 @@
29  }
30  
31  /*
32 + * ext4_ext_store_pblock:
33 + * stores a large physical block number into an extent struct,
34 + * breaking it into parts
35 + */
36 +void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb)
37 +{
38 +       ex->ee_start_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff));
39 +       ex->ee_start_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff);
40 +}
41 +
42 +/*
43   * idx_pblock:
44   * combine low and high parts of a leaf physical block number into ext4_fsblk_t
45   */
46 @@ -71,17 +82,6 @@
47  }
48  
49  /*
50 - * ext4_ext_store_pblock:
51 - * stores a large physical block number into an extent struct,
52 - * breaking it into parts
53 - */
54 -void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb)
55 -{
56 -       ex->ee_start_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff));
57 -       ex->ee_start_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff);
58 -}
59 -
60 -/*
61   * ext4_idx_store_pblock:
62   * stores a large physical block number into an index struct,
63   * breaking it into parts
64 @@ -1852,6 +1852,56 @@
65  }
66  
67  /*
68 + * This routine returns max. credits extent tree can consume.
69 + * It should be OK for low-performance paths like ->writepage()
70 + * To allow many writing process to fit a single transaction,
71 + * caller should calculate credits under truncate_mutex and
72 + * pass actual path.
73 + */
74 +int ext4_ext_calc_credits_for_insert(struct inode *inode,
75 +                                   struct ext4_ext_path *path)
76 +{
77 +       int depth, needed;
78 +
79 +       if (path) {
80 +               /* probably there is space in leaf? */
81 +               depth = ext_depth(inode);
82 +               if (le16_to_cpu(path[depth].p_hdr->eh_entries)
83 +                               < le16_to_cpu(path[depth].p_hdr->eh_max))
84 +                       return 1;
85 +       }
86 +
87 +       /*
88 +        * given 32bit logical block (4294967296 blocks), max. tree
89 +        * can be 4 levels in depth -- 4 * 340^4 == 53453440000.
90 +        * let's also add one more level for imbalance.
91 +        */
92 +       depth = 5;
93 +
94 +       /* allocation of new data block(s) */
95 +       needed = 2;
96 +
97 +       /*
98 +        * tree can be full, so it'd need to grow in depth:
99 +        * we need one credit to modify old root, credits for
100 +        * new root will be added in split accounting
101 +        */
102 +       needed += 1;
103 +
104 +       /*
105 +        * Index split can happen, we'd need:
106 +        *    allocate intermediate indexes (bitmap + group)
107 +        *  + change two blocks at each level, but root (already included)
108 +        */
109 +       needed += (depth * 2) + (depth * 2);
110 +
111 +       /* any allocation modifies superblock */
112 +       needed += 1;
113 +
114 +       return needed;
115 +}
116 +
117 +/*
118   * ext4_ext_calc_credits_for_single_extent:
119   * This routine returns max. credits that needed to insert an extent
120   * to the extent tree.
121 @@ -3171,3 +3221,15 @@
122  
123         return error;
124  }
125 +
126 +EXPORT_SYMBOL(ext4_ext_store_pblock);
127 +EXPORT_SYMBOL(ext4_ext_search_right);
128 +EXPORT_SYMBOL(ext4_ext_search_left);
129 +EXPORT_SYMBOL(ext_pblock);
130 +EXPORT_SYMBOL(ext4_ext_insert_extent);
131 +EXPORT_SYMBOL(ext4_mb_new_blocks);
132 +EXPORT_SYMBOL(ext4_ext_calc_credits_for_insert);
133 +EXPORT_SYMBOL(ext4_mark_inode_dirty);
134 +EXPORT_SYMBOL(ext4_ext_find_extent);
135 +EXPORT_SYMBOL(ext4_ext_drop_refs);
136 +
137 Index: linux-2.6.27.21-0.1/fs/ext4/ext4_extents.h
138 ===================================================================
139 --- linux-2.6.27.21-0.1.orig/fs/ext4/ext4_extents.h     2009-07-07 14:47:19.000000000 +0530
140 +++ linux-2.6.27.21-0.1/fs/ext4/ext4_extents.h  2009-07-07 14:47:22.000000000 +0530
141 @@ -59,6 +59,11 @@
142   */
143  #define EXT_STATS_
144  
145 +/*
146 + * define EXT4_ALLOC_NEEDED to 0 since block bitmap, group desc. and sb
147 + * are now accounted in ext4_ext_calc_credits_for_insert()
148 + */
149 +#define EXT4_ALLOC_NEEDED 0
150  
151  /*
152   * ext4_inode has i_block array (60 bytes total).
153 @@ -124,6 +129,7 @@
154  #define EXT4_EXT_CACHE_GAP     1
155  #define EXT4_EXT_CACHE_EXTENT  2
156  
157 +#define EXT4_EXT_HAS_NO_TREE  /* ext4_extents_tree struct is not used*/
158  
159  #define EXT_MAX_BLOCK  0xffffffff
160  
161 @@ -223,10 +229,14 @@
162                 (le16_to_cpu(ext->ee_len) - EXT_INIT_MAX_LEN));
163  }
164  
165 +extern ext4_fsblk_t ext_pblock(struct ext4_extent *ex);
166 +extern void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb);
167  extern int ext4_ext_calc_metadata_amount(struct inode *inode, int blocks);
168  extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *);
169  extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t);
170  extern int ext4_extent_tree_init(handle_t *, struct inode *);
171 +extern int ext4_ext_calc_credits_for_insert(struct inode *,
172 +                                           struct ext4_ext_path *);
173  extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode,
174                                                    int num,
175                                                    struct ext4_ext_path *path);
176 Index: linux-2.6.27.21-0.1/fs/ext4/mballoc.c
177 ===================================================================
178 --- linux-2.6.27.21-0.1.orig/fs/ext4/mballoc.c  2009-07-07 14:47:19.000000000 +0530
179 +++ linux-2.6.27.21-0.1/fs/ext4/mballoc.c       2009-07-07 14:47:22.000000000 +0530
180 @@ -4355,6 +4355,7 @@
181                 kmem_cache_free(ext4_ac_cachep, ac);
182  }
183 +EXPORT_SYMBOL(ext4_discard_preallocations);
184  
185  /*
186   * finds all preallocated spaces and return blocks being freed to them
187   * if preallocated space becomes full (no block is used from the space)
188 @@ -5177,3 +5184,6 @@
189                 kmem_cache_free(ext4_ac_cachep, ac);
190         return;
191  }
192 +
193 +EXPORT_SYMBOL(ext4_free_blocks);
194 +
195 Index: linux-2.6.27.21-0.1/fs/ext4/super.c
196 ===================================================================
197 --- linux-2.6.27.21-0.1.orig/fs/ext4/super.c    2009-07-07 14:47:19.000000000 +0530
198 +++ linux-2.6.27.21-0.1/fs/ext4/super.c 2009-07-07 14:48:53.000000000 +0530
199 @@ -91,6 +91,7 @@
200                 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
201                 (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_bitmap_hi) << 32 : 0);
202  }
203 +EXPORT_SYMBOL(ext4_inode_bitmap);
204  
205  ext4_fsblk_t ext4_inode_table(struct super_block *sb,
206                               struct ext4_group_desc *bg)
207 @@ -1286,6 +1287,7 @@
208         Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
209         Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota,
210         Opt_grpquota, Opt_extents, Opt_noextents, Opt_i_version,
211 +       Opt_mballoc,
212         Opt_stripe, Opt_delalloc, Opt_nodelalloc,
213         Opt_inode_readahead_blks, Opt_bigendian_extents,
214         Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
215 @@ -1346,6 +1348,7 @@
216         {Opt_i_version, "i_version"},
217         {Opt_stripe, "stripe=%u"},
218         {Opt_resize, "resize"},
219 +       {Opt_mballoc, "mballoc"},
220         {Opt_delalloc, "delalloc"},
221         {Opt_nodelalloc, "nodelalloc"},
222         {Opt_inode_readahead_blks, "inode_readahead_blks=%u"},
223 @@ -1768,6 +1771,8 @@
224                 case Opt_bigendian_extents:
225                         bigendian_extents = 1;
226                         break;
227 +               case Opt_mballoc:
228 +                       break;
229                 default:
230                         printk(KERN_ERR
231                                "EXT4-fs: Unrecognized mount option \"%s\" "
232 @@ -4094,7 +4099,7 @@
233         .kill_sb        = kill_block_super,
234         .fs_flags       = FS_REQUIRES_DEV,
235  };
236 -MODULE_ALIAS("ext4dev");
237 +MODULE_ALIAS("ext4");
238  
239  static int __init init_ext4_fs(void)
240  {
241 Index: linux-2.6.27.21-0.1/fs/ext4/ext4_jbd2.c
242 ===================================================================
243 --- linux-2.6.27.21-0.1.orig/fs/ext4/ext4_jbd2.c        2009-07-07 14:47:19.000000000 +0530
244 +++ linux-2.6.27.21-0.1/fs/ext4/ext4_jbd2.c     2009-07-07 14:47:22.000000000 +0530
245 @@ -21,6 +21,7 @@
246                 ext4_journal_abort_handle(where, __func__, bh, handle, err);
247         return err;
248  }
249 +EXPORT_SYMBOL(__ext4_journal_get_write_access);
250  
251  int __ext4_journal_forget(const char *where, handle_t *handle,
252                                 struct buffer_head *bh)
253 @@ -57,3 +58,4 @@
254                 ext4_journal_abort_handle(where, __func__, bh, handle, err);
255         return err;
256  }
257 +EXPORT_SYMBOL(__ext4_journal_dirty_metadata);
258 Index: linux-2.6.27.21-0.1/fs/ext4/ext4.h
259 ===================================================================
260 --- linux-2.6.27.21-0.1.orig/fs/ext4/ext4.h     2009-07-07 14:47:19.000000000 +0530
261 +++ linux-2.6.27.21-0.1/fs/ext4/ext4.h  2009-07-07 14:47:22.000000000 +0530
262 @@ -26,6 +26,9 @@
263   * The fourth extended filesystem constants/structures
264   */
265  
266 +/* Has been moved to linux/magic.h but we need it for Lustre */
267 +#define EXT4_SUPER_MAGIC       0xEF53
268 +
269  /*
270   * Define EXT4FS_DEBUG to produce debug messages
271   */
272 @@ -400,6 +403,8 @@
273         __le32  i_version_hi;   /* high 32 bits for 64-bit version */
274  };
275  
276 +/* SLES11 kernel already has 64-bit inode->i_version field */
277 +#define HAVE_DISK_INODE_VERSION
278  
279  #define EXT4_EPOCH_BITS 2
280  #define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1)
281 @@ -1123,6 +1128,8 @@
282  extern int ext4_mb_get_buddy_cache_lock(struct super_block *, ext4_group_t);
283  extern void ext4_mb_put_buddy_cache_lock(struct super_block *,
284                                                 ext4_group_t, int);
285 +extern void ext4_mb_discard_inode_preallocations(struct inode *);
286 +
287  /* inode.c */
288  int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
289                 struct buffer_head *bh, ext4_fsblk_t blocknr);
290 Index: linux-2.6.27.21-0.1/fs/ext4/inode.c
291 ===================================================================
292 --- linux-2.6.27.21-0.1.orig/fs/ext4/inode.c    2009-07-07 14:47:19.000000000 +0530
293 +++ linux-2.6.27.21-0.1/fs/ext4/inode.c 2009-07-07 14:47:22.000000000 +0530
294 @@ -4240,6 +4240,7 @@
295         iget_failed(inode);
296         return ERR_PTR(ret);
297  }
298 +EXPORT_SYMBOL(ext4_iget);
299  
300  static int ext4_inode_blocks_set(handle_t *handle,
301                                 struct ext4_inode *raw_inode,