1 Index: linux-stage/fs/ext4/ext4_jbd2.h
2 ===================================================================
3 --- linux-stage.orig/fs/ext4/ext4_jbd2.h
4 +++ linux-stage/fs/ext4/ext4_jbd2.h
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/extents.c
15 ===================================================================
16 --- linux-stage.orig/fs/ext4/extents.c
17 +++ linux-stage/fs/ext4/extents.c
18 @@ -59,6 +59,17 @@ ext4_fsblk_t ext_pblock(struct ext4_exte
22 + * ext4_ext_store_pblock:
23 + * stores a large physical block number into an extent struct,
24 + * breaking it into parts
26 +void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb)
28 + ex->ee_start_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff));
29 + ex->ee_start_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff);
34 * combine low and high parts of a leaf physical block number into ext4_fsblk_t
36 @@ -72,17 +83,6 @@ ext4_fsblk_t idx_pblock(struct ext4_exte
40 - * ext4_ext_store_pblock:
41 - * stores a large physical block number into an extent struct,
42 - * breaking it into parts
44 -void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb)
46 - ex->ee_start_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff));
47 - ex->ee_start_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff);
51 * ext4_idx_store_pblock:
52 * stores a large physical block number into an index struct,
53 * breaking it into parts
54 @@ -2097,6 +2097,56 @@ static int ext4_ext_rm_idx(handle_t *han
58 + * This routine returns max. credits extent tree can consume.
59 + * It should be OK for low-performance paths like ->writepage()
60 + * To allow many writing process to fit a single transaction,
61 + * caller should calculate credits under truncate_mutex and
64 +int ext4_ext_calc_credits_for_insert(struct inode *inode,
65 + struct ext4_ext_path *path)
70 + /* probably there is space in leaf? */
71 + depth = ext_depth(inode);
72 + if (le16_to_cpu(path[depth].p_hdr->eh_entries)
73 + < le16_to_cpu(path[depth].p_hdr->eh_max))
78 + * given 32bit logical block (4294967296 blocks), max. tree
79 + * can be 4 levels in depth -- 4 * 340^4 == 53453440000.
80 + * let's also add one more level for imbalance.
84 + /* allocation of new data block(s) */
88 + * tree can be full, so it'd need to grow in depth:
89 + * we need one credit to modify old root, credits for
90 + * new root will be added in split accounting
95 + * Index split can happen, we'd need:
96 + * allocate intermediate indexes (bitmap + group)
97 + * + change two blocks at each level, but root (already included)
99 + needed += (depth * 2) + (depth * 2);
101 + /* any allocation modifies superblock */
108 * ext4_ext_calc_credits_for_single_extent:
109 * This routine returns max. credits that needed to insert an extent
110 * to the extent tree.
111 @@ -3941,3 +3991,15 @@ int ext4_fiemap(struct inode *inode, str
115 +EXPORT_SYMBOL(ext4_ext_store_pblock);
116 +EXPORT_SYMBOL(ext4_ext_search_right);
117 +EXPORT_SYMBOL(ext4_ext_search_left);
118 +EXPORT_SYMBOL(ext_pblock);
119 +EXPORT_SYMBOL(ext4_ext_insert_extent);
120 +EXPORT_SYMBOL(ext4_mb_new_blocks);
121 +EXPORT_SYMBOL(ext4_ext_walk_space);
122 +EXPORT_SYMBOL(ext4_ext_calc_credits_for_insert);
123 +EXPORT_SYMBOL(ext4_mark_inode_dirty);
124 +EXPORT_SYMBOL(ext4_ext_find_extent);
125 +EXPORT_SYMBOL(ext4_ext_drop_refs);
127 Index: linux-stage/fs/ext4/ext4_extents.h
128 ===================================================================
129 --- linux-stage.orig/fs/ext4/ext4_extents.h
130 +++ linux-stage/fs/ext4/ext4_extents.h
136 + * define EXT4_ALLOC_NEEDED to 0 since block bitmap, group desc. and sb
137 + * are now accounted in ext4_ext_calc_credits_for_insert()
139 +#define EXT4_ALLOC_NEEDED 0
140 +#define HAVE_EXT_PREPARE_CB_EXTENT
143 * ext4_inode has i_block array (60 bytes total).
144 @@ -231,6 +237,8 @@ extern ext4_fsblk_t ext_pblock(struct ex
145 extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *);
146 extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t);
147 extern int ext4_extent_tree_init(handle_t *, struct inode *);
148 +extern int ext4_ext_calc_credits_for_insert(struct inode *,
149 + struct ext4_ext_path *);
150 extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode,
152 struct ext4_ext_path *path);
153 Index: linux-stage/fs/ext4/mballoc.c
154 ===================================================================
155 --- linux-stage.orig/fs/ext4/mballoc.c
156 +++ linux-stage/fs/ext4/mballoc.c
157 @@ -4313,6 +4313,7 @@ repeat:
159 kmem_cache_free(ext4_ac_cachep, ac);
161 +EXPORT_SYMBOL(ext4_discard_preallocations);
164 * finds all preallocated spaces and return blocks being freed to them
165 @@ -5127,3 +5128,6 @@ error_return:
166 kmem_cache_free(ext4_ac_cachep, ac);
170 +EXPORT_SYMBOL(ext4_free_blocks);
172 Index: linux-stage/fs/ext4/ext4_jbd2.c
173 ===================================================================
174 --- linux-stage.orig/fs/ext4/ext4_jbd2.c
175 +++ linux-stage/fs/ext4/ext4_jbd2.c
176 @@ -31,6 +31,7 @@ int __ext4_journal_get_write_access(cons
180 +EXPORT_SYMBOL(__ext4_journal_get_write_access);
182 int __ext4_journal_forget(const char *where, handle_t *handle,
183 struct buffer_head *bh)
184 @@ -107,3 +108,4 @@ int __ext4_handle_dirty_metadata(const c
188 +EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
189 Index: linux-stage/fs/ext4/ext4.h
190 ===================================================================
191 --- linux-stage.orig/fs/ext4/ext4.h
192 +++ linux-stage/fs/ext4/ext4.h
193 @@ -1528,6 +1528,8 @@ extern int ext4_mb_add_groupinfo(struct
194 extern int ext4_mb_get_buddy_cache_lock(struct super_block *, ext4_group_t);
195 extern void ext4_mb_put_buddy_cache_lock(struct super_block *,
197 +extern void ext4_mb_discard_inode_preallocations(struct inode *);
200 int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
201 struct buffer_head *bh, ext4_fsblk_t blocknr);
202 Index: linux-stage/fs/ext4/inode.c
203 ===================================================================
204 --- linux-stage.orig/fs/ext4/inode.c
205 +++ linux-stage/fs/ext4/inode.c
206 @@ -5078,6 +5078,7 @@ bad_inode:
210 +EXPORT_SYMBOL(ext4_iget);
212 static int ext4_inode_blocks_set(handle_t *handle,
213 struct ext4_inode *raw_inode,
214 Index: linux-stage/fs/ext4/super.c
215 ===================================================================
216 --- linux-stage.orig/fs/ext4/super.c
217 +++ linux-stage/fs/ext4/super.c
218 @@ -90,6 +90,7 @@ ext4_fsblk_t ext4_inode_bitmap(struct su
219 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
220 (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_bitmap_hi) << 32 : 0);
222 +EXPORT_SYMBOL(ext4_inode_bitmap);
224 ext4_fsblk_t ext4_inode_table(struct super_block *sb,
225 struct ext4_group_desc *bg)
226 @@ -114,6 +115,7 @@ __u32 ext4_free_inodes_count(struct supe
227 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
228 (__u32)le16_to_cpu(bg->bg_free_inodes_count_hi) << 16 : 0);
230 +EXPORT_SYMBOL(ext4_itable_unused_count);
232 __u32 ext4_used_dirs_count(struct super_block *sb,
233 struct ext4_group_desc *bg)
234 @@ -1489,9 +1491,11 @@ enum {
235 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
236 Opt_ignore, Opt_barrier, Opt_nobarrier, Opt_err, Opt_resize,
237 Opt_usrquota, Opt_grpquota, Opt_i_version,
238 + Opt_mballoc, Opt_extents,
239 Opt_stripe, Opt_delalloc, Opt_nodelalloc,
240 Opt_block_validity, Opt_noblock_validity,
241 - Opt_inode_readahead_blks, Opt_journal_ioprio
242 + Opt_inode_readahead_blks, Opt_journal_ioprio,
243 + Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
246 static match_table_t tokens = {
247 @@ -1547,6 +1551,11 @@ static match_table_t tokens = {
248 {Opt_barrier, "barrier"},
249 {Opt_nobarrier, "nobarrier"},
250 {Opt_i_version, "i_version"},
251 + {Opt_mballoc, "mballoc"},
252 + {Opt_extents, "extents"},
253 + {Opt_iopen, "iopen"},
254 + {Opt_noiopen, "noiopen"},
255 + {Opt_iopen_nopriv, "iopen_nopriv"},
256 {Opt_stripe, "stripe=%u"},
257 {Opt_resize, "resize"},
258 {Opt_delalloc, "delalloc"},
259 @@ -1993,6 +2002,12 @@ set_qf_format:
261 set_opt(sbi->s_mount_opt,NO_AUTO_DA_ALLOC);
267 + case Opt_iopen_nopriv:
270 ext4_msg(sb, KERN_ERR,
271 "Unrecognized mount option \"%s\" "
272 @@ -2543,7 +2558,7 @@ static ssize_t delayed_allocation_blocks
275 return snprintf(buf, PAGE_SIZE, "%llu\n",
276 - (s64) percpu_counter_sum(&sbi->s_dirtyblocks_counter));
277 + (unsigned long long) percpu_counter_sum(&sbi->s_dirtyblocks_counter));
280 static ssize_t session_write_kbytes_show(struct ext4_attr *a,
281 @@ -2564,11 +2579,11 @@ static ssize_t lifetime_write_kbytes_sho
282 struct super_block *sb = sbi->s_buddy_cache->i_sb;
284 return snprintf(buf, PAGE_SIZE, "%llu\n",
285 - sbi->s_kbytes_written +
286 + (unsigned long long)(sbi->s_kbytes_written +
287 (sb->s_bdev->bd_part ?
288 (part_stat_read(sb->s_bdev->bd_part, sectors[1]) -
289 EXT4_SB(sb)->s_sectors_written_start) >> 1
294 static ssize_t inode_readahead_blks_store(struct ext4_attr *a,
295 @@ -3042,7 +3057,7 @@ static int ext4_fill_super(struct super_
296 if (blocks_count && ext4_blocks_count(es) > blocks_count) {
297 ext4_msg(sb, KERN_WARNING, "bad geometry: block count %llu "
298 "exceeds size of device (%llu blocks)",
299 - ext4_blocks_count(es), blocks_count);
300 + ext4_blocks_count(es), (unsigned long long)blocks_count);
304 Index: linux-stage/fs/ext4/fsync.c
305 ===================================================================
306 --- linux-stage.orig/fs/ext4/fsync.c
307 +++ linux-stage/fs/ext4/fsync.c
308 @@ -61,7 +61,7 @@ int ext4_sync_file(struct file *file, st
310 trace_mark(ext4_sync_file, "dev %s datasync %d ino %ld parent %ld",
311 inode->i_sb->s_id, datasync, inode->i_ino,
312 - dentry->d_parent->d_inode->i_ino);
315 ret = flush_aio_dio_completed_IO(inode);
317 Index: linux-stage/fs/ext4/move_extent.c
318 ===================================================================
319 --- linux-stage.orig/fs/ext4/move_extent.c
320 +++ linux-stage/fs/ext4/move_extent.c
321 @@ -1358,7 +1358,8 @@ ext4_move_extents(struct file *o_filp, s
322 ext4_error(orig_inode->i_sb,
323 "We replaced blocks too much! "
324 "sum of replaced: %llu requested: %llu",
326 + (unsigned long long)(*moved_len),
327 + (unsigned long long)(len));