1 Index: linux-stage/fs/ext4/ext4_jbd2.h
2 ===================================================================
3 --- linux-stage.orig/fs/ext4/ext4_jbd2.h 2011-04-01 09:35:54.779619166 +0800
4 +++ linux-stage/fs/ext4/ext4_jbd2.h 2011-04-01 10:55:10.328938378 +0800
6 (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS) \
9 +#define ext4_journal_dirty_metadata(handle, bh) \
10 + ext4_handle_dirty_metadata(handle, NULL, bh)
11 /* Extended attribute operations touch at most two data buffers,
12 * two bitmap buffers, and two group summaries, in addition to the inode
13 * and the superblock, which are already accounted for. */
14 Index: linux-stage/fs/ext4/ext4_extents.h
15 ===================================================================
16 --- linux-stage.orig/fs/ext4/ext4_extents.h 2011-04-01 09:35:55.688621923 +0800
17 +++ linux-stage/fs/ext4/ext4_extents.h 2011-04-01 09:35:57.573627638 +0800
23 + * define EXT4_ALLOC_NEEDED to 0 since block bitmap, group desc. and sb
24 + * are now accounted in ext4_ext_calc_credits_for_insert()
26 +#define EXT4_ALLOC_NEEDED 0
27 +#define HAVE_EXT_PREPARE_CB_EXTENT
30 * ext4_inode has i_block array (60 bytes total).
32 #define EXT_INIT_MAX_LEN (1UL << 15)
33 #define EXT_UNINIT_MAX_LEN (EXT_INIT_MAX_LEN - 1)
35 +#define EXT4_EXT_HAS_NO_TREE /* ext4_extents_tree struct is not used*/
37 #define EXT_FIRST_EXTENT(__hdr__) \
38 ((struct ext4_extent *) (((char *) (__hdr__)) + \
40 extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode,
42 struct ext4_ext_path *path);
43 +extern int ext4_ext_calc_credits_for_insert(struct inode *,
44 + struct ext4_ext_path *);
45 extern int ext4_can_extents_be_merged(struct inode *inode,
46 struct ext4_extent *ex1,
47 struct ext4_extent *ex2);
48 Index: linux-stage/fs/ext4/mballoc.c
49 ===================================================================
50 --- linux-stage.orig/fs/ext4/mballoc.c 2011-04-01 09:35:57.382627058 +0800
51 +++ linux-stage/fs/ext4/mballoc.c 2011-04-01 10:55:08.194931915 +0800
54 kmem_cache_free(ext4_ac_cachep, ac);
56 +EXPORT_SYMBOL(ext4_discard_preallocations);
59 * finds all preallocated spaces and return blocks being freed to them
61 kmem_cache_free(ext4_ac_cachep, ac);
65 +EXPORT_SYMBOL(ext4_free_blocks);
67 Index: linux-stage/fs/ext4/super.c
68 ===================================================================
69 --- linux-stage.orig/fs/ext4/super.c 2011-04-01 09:35:57.207626528 +0800
70 +++ linux-stage/fs/ext4/super.c 2011-04-01 10:57:29.490360042 +0800
72 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
73 (__u32)le16_to_cpu(bg->bg_itable_unused_hi) << 16 : 0);
75 +EXPORT_SYMBOL(ext4_itable_unused_count);
77 void ext4_block_bitmap_set(struct super_block *sb,
78 struct ext4_group_desc *bg, ext4_fsblk_t blk)
79 @@ -1486,11 +1487,13 @@
80 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
81 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota,
82 Opt_noquota, Opt_ignore, Opt_barrier, Opt_nobarrier, Opt_err,
83 + Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
84 Opt_resize, Opt_usrquota, Opt_grpquota, Opt_i_version,
85 Opt_stripe, Opt_delalloc, Opt_nodelalloc,
86 Opt_block_validity, Opt_noblock_validity,
87 Opt_inode_readahead_blks, Opt_journal_ioprio,
88 Opt_discard, Opt_nodiscard,
92 static const match_table_t tokens = {
94 {Opt_noquota, "noquota"},
96 {Opt_usrquota, "usrquota"},
97 + {Opt_iopen, "iopen"},
98 + {Opt_noiopen, "noiopen"},
99 + {Opt_iopen_nopriv, "iopen_nopriv"},
100 {Opt_barrier, "barrier=%u"},
101 {Opt_barrier, "barrier"},
102 {Opt_nobarrier, "nobarrier"},
103 @@ -1557,6 +1563,7 @@
104 {Opt_auto_da_alloc, "auto_da_alloc=%u"},
105 {Opt_auto_da_alloc, "auto_da_alloc"},
106 {Opt_noauto_da_alloc, "noauto_da_alloc"},
107 + {Opt_mballoc, "mballoc"},
108 {Opt_discard, "discard"},
109 {Opt_nodiscard, "nodiscard"},
111 @@ -1914,6 +1921,10 @@
113 clear_opt(sbi->s_mount_opt, BARRIER);
117 + case Opt_iopen_nopriv:
122 @@ -1997,6 +2008,8 @@
124 clear_opt(sbi->s_mount_opt, DISCARD);
129 ext4_msg(sb, KERN_ERR,
130 "Unrecognized mount option \"%s\" "
131 Index: linux-stage/fs/ext4/ext4_jbd2.c
132 ===================================================================
133 --- linux-stage.orig/fs/ext4/ext4_jbd2.c 2011-04-01 09:35:54.145617245 +0800
134 +++ linux-stage/fs/ext4/ext4_jbd2.c 2011-04-01 09:35:57.678627955 +0800
139 +EXPORT_SYMBOL(__ext4_journal_get_write_access);
141 int __ext4_journal_forget(const char *where, handle_t *handle,
142 struct buffer_head *bh)
147 +EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
148 Index: linux-stage/fs/ext4/ext4.h
149 ===================================================================
150 --- linux-stage.orig/fs/ext4/ext4.h 2011-04-01 09:35:57.349626959 +0800
151 +++ linux-stage/fs/ext4/ext4.h 2011-04-01 10:55:17.605960429 +0800
152 @@ -1110,6 +1110,9 @@
154 #define NEXT_ORPHAN(inode) EXT4_I(inode)->i_dtime
156 +/* Has been moved to linux/magic.h but we need it for Lustre */
157 +#define EXT4_SUPER_MAGIC 0xEF53
160 * Codes for operating systems
162 @@ -1528,6 +1531,8 @@
163 extern int ext4_mb_get_buddy_cache_lock(struct super_block *, ext4_group_t);
164 extern void ext4_mb_put_buddy_cache_lock(struct super_block *,
166 +extern void ext4_mb_discard_inode_preallocations(struct inode *);
169 int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
170 struct buffer_head *bh, ext4_fsblk_t blocknr);
171 Index: linux-stage/fs/ext4/inode.c
172 ===================================================================
173 --- linux-stage.orig/fs/ext4/inode.c 2011-04-01 09:35:55.884622516 +0800
174 +++ linux-stage/fs/ext4/inode.c 2011-04-01 09:35:57.750628175 +0800
175 @@ -5199,6 +5199,7 @@
179 +EXPORT_SYMBOL(ext4_iget);
181 static int ext4_inode_blocks_set(handle_t *handle,
182 struct ext4_inode *raw_inode,
183 Index: linux-stage/fs/ext4/extents.c
184 ===================================================================
185 --- linux-stage.orig/fs/ext4/extents.c 2011-04-01 09:35:55.753622118 +0800
186 +++ linux-stage/fs/ext4/extents.c 2011-04-01 10:55:10.320938356 +0800
187 @@ -1866,9 +1866,7 @@
188 while (block < last && block != EXT_MAX_BLOCK) {
190 /* find extent for this block */
191 - down_read(&EXT4_I(inode)->i_data_sem);
192 path = ext4_ext_find_extent(inode, block, path);
193 - up_read(&EXT4_I(inode)->i_data_sem);
197 @@ -1965,6 +1963,7 @@
201 +EXPORT_SYMBOL(ext4_ext_walk_space);
204 ext4_ext_put_in_cache(struct inode *inode, ext4_lblk_t block,
205 @@ -2133,6 +2132,55 @@
209 + * This routine returns max. credits extent tree can consume.
210 + * It should be OK for low-performance paths like ->writepage()
211 + * To allow many writing process to fit a single transaction,
212 + * caller should calculate credits under truncate_mutex and
213 + * pass actual path.
215 +int ext4_ext_calc_credits_for_insert(struct inode *inode,
216 + struct ext4_ext_path *path)
221 + /* probably there is space in leaf? */
222 + depth = ext_depth(inode);
223 + if (le16_to_cpu(path[depth].p_hdr->eh_entries)
224 + < le16_to_cpu(path[depth].p_hdr->eh_max))
229 + * given 32bit logical block (4294967296 blocks), max. tree
230 + * can be 4 levels in depth -- 4 * 340^4 == 53453440000.
231 + * let's also add one more level for imbalance.
235 + /* allocation of new data block(s) */
239 + * tree can be full, so it'd need to grow in depth:
240 + * we need one credit to modify old root, credits for
241 + * new root will be added in split accounting
245 + * Index split can happen, we'd need:
246 + * allocate intermediate indexes (bitmap + group)
247 + * + change two blocks at each level, but root (already included)
249 + needed += (depth * 2) + (depth * 2);
251 + /* any allocation modifies superblock */
258 * How many index/leaf blocks need to change/allocate to modify nrblocks?
260 * if nrblocks are fit in a single extent (chunk flag is 1), then
261 @@ -3934,10 +3982,21 @@
262 * Walk the extent tree gathering extent information.
263 * ext4_ext_fiemap_cb will push extents back to user.
265 + down_read(&EXT4_I(inode)->i_data_sem);
266 error = ext4_ext_walk_space(inode, start_blk, len_blks,
267 ext4_ext_fiemap_cb, fieinfo);
268 + up_read(&EXT4_I(inode)->i_data_sem);
274 +EXPORT_SYMBOL(ext4_ext_store_pblock);
275 +EXPORT_SYMBOL(ext4_ext_search_right);
276 +EXPORT_SYMBOL(ext4_ext_search_left);
277 +EXPORT_SYMBOL(ext_pblock);
278 +EXPORT_SYMBOL(ext4_ext_insert_extent);
279 +EXPORT_SYMBOL(ext4_mb_new_blocks);
280 +EXPORT_SYMBOL(ext4_ext_calc_credits_for_insert);
281 +EXPORT_SYMBOL(ext4_mark_inode_dirty);