1 Index: linux-stage/fs/ext4/ext4.h
2 ===================================================================
3 --- linux-stage.orig/fs/ext4/ext4.h 2011-05-20 10:59:32.000000000 +0300
4 +++ linux-stage/fs/ext4/ext4.h 2011-05-20 11:01:06.000000000 +0300
5 @@ -1191,6 +1191,9 @@ EXT4_INODE_BIT_FNS(state, state_flags)
7 #define NEXT_ORPHAN(inode) EXT4_I(inode)->i_dtime
9 +/* Has been moved to linux/magic.h but we need it for Lustre */
10 +#define EXT4_SUPER_MAGIC 0xEF53
13 * Codes for operating systems
15 @@ -1630,6 +1633,9 @@ extern void ext4_mb_put_buddy_cache_lock
17 extern int ext4_trim_fs(struct super_block *, struct fstrim_range *);
19 +extern void ext4_mb_discard_inode_preallocations(struct inode *);
23 int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
24 struct buffer_head *bh, ext4_fsblk_t blocknr);
25 Index: linux-stage/fs/ext4/ext4_extents.h
26 ===================================================================
27 --- linux-stage.orig/fs/ext4/ext4_extents.h 2011-05-20 10:59:30.000000000 +0300
28 +++ linux-stage/fs/ext4/ext4_extents.h 2011-05-20 11:00:01.000000000 +0300
34 + * define EXT4_ALLOC_NEEDED to 0 since block bitmap, group desc. and sb
35 + * are now accounted in ext4_ext_calc_credits_for_insert()
37 +#define EXT4_ALLOC_NEEDED 0
38 +#define HAVE_EXT_PREPARE_CB_EXTENT
41 * ext4_inode has i_block array (60 bytes total).
42 @@ -239,6 +245,8 @@ extern int ext4_extent_tree_init(handle_
43 extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode,
45 struct ext4_ext_path *path);
46 +extern int ext4_ext_calc_credits_for_insert(struct inode *,
47 + struct ext4_ext_path *);
48 extern int ext4_can_extents_be_merged(struct inode *inode,
49 struct ext4_extent *ex1,
50 struct ext4_extent *ex2);
51 Index: linux-stage/fs/ext4/ext4_jbd2.c
52 ===================================================================
53 --- linux-stage.orig/fs/ext4/ext4_jbd2.c 2011-05-20 10:59:29.000000000 +0300
54 +++ linux-stage/fs/ext4/ext4_jbd2.c 2011-05-20 11:00:01.000000000 +0300
55 @@ -31,6 +31,7 @@ int __ext4_journal_get_write_access(cons
59 +EXPORT_SYMBOL(__ext4_journal_get_write_access);
61 int __ext4_journal_forget(const char *where, handle_t *handle,
62 struct buffer_head *bh)
63 @@ -107,3 +108,4 @@ int __ext4_handle_dirty_metadata(const c
67 +EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
68 Index: linux-stage/fs/ext4/extents.c
69 ===================================================================
70 --- linux-stage.orig/fs/ext4/extents.c
71 +++ linux-stage/fs/ext4/extents.c
72 @@ -2133,6 +2133,55 @@ int ext4_ext_calc_credits_for_single_ext
76 + * This routine returns max. credits extent tree can consume.
77 + * It should be OK for low-performance paths like ->writepage()
78 + * To allow many writing process to fit a single transaction,
79 + * caller should calculate credits under truncate_mutex and
82 +int ext4_ext_calc_credits_for_insert(struct inode *inode,
83 + struct ext4_ext_path *path)
88 + /* probably there is space in leaf? */
89 + depth = path->p_depth;
90 + if (le16_to_cpu(path[depth].p_hdr->eh_entries)
91 + < le16_to_cpu(path[depth].p_hdr->eh_max))
96 + * given 32bit logical block (4294967296 blocks), max. tree
97 + * can be 4 levels in depth -- 4 * 340^4 == 53453440000.
98 + * let's also add one more level for imbalance.
102 + /* allocation of new data block(s) */
106 + * tree can be full, so it'd need to grow in depth:
107 + * we need one credit to modify old root, credits for
108 + * new root will be added in split accounting
112 + * Index split can happen, we'd need:
113 + * allocate intermediate indexes (bitmap + group)
114 + * + change two blocks at each level, but root (already included)
116 + needed += (depth * 2) + (depth * 2);
118 + /* any allocation modifies superblock */
125 * How many index/leaf blocks need to change/allocate to modify nrblocks?
127 * if nrblocks are fit in a single extent (chunk flag is 1), then
128 @@ -4029,3 +4079,14 @@ int ext4_fiemap(struct inode *inode, str
132 +EXPORT_SYMBOL(ext4_ext_store_pblock);
133 +EXPORT_SYMBOL(ext4_ext_search_right);
134 +EXPORT_SYMBOL(ext4_ext_search_left);
135 +EXPORT_SYMBOL(ext_pblock);
136 +EXPORT_SYMBOL(ext4_ext_insert_extent);
137 +EXPORT_SYMBOL(ext4_mb_new_blocks);
138 +EXPORT_SYMBOL(ext4_ext_calc_credits_for_insert);
139 +EXPORT_SYMBOL(ext4_mark_inode_dirty);
140 +EXPORT_SYMBOL(ext4_ext_walk_space);
141 +EXPORT_SYMBOL(ext4_ext_find_extent);
142 +EXPORT_SYMBOL(ext4_ext_drop_refs);
144 Index: linux-stage/fs/ext4/inode.c
145 ===================================================================
146 --- linux-stage.orig/fs/ext4/inode.c 2011-05-20 10:59:31.000000000 +0300
147 +++ linux-stage/fs/ext4/inode.c 2011-05-20 11:00:01.000000000 +0300
148 @@ -5249,6 +5249,7 @@ bad_inode:
152 +EXPORT_SYMBOL(ext4_iget);
154 static int ext4_inode_blocks_set(handle_t *handle,
155 struct ext4_inode *raw_inode,
156 Index: linux-stage/fs/ext4/mballoc.c
157 ===================================================================
158 --- linux-stage.orig/fs/ext4/mballoc.c 2011-05-20 10:59:32.000000000 +0300
159 +++ linux-stage/fs/ext4/mballoc.c 2011-05-20 11:00:01.000000000 +0300
160 @@ -4044,6 +4044,7 @@ repeat:
162 kmem_cache_free(ext4_ac_cachep, ac);
164 +EXPORT_SYMBOL(ext4_discard_preallocations);
167 * finds all preallocated spaces and return blocks being freed to them
168 @@ -5029,3 +5030,6 @@ int ext4_trim_fs(struct super_block *sb,
173 +EXPORT_SYMBOL(ext4_free_blocks);
175 Index: linux-stage/fs/ext4/super.c
176 ===================================================================
177 --- linux-stage.orig/fs/ext4/super.c 2011-05-20 10:59:31.000000000 +0300
178 +++ linux-stage/fs/ext4/super.c 2011-05-20 11:00:01.000000000 +0300
179 @@ -128,6 +128,7 @@ __u32 ext4_itable_unused_count(struct su
180 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
181 (__u32)le16_to_cpu(bg->bg_itable_unused_hi) << 16 : 0);
183 +EXPORT_SYMBOL(ext4_itable_unused_count);
185 void ext4_block_bitmap_set(struct super_block *sb,
186 struct ext4_group_desc *bg, ext4_fsblk_t blk)
187 @@ -1500,10 +1501,12 @@ enum {
188 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
189 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota,
190 Opt_noquota, Opt_ignore, Opt_barrier, Opt_nobarrier, Opt_err,
191 + Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
192 Opt_resize, Opt_usrquota, Opt_grpquota, Opt_i_version,
193 Opt_stripe, Opt_delalloc, Opt_nodelalloc,
194 Opt_block_validity, Opt_noblock_validity,
195 Opt_inode_readahead_blks, Opt_journal_ioprio,
197 Opt_discard, Opt_nodiscard,
198 Opt_init_inode_table, Opt_noinit_inode_table,
200 @@ -1556,6 +1559,9 @@ static const match_table_t tokens = {
201 {Opt_noquota, "noquota"},
202 {Opt_quota, "quota"},
203 {Opt_usrquota, "usrquota"},
204 + {Opt_iopen, "iopen"},
205 + {Opt_noiopen, "noiopen"},
206 + {Opt_iopen_nopriv, "iopen_nopriv"},
207 {Opt_barrier, "barrier=%u"},
208 {Opt_barrier, "barrier"},
209 {Opt_nobarrier, "nobarrier"},
210 @@ -1571,6 +1577,7 @@ static const match_table_t tokens = {
211 {Opt_auto_da_alloc, "auto_da_alloc=%u"},
212 {Opt_auto_da_alloc, "auto_da_alloc"},
213 {Opt_noauto_da_alloc, "noauto_da_alloc"},
214 + {Opt_mballoc, "mballoc"},
215 {Opt_discard, "discard"},
216 {Opt_nodiscard, "nodiscard"},
218 @@ -1928,6 +1935,10 @@ set_qf_format:
220 clear_opt(sbi->s_mount_opt, BARRIER);
224 + case Opt_iopen_nopriv:
229 @@ -2011,6 +2022,8 @@ set_qf_format:
231 clear_opt(sbi->s_mount_opt, DISCARD);
236 ext4_msg(sb, KERN_ERR,
237 "Unrecognized mount option \"%s\" "