1 Index: linux-2.6.18.i386/fs/ext4/ext4_jbd2.h
2 ===================================================================
3 --- linux-2.6.18.i386.orig/fs/ext4/ext4_jbd2.h
4 +++ linux-2.6.18.i386/fs/ext4/ext4_jbd2.h
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.18.i386/fs/ext4/extents.c
18 ===================================================================
19 --- linux-2.6.18.i386.orig/fs/ext4/extents.c
20 +++ linux-2.6.18.i386/fs/ext4/extents.c
23 * combine low and high parts of physical block number into ext4_fsblk_t
25 -static ext4_fsblk_t ext_pblock(struct ext4_extent *ex)
26 +ext4_fsblk_t ext_pblock(struct ext4_extent *ex)
30 @@ -60,6 +60,17 @@ static ext4_fsblk_t ext_pblock(struct ex
34 + * ext4_ext_store_pblock:
35 + * stores a large physical block number into an extent struct,
36 + * breaking it into parts
38 +void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb)
40 + ex->ee_start_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff));
41 + ex->ee_start_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff);
46 * combine low and high parts of a leaf physical block number into ext4_fsblk_t
48 @@ -73,17 +84,6 @@ ext4_fsblk_t idx_pblock(struct ext4_exte
52 - * ext4_ext_store_pblock:
53 - * stores a large physical block number into an extent struct,
54 - * breaking it into parts
56 -void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb)
58 - ex->ee_start_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff));
59 - ex->ee_start_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff);
63 * ext4_idx_store_pblock:
64 * stores a large physical block number into an index struct,
65 * breaking it into parts
66 @@ -1826,6 +1826,56 @@ static int ext4_ext_rm_idx(handle_t *han
70 + * This routine returns max. credits extent tree can consume.
71 + * It should be OK for low-performance paths like ->writepage()
72 + * To allow many writing process to fit a single transaction,
73 + * caller should calculate credits under truncate_mutex and
76 +int ext4_ext_calc_credits_for_insert(struct inode *inode,
77 + struct ext4_ext_path *path)
82 + /* probably there is space in leaf? */
83 + depth = ext_depth(inode);
84 + if (le16_to_cpu(path[depth].p_hdr->eh_entries)
85 + < le16_to_cpu(path[depth].p_hdr->eh_max))
90 + * given 32bit logical block (4294967296 blocks), max. tree
91 + * can be 4 levels in depth -- 4 * 340^4 == 53453440000.
92 + * let's also add one more level for imbalance.
96 + /* allocation of new data block(s) */
100 + * tree can be full, so it'd need to grow in depth:
101 + * we need one credit to modify old root, credits for
102 + * new root will be added in split accounting
107 + * Index split can happen, we'd need:
108 + * allocate intermediate indexes (bitmap + group)
109 + * + change two blocks at each level, but root (already included)
111 + needed += (depth * 2) + (depth * 2);
113 + /* any allocation modifies superblock */
120 * ext4_ext_calc_credits_for_single_extent:
121 * This routine returns max. credits that needed to insert an extent
122 * to the extent tree.
123 @@ -3157,4 +3207,14 @@ int ext4_fiemap(struct inode *inode, str
128 +EXPORT_SYMBOL(ext4_ext_store_pblock);
129 +EXPORT_SYMBOL(ext4_ext_search_right);
130 +EXPORT_SYMBOL(ext4_ext_search_left);
131 +EXPORT_SYMBOL(ext_pblock);
132 +EXPORT_SYMBOL(ext4_ext_insert_extent);
133 +EXPORT_SYMBOL(ext4_mb_new_blocks);
134 +EXPORT_SYMBOL(ext4_ext_walk_space);
135 +EXPORT_SYMBOL(ext4_ext_calc_credits_for_insert);
136 +EXPORT_SYMBOL(ext4_mark_inode_dirty);
138 Index: linux-2.6.18.i386/fs/ext4/ext4_extents.h
139 ===================================================================
140 --- linux-2.6.18.i386.orig/fs/ext4/ext4_extents.h
141 +++ linux-2.6.18.i386/fs/ext4/ext4_extents.h
147 + * define EXT4_ALLOC_NEEDED to 0 since block bitmap, group desc. and sb
148 + * are now accounted in ext4_ext_calc_credits_for_insert()
150 +#define EXT4_ALLOC_NEEDED 0
151 +#define HAVE_EXT_PREPARE_CB_EXTENT
154 * ext4_inode has i_block array (60 bytes total).
155 @@ -124,6 +129,7 @@ struct ext4_ext_path {
156 #define EXT4_EXT_CACHE_GAP 1
157 #define EXT4_EXT_CACHE_EXTENT 2
159 +#define EXT4_EXT_HAS_NO_TREE /* ext4_extents_tree struct is not used*/
161 #define EXT_MAX_BLOCK 0xffffffff
163 @@ -228,9 +234,12 @@ static inline int ext4_ext_get_actual_le
166 extern int ext4_ext_calc_metadata_amount(struct inode *inode, int blocks);
167 +extern ext4_fsblk_t ext_pblock(struct ext4_extent *ex);
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,
175 struct ext4_ext_path *path);
176 Index: linux-2.6.18.i386/fs/ext4/mballoc.c
177 ===================================================================
178 --- linux-2.6.18.i386.orig/fs/ext4/mballoc.c
179 +++ linux-2.6.18.i386/fs/ext4/mballoc.c
180 @@ -4355,6 +4355,13 @@
181 kmem_cache_free(ext4_ac_cachep, ac);
184 +/* For backward compatibility, since Lustre uses this symbol */
185 +void ext4_mb_discard_inode_preallocations(struct inode *inode)
187 + ext4_discard_preallocations(inode);
189 +EXPORT_SYMBOL(ext4_mb_discard_inode_preallocations);
192 * finds all preallocated spaces and return blocks being freed to them
193 * if preallocated space becomes full (no block is used from the space)
194 @@ -4965,3 +4965,6 @@ error_return:
195 kmem_cache_free(ext4_ac_cachep, ac);
199 +EXPORT_SYMBOL(ext4_free_blocks);
201 Index: linux-2.6.18.i386/fs/ext4/super.c
202 ===================================================================
203 --- linux-2.6.18.i386.orig/fs/ext4/super.c
204 +++ linux-2.6.18.i386/fs/ext4/super.c
205 @@ -91,6 +91,7 @@ ext4_fsblk_t ext4_inode_bitmap(struct su
206 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
207 (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_bitmap_hi) << 32 : 0);
209 +EXPORT_SYMBOL(ext4_inode_bitmap);
211 ext4_fsblk_t ext4_inode_table(struct super_block *sb,
212 struct ext4_group_desc *bg)
214 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
215 (__u32)le16_to_cpu(bg->bg_itable_unused_hi) << 16 : 0);
217 +EXPORT_SYMBOL(ext4_itable_unused_count);
219 void ext4_block_bitmap_set(struct super_block *sb,
220 struct ext4_group_desc *bg, ext4_fsblk_t blk)
221 Index: linux-2.6.18.i386/fs/ext4/ext4_jbd2.c
222 ===================================================================
223 --- linux-2.6.18.i386.orig/fs/ext4/ext4_jbd2.c
224 +++ linux-2.6.18.i386/fs/ext4/ext4_jbd2.c
225 @@ -21,6 +21,7 @@ int __ext4_journal_get_write_access(cons
226 ext4_journal_abort_handle(where, __func__, bh, handle, err);
229 +EXPORT_SYMBOL(__ext4_journal_get_write_access);
231 int __ext4_journal_forget(const char *where, handle_t *handle,
232 struct buffer_head *bh)
233 @@ -57,3 +58,4 @@ int __ext4_journal_dirty_metadata(const
234 ext4_journal_abort_handle(where, __func__, bh, handle, err);
237 +EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
238 Index: linux-2.6.27.21-0.1/fs/ext4/ext4.h
239 ===================================================================
240 --- linux-2.6.27.21-0.1.orig/fs/ext4/ext4.h 2009-07-07 14:47:19.000000000 +0530
241 +++ linux-2.6.27.21-0.1/fs/ext4/ext4.h 2009-07-07 14:47:22.000000000 +0530
242 @@ -1123,6 +1128,8 @@
243 extern int ext4_mb_get_buddy_cache_lock(struct super_block *, ext4_group_t);
244 extern void ext4_mb_put_buddy_cache_lock(struct super_block *,
246 +extern void ext4_mb_discard_inode_preallocations(struct inode *);
249 int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
250 struct buffer_head *bh, ext4_fsblk_t blocknr);
251 Index: linux-2.6.27.21-0.1/fs/ext4/inode.c
252 ===================================================================
253 --- linux-2.6.27.21-0.1.orig/fs/ext4/inode.c 2009-07-07 14:47:19.000000000 +0530
254 +++ linux-2.6.27.21-0.1/fs/ext4/inode.c 2009-07-07 14:47:22.000000000 +0530
255 @@ -4240,6 +4240,7 @@
259 +EXPORT_SYMBOL(ext4_iget);
261 static int ext4_inode_blocks_set(handle_t *handle,
262 struct ext4_inode *raw_inode,
263 Index: linux-2.6.27.21-0.1/fs/ext4/super.c
264 ===================================================================
265 --- linux-2.6.27.21-0.1.orig/fs/ext4/super.c 2009-07-07 14:47:19.000000000 +0530
266 +++ linux-2.6.27.21-0.1/fs/ext4/super.c 2009-07-07 14:48:53.000000000 +0530
267 @@ -1286,6 +1287,7 @@
268 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
269 Opt_ignore, Opt_barrier, Opt_nobarrier, Opt_err, Opt_resize,
270 Opt_usrquota, Opt_grpquota, Opt_i_version,
272 Opt_stripe, Opt_delalloc, Opt_nodelalloc,
273 Opt_inode_readahead_blks, Opt_journal_ioprio,
274 Opt_iopen, Opt_noiopen, Opt_iopen_nopriv, Opt_bigendian_extents,
275 @@ -1346,6 +1348,7 @@
276 {Opt_barrier, "barrier"},
277 {Opt_nobarrier, "nobarrier"},
278 {Opt_i_version, "i_version"},
279 + {Opt_mballoc, "mballoc"},
280 {Opt_stripe, "stripe=%u"},
281 {Opt_resize, "resize"},
282 {Opt_delalloc, "delalloc"},
283 @@ -1768,6 +1771,8 @@
284 case Opt_bigendian_extents:
285 bigendian_extents = 1;
291 "EXT4-fs: Unrecognized mount option \"%s\" "
292 Index: linux-2.6.27.21-0.1/fs/ext4/fsync.c
293 ===================================================================
294 --- linux-2.6.27.21-0.1.orig/fs/ext4/fsync.c 2009-07-07 14:47:19.000000000 +0530
295 +++ linux-2.6.27.21-0.1/fs/ext4/fsync.c 2009-07-07 14:48:53.000000000 +0530
296 @@ -1768,7 +1771,7 @@
298 trace_mark(ext4_sync_file, "dev %s datasync %d ino %ld parent %ld",
299 inode->i_sb->s_id, datasync, inode->i_ino,
300 - dentry->d_parent->d_inode->i_ino);