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
6 (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS) \
7 || test_opt(sb, EXTENTS) ? 27U : 8U)
9 +/* Indicate that EXT4_SINGLEDATA_TRANS_BLOCKS takes the sb as argument */
10 +#define EXT4_SINGLEDATA_TRANS_BLOCKS_HAS_SB
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
25 + * ext4_ext_store_pblock:
26 + * stores a large physical block number into an extent struct,
27 + * breaking it into parts
29 +void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb)
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);
37 * combine low and high parts of a leaf physical block number into ext4_fsblk_t
43 - * ext4_ext_store_pblock:
44 - * stores a large physical block number into an extent struct,
45 - * breaking it into parts
47 -void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb)
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);
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 @@
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
67 +int ext4_ext_calc_credits_for_insert(struct inode *inode,
68 + struct ext4_ext_path *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))
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.
87 + /* allocation of new data block(s) */
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
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)
102 + needed += (depth * 2) + (depth * 2);
104 + /* any allocation modifies superblock */
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 @@
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);
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
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()
141 +#define EXT4_ALLOC_NEEDED 0
144 * ext4_inode has i_block array (60 bytes total).
146 #define EXT4_EXT_CACHE_GAP 1
147 #define EXT4_EXT_CACHE_EXTENT 2
149 +#define EXT4_EXT_HAS_NO_TREE /* ext4_extents_tree struct is not used*/
152 * to be called by ext4_ext_walk_space()
153 * negative retcode - error
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,
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);
171 +/* For backward compatibility, since Lustre uses this symbol */
172 +void ext4_mb_discard_inode_preallocations(struct inode *inode)
174 + ext4_discard_preallocations(inode);
176 +EXPORT_SYMBOL(ext4_mb_discard_inode_preallocations);
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);
186 +EXPORT_SYMBOL(ext4_free_blocks);
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
193 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
194 (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_bitmap_hi) << 32 : 0);
196 +EXPORT_SYMBOL(ext4_inode_bitmap);
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,
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"},
217 @@ -1768,6 +1771,9 @@
218 case Opt_bigendian_extents:
219 bigendian_extents = 1;
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",
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
241 ext4_journal_abort_handle(where, __func__, bh, handle, err);
244 +EXPORT_SYMBOL(__ext4_journal_get_write_access);
246 int __ext4_journal_forget(const char *where, handle_t *handle,
247 struct buffer_head *bh)
249 ext4_journal_abort_handle(where, __func__, bh, handle, err);
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
258 * The fourth extended filesystem constants/structures
261 +/* Has been moved to linux/magic.h but we need it for Lustre */
262 +#define EXT4_SUPER_MAGIC 0xEF53
264 +#define HAVE_EXT_PREPARE_CB_EXTENT
265 +#define EXT_INSERT_EXTENT_WITH_5ARGS
267 * Define EXT4FS_DEBUG to produce debug messages
272 struct ext4_mount_options {
273 - unsigned long s_mount_opt;
274 + unsigned long long s_mount_opt;
277 unsigned long s_commit_interval;
278 @@ -1020,6 +1020,8 @@
280 __le32 i_version_hi; /* high 32 bits for 64-bit version */
282 +/* SLES11 kernel already has 64-bit inode->i_version field */
283 +#define HAVE_DISK_INODE_VERSION
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;
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 *,
300 +extern void ext4_mb_discard_inode_preallocations(struct inode *);
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 @@
313 +EXPORT_SYMBOL(ext4_iget);
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
321 +#include_next <fiemap.h>
323 --- linux/fs/ext4/move_extent.c
324 +++ linux/fs/ext4/move_extent.c
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;
332 new_ext.ee_block = cpu_to_le32(*from);
333 ext4_ext_store_pblock(&new_ext, ext_pblock(dext));