Whamcloud - gitweb
b=21610 Update to sles11 sp1 latest kernel 2.6.32.19-0.2.
[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,11 @@
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 +#define ext4_journal_dirty_metadata(handle, bh)  \
13 +                ext4_handle_dirty_metadata(handle, NULL, bh)
14  /* Extended attribute operations touch at most two data buffers,
15   * two bitmap buffers, and two group summaries, in addition to the inode
16   * and the superblock, which are already accounted for. */
17 Index: linux-2.6.27.21-0.1/fs/ext4/extents.c
18 ===================================================================
19 --- linux-2.6.27.21-0.1.orig/fs/ext4/extents.c  2009-07-07 14:47:19.000000000 +0530
20 +++ linux-2.6.27.21-0.1/fs/ext4/extents.c       2009-07-07 14:48:03.000000000 +0530
21 @@ -58,6 +58,17 @@
22  }
23  
24  /*
25 + * ext4_ext_store_pblock:
26 + * stores a large physical block number into an extent struct,
27 + * breaking it into parts
28 + */
29 +void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb)
30 +{
31 +       ex->ee_start_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff));
32 +       ex->ee_start_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff);
33 +}
34 +
35 +/*
36   * idx_pblock:
37   * combine low and high parts of a leaf physical block number into ext4_fsblk_t
38   */
39 @@ -71,17 +82,6 @@
40  }
41  
42  /*
43 - * ext4_ext_store_pblock:
44 - * stores a large physical block number into an extent struct,
45 - * breaking it into parts
46 - */
47 -void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb)
48 -{
49 -       ex->ee_start_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff));
50 -       ex->ee_start_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff);
51 -}
52 -
53 -/*
54   * ext4_idx_store_pblock:
55   * stores a large physical block number into an index struct,
56   * breaking it into parts
57 @@ -1852,6 +1852,56 @@
58  }
59  
60  /*
61 + * This routine returns max. credits extent tree can consume.
62 + * It should be OK for low-performance paths like ->writepage()
63 + * To allow many writing process to fit a single transaction,
64 + * caller should calculate credits under truncate_mutex and
65 + * pass actual path.
66 + */
67 +int ext4_ext_calc_credits_for_insert(struct inode *inode,
68 +                                   struct ext4_ext_path *path)
69 +{
70 +       int depth, needed;
71 +
72 +       if (path) {
73 +               /* probably there is space in leaf? */
74 +               depth = ext_depth(inode);
75 +               if (le16_to_cpu(path[depth].p_hdr->eh_entries)
76 +                               < le16_to_cpu(path[depth].p_hdr->eh_max))
77 +                       return 1;
78 +       }
79 +
80 +       /*
81 +        * given 32bit logical block (4294967296 blocks), max. tree
82 +        * can be 4 levels in depth -- 4 * 340^4 == 53453440000.
83 +        * let's also add one more level for imbalance.
84 +        */
85 +       depth = 5;
86 +
87 +       /* allocation of new data block(s) */
88 +       needed = 2;
89 +
90 +       /*
91 +        * tree can be full, so it'd need to grow in depth:
92 +        * we need one credit to modify old root, credits for
93 +        * new root will be added in split accounting
94 +        */
95 +       needed += 1;
96 +
97 +       /*
98 +        * Index split can happen, we'd need:
99 +        *    allocate intermediate indexes (bitmap + group)
100 +        *  + change two blocks at each level, but root (already included)
101 +        */
102 +       needed += (depth * 2) + (depth * 2);
103 +
104 +       /* any allocation modifies superblock */
105 +       needed += 1;
106 +
107 +       return needed;
108 +}
109 +
110 +/*
111   * ext4_ext_calc_credits_for_single_extent:
112   * This routine returns max. credits that needed to insert an extent
113   * to the extent tree.
114 @@ -3171,3 +3221,14 @@
115         return error;
116  }
117
118 +
119 +EXPORT_SYMBOL(ext4_ext_store_pblock);
120 +EXPORT_SYMBOL(ext4_ext_search_right);
121 +EXPORT_SYMBOL(ext4_ext_search_left);
122 +EXPORT_SYMBOL(ext_pblock);
123 +EXPORT_SYMBOL(ext4_ext_insert_extent);
124 +EXPORT_SYMBOL(ext4_mb_new_blocks);
125 +EXPORT_SYMBOL(ext4_ext_calc_credits_for_insert);
126 +EXPORT_SYMBOL(ext4_mark_inode_dirty);
127 +EXPORT_SYMBOL(ext4_ext_walk_space);
128 +
129 Index: linux-2.6.27.21-0.1/fs/ext4/ext4_extents.h
130 ===================================================================
131 --- linux-2.6.27.21-0.1.orig/fs/ext4/ext4_extents.h     2009-07-07 14:47:19.000000000 +0530
132 +++ linux-2.6.27.21-0.1/fs/ext4/ext4_extents.h  2009-07-07 14:47:22.000000000 +0530
133 @@ -59,6 +59,11 @@
134   */
135  #define EXT_STATS_
136  
137 +/*
138 + * define EXT4_ALLOC_NEEDED to 0 since block bitmap, group desc. and sb
139 + * are now accounted in ext4_ext_calc_credits_for_insert()
140 + */
141 +#define EXT4_ALLOC_NEEDED 0
142  
143  /*
144   * ext4_inode has i_block array (60 bytes total).
145 @@ -124,6 +129,8 @@
146  #define EXT4_EXT_CACHE_GAP     1
147  #define EXT4_EXT_CACHE_EXTENT  2
148  
149 +#define EXT4_EXT_HAS_NO_TREE  /* ext4_extents_tree struct is not used*/
150 +
151  /*
152   * to be called by ext4_ext_walk_space()
153   * negative retcode - error
154 @@ -223,6 +229,8 @@
155  extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *);
156  extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t);
157  extern int ext4_extent_tree_init(handle_t *, struct inode *);
158 +extern int ext4_ext_calc_credits_for_insert(struct inode *,
159 +                                           struct ext4_ext_path *);
160  extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode,
161                                                    int num,
162                                                    struct ext4_ext_path *path);
163 Index: linux-2.6.27.21-0.1/fs/ext4/mballoc.c
164 ===================================================================
165 --- linux-2.6.27.21-0.1.orig/fs/ext4/mballoc.c  2009-07-07 14:47:19.000000000 +0530
166 +++ linux-2.6.27.21-0.1/fs/ext4/mballoc.c       2009-07-07 14:47:22.000000000 +0530
167 @@ -4355,6 +4355,13 @@
168                 kmem_cache_free(ext4_ac_cachep, ac);
169  }
170  
171 +/* For backward compatibility, since Lustre uses this symbol */
172 +void ext4_mb_discard_inode_preallocations(struct inode *inode)
173 +{
174 +       ext4_discard_preallocations(inode);
175 +}
176 +EXPORT_SYMBOL(ext4_mb_discard_inode_preallocations);
177 +
178  /*
179   * finds all preallocated spaces and return blocks being freed to them
180   * if preallocated space becomes full (no block is used from the space)
181 @@ -5177,3 +5184,6 @@
182                 kmem_cache_free(ext4_ac_cachep, ac);
183         return;
184  }
185 +
186 +EXPORT_SYMBOL(ext4_free_blocks);
187 +
188 Index: linux-2.6.27.21-0.1/fs/ext4/super.c
189 ===================================================================
190 --- linux-2.6.27.21-0.1.orig/fs/ext4/super.c    2009-07-07 14:47:19.000000000 +0530
191 +++ linux-2.6.27.21-0.1/fs/ext4/super.c 2009-07-07 14:48:53.000000000 +0530
192 @@ -91,6 +91,7 @@
193                 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
194                  (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_bitmap_hi) << 32 : 0);
195  }
196 +EXPORT_SYMBOL(ext4_inode_bitmap);
197  
198  ext4_fsblk_t ext4_inode_table(struct super_block *sb,
199                               struct ext4_group_desc *bg)
200 @@ -1286,6 +1287,7 @@
201         Opt_inode_readahead_blks, Opt_journal_ioprio,
202         Opt_discard, Opt_nodiscard, Opt_bigendian_extents,
203         Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
204 +       Opt_mballoc, Opt_extents,
205  };
206
207  
208 @@ -1346,6 +1348,8 @@
209         {Opt_discard, "discard"},
210         {Opt_nodiscard, "nodiscard"},
211         {Opt_bigendian_extents, "bigendian_extents"},
212 +       {Opt_extents, "extents"},
213 +       {Opt_mballoc, "mballoc"},
214         {Opt_err, NULL},
215  };
216  
217 @@ -1768,6 +1771,9 @@
218                 case Opt_bigendian_extents:
219                         bigendian_extents = 1;
220                         break;
221 +               case Opt_mballoc:
222 +               case Opt_extents:
223 +                       break;
224                 default:
225                         ext4_msg(sb, KERN_ERR,
226                                "Unrecognized mount option \"%s\" "
227 @@ -1968,7 +1971,7 @@
228         ext4_commit_super(sb, 1);
229         if (test_opt(sb, DEBUG))
230                 printk(KERN_INFO "[EXT4 FS bs=%lu, gc=%u, "
231 -                               "bpg=%lu, ipg=%lu, mo=%04x]\n",
232 +                               "bpg=%lu, ipg=%lu, mo=%04llx]\n",
233                         sb->s_blocksize,
234                         sbi->s_groups_count,
235                         EXT4_BLOCKS_PER_GROUP(sb),
236 Index: linux-2.6.27.21-0.1/fs/ext4/ext4_jbd2.c
237 ===================================================================
238 --- linux-2.6.27.21-0.1.orig/fs/ext4/ext4_jbd2.c        2009-07-07 14:47:19.000000000 +0530
239 +++ linux-2.6.27.21-0.1/fs/ext4/ext4_jbd2.c     2009-07-07 14:47:22.000000000 +0530
240 @@ -21,6 +21,7 @@
241                 ext4_journal_abort_handle(where, __func__, bh, handle, err);
242         return err;
243  }
244 +EXPORT_SYMBOL(__ext4_journal_get_write_access);
245  
246  int __ext4_journal_forget(const char *where, handle_t *handle,
247                                 struct buffer_head *bh)
248 @@ -57,3 +58,4 @@
249                 ext4_journal_abort_handle(where, __func__, bh, handle, err);
250         return err;
251  }
252 +EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
253 Index: linux-2.6.27.21-0.1/fs/ext4/ext4.h
254 ===================================================================
255 --- linux-2.6.27.21-0.1.orig/fs/ext4/ext4.h     2009-07-07 14:47:19.000000000 +0530
256 +++ linux-2.6.27.21-0.1/fs/ext4/ext4.h  2009-07-07 14:47:22.000000000 +0530
257 @@ -26,6 +26,11 @@
258   * The fourth extended filesystem constants/structures
259   */
260  
261 +/* Has been moved to linux/magic.h but we need it for Lustre */
262 +#define EXT4_SUPER_MAGIC       0xEF53
263 +
264 +#define HAVE_EXT_PREPARE_CB_EXTENT
265 +#define EXT_INSERT_EXTENT_WITH_5ARGS
266  /*
267   * Define EXT4FS_DEBUG to produce debug messages
268   */
269 @@ -425,7 +425,7 @@
270   *  Mount options
271   */
272  struct ext4_mount_options {
273 -       unsigned long s_mount_opt;
274 +       unsigned long long s_mount_opt;
275         uid_t s_resuid;
276         gid_t s_resgid;
277         unsigned long s_commit_interval;
278 @@ -1020,6 +1020,8 @@
279  
280         __le32  i_version_hi;   /* high 32 bits for 64-bit version */
281  };
282 +/* SLES11 kernel already has 64-bit inode->i_version field */
283 +#define HAVE_DISK_INODE_VERSION
284  
285  struct move_extent {
286         __u32 reserved;         /* should be zero */
287 @@ -1023,7 +1028,7 @@
288         struct buffer_head * s_sbh;     /* Buffer containing the super block */
289         struct ldiskfs_super_block *s_es;       /* Pointer to the super block in the buffer */
290         struct buffer_head **s_group_desc;
291 -       unsigned int s_mount_opt;
292 +       unsigned long long s_mount_opt;      /* lustre need more options */
293         unsigned int s_mount_flags;
294         ldiskfs_fsblk_t s_sb_block;
295         uid_t s_resuid;
296 @@ -1123,6 +1128,8 @@
297  extern int ext4_mb_get_buddy_cache_lock(struct super_block *, ext4_group_t);
298  extern void ext4_mb_put_buddy_cache_lock(struct super_block *,
299                                                 ext4_group_t, int);
300 +extern void ext4_mb_discard_inode_preallocations(struct inode *);
301 +
302  /* inode.c */
303  int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
304                 struct buffer_head *bh, ext4_fsblk_t blocknr);
305 Index: linux-2.6.27.21-0.1/fs/ext4/inode.c
306 ===================================================================
307 --- linux-2.6.27.21-0.1.orig/fs/ext4/inode.c    2009-07-07 14:47:19.000000000 +0530
308 +++ linux-2.6.27.21-0.1/fs/ext4/inode.c 2009-07-07 14:47:22.000000000 +0530
309 @@ -4240,6 +4240,7 @@
310         iget_failed(inode);
311         return ERR_PTR(ret);
312  }
313 +EXPORT_SYMBOL(ext4_iget);
314  
315  static int ext4_inode_blocks_set(handle_t *handle,
316                                 struct ext4_inode *raw_inode,
317 --- /dev/null   2009-09-21 17:11:24.467285554 +0800
318 +++ linux-2.6.27.21-0.1/fs/ext4/fiemap.h
319 @@ -0,0 +1,3 @@
320 +
321 +#include_next <fiemap.h>
322 +
323 --- linux/fs/ext4/move_extent.c
324 +++ linux/fs/ext4/move_extent.c
325 @@ -483,7 +483,7 @@
326
327         o_start = o_end = oext = orig_path[depth].p_ext;
328         oext_alen = ext4_ext_get_actual_len(oext);
329 -       start_ext.ee_len = end_ext.ee_len = 0;
330 +       start_ext.ee_block = start_ext.ee_len = end_ext.ee_len = 0;
331
332         new_ext.ee_block = cpu_to_le32(*from);
333         ext4_ext_store_pblock(&new_ext, ext_pblock(dext));