aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/balloc.c2
-rw-r--r--fs/ext4/ext4.h2
-rw-r--r--fs/ext4/extents.c3
-rw-r--r--fs/ext4/ialloc.c8
-rw-r--r--fs/ext4/inode.c59
-rw-r--r--fs/ext4/ioctl.c28
-rw-r--r--fs/ext4/namei.c8
-rw-r--r--fs/ext4/page-io.c12
-rw-r--r--fs/ext4/super.c33
9 files changed, 65 insertions, 90 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index f6dba4505f1c..12ccacda44e0 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -565,7 +565,7 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb)
565 brelse(bitmap_bh); 565 brelse(bitmap_bh);
566 printk(KERN_DEBUG "ext4_count_free_clusters: stored = %llu" 566 printk(KERN_DEBUG "ext4_count_free_clusters: stored = %llu"
567 ", computed = %llu, %llu\n", 567 ", computed = %llu, %llu\n",
568 EXT4_B2C(sbi, ext4_free_blocks_count(es)), 568 EXT4_B2C(EXT4_SB(sb), ext4_free_blocks_count(es)),
569 desc_count, bitmap_count); 569 desc_count, bitmap_count);
570 return bitmap_count; 570 return bitmap_count;
571#else 571#else
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 5b0e26a1272d..1554b15f91bc 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1819,7 +1819,7 @@ extern int ext4fs_dirhash(const char *name, int len, struct
1819 dx_hash_info *hinfo); 1819 dx_hash_info *hinfo);
1820 1820
1821/* ialloc.c */ 1821/* ialloc.c */
1822extern struct inode *ext4_new_inode(handle_t *, struct inode *, int, 1822extern struct inode *ext4_new_inode(handle_t *, struct inode *, umode_t,
1823 const struct qstr *qstr, __u32 goal, 1823 const struct qstr *qstr, __u32 goal,
1824 uid_t *owner); 1824 uid_t *owner);
1825extern void ext4_free_inode(handle_t *, struct inode *); 1825extern void ext4_free_inode(handle_t *, struct inode *);
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 130ffe4818fa..841faf5fb785 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -1094,7 +1094,7 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode,
1094 le32_to_cpu(EXT_FIRST_INDEX(neh)->ei_block), 1094 le32_to_cpu(EXT_FIRST_INDEX(neh)->ei_block),
1095 ext4_idx_pblock(EXT_FIRST_INDEX(neh))); 1095 ext4_idx_pblock(EXT_FIRST_INDEX(neh)));
1096 1096
1097 neh->eh_depth = cpu_to_le16(neh->eh_depth + 1); 1097 neh->eh_depth = cpu_to_le16(le16_to_cpu(neh->eh_depth) + 1);
1098 ext4_mark_inode_dirty(handle, inode); 1098 ext4_mark_inode_dirty(handle, inode);
1099out: 1099out:
1100 brelse(bh); 1100 brelse(bh);
@@ -2954,7 +2954,6 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
2954 /* Pre-conditions */ 2954 /* Pre-conditions */
2955 BUG_ON(!ext4_ext_is_uninitialized(ex)); 2955 BUG_ON(!ext4_ext_is_uninitialized(ex));
2956 BUG_ON(!in_range(map->m_lblk, ee_block, ee_len)); 2956 BUG_ON(!in_range(map->m_lblk, ee_block, ee_len));
2957 BUG_ON(map->m_lblk + map->m_len > ee_block + ee_len);
2958 2957
2959 /* 2958 /*
2960 * Attempt to transfer newly initialized blocks from the currently 2959 * Attempt to transfer newly initialized blocks from the currently
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 00beb4f9cc4f..4637af036d9c 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -351,7 +351,7 @@ static void get_orlov_stats(struct super_block *sb, ext4_group_t g,
351 */ 351 */
352 352
353static int find_group_orlov(struct super_block *sb, struct inode *parent, 353static int find_group_orlov(struct super_block *sb, struct inode *parent,
354 ext4_group_t *group, int mode, 354 ext4_group_t *group, umode_t mode,
355 const struct qstr *qstr) 355 const struct qstr *qstr)
356{ 356{
357 ext4_group_t parent_group = EXT4_I(parent)->i_block_group; 357 ext4_group_t parent_group = EXT4_I(parent)->i_block_group;
@@ -497,7 +497,7 @@ fallback_retry:
497} 497}
498 498
499static int find_group_other(struct super_block *sb, struct inode *parent, 499static int find_group_other(struct super_block *sb, struct inode *parent,
500 ext4_group_t *group, int mode) 500 ext4_group_t *group, umode_t mode)
501{ 501{
502 ext4_group_t parent_group = EXT4_I(parent)->i_block_group; 502 ext4_group_t parent_group = EXT4_I(parent)->i_block_group;
503 ext4_group_t i, last, ngroups = ext4_get_groups_count(sb); 503 ext4_group_t i, last, ngroups = ext4_get_groups_count(sb);
@@ -602,7 +602,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent,
602 */ 602 */
603static int ext4_claim_inode(struct super_block *sb, 603static int ext4_claim_inode(struct super_block *sb,
604 struct buffer_head *inode_bitmap_bh, 604 struct buffer_head *inode_bitmap_bh,
605 unsigned long ino, ext4_group_t group, int mode) 605 unsigned long ino, ext4_group_t group, umode_t mode)
606{ 606{
607 int free = 0, retval = 0, count; 607 int free = 0, retval = 0, count;
608 struct ext4_sb_info *sbi = EXT4_SB(sb); 608 struct ext4_sb_info *sbi = EXT4_SB(sb);
@@ -690,7 +690,7 @@ err_ret:
690 * For other inodes, search forward from the parent directory's block 690 * For other inodes, search forward from the parent directory's block
691 * group to find a free inode. 691 * group to find a free inode.
692 */ 692 */
693struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode, 693struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, umode_t mode,
694 const struct qstr *qstr, __u32 goal, uid_t *owner) 694 const struct qstr *qstr, __u32 goal, uid_t *owner)
695{ 695{
696 struct super_block *sb; 696 struct super_block *sb;
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index e53858033368..aa8efa6572d6 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1338,8 +1338,11 @@ static int mpage_da_submit_io(struct mpage_da_data *mpd,
1338 clear_buffer_unwritten(bh); 1338 clear_buffer_unwritten(bh);
1339 } 1339 }
1340 1340
1341 /* skip page if block allocation undone */ 1341 /*
1342 if (buffer_delay(bh) || buffer_unwritten(bh)) 1342 * skip page if block allocation undone and
1343 * block is dirty
1344 */
1345 if (ext4_bh_delay_or_unwritten(NULL, bh))
1343 skip_page = 1; 1346 skip_page = 1;
1344 bh = bh->b_this_page; 1347 bh = bh->b_this_page;
1345 block_start += bh->b_size; 1348 block_start += bh->b_size;
@@ -1877,7 +1880,7 @@ static void ext4_end_io_buffer_write(struct buffer_head *bh, int uptodate);
1877 * a[0] = 'a'; 1880 * a[0] = 'a';
1878 * truncate(f, 4096); 1881 * truncate(f, 4096);
1879 * we have in the page first buffer_head mapped via page_mkwrite call back 1882 * we have in the page first buffer_head mapped via page_mkwrite call back
1880 * but other bufer_heads would be unmapped but dirty(dirty done via the 1883 * but other buffer_heads would be unmapped but dirty (dirty done via the
1881 * do_wp_page). So writepage should write the first block. If we modify 1884 * do_wp_page). So writepage should write the first block. If we modify
1882 * the mmap area beyond 1024 we will again get a page_fault and the 1885 * the mmap area beyond 1024 we will again get a page_fault and the
1883 * page_mkwrite callback will do the block allocation and mark the 1886 * page_mkwrite callback will do the block allocation and mark the
@@ -2269,6 +2272,7 @@ retry:
2269 ext4_msg(inode->i_sb, KERN_CRIT, "%s: jbd2_start: " 2272 ext4_msg(inode->i_sb, KERN_CRIT, "%s: jbd2_start: "
2270 "%ld pages, ino %lu; err %d", __func__, 2273 "%ld pages, ino %lu; err %d", __func__,
2271 wbc->nr_to_write, inode->i_ino, ret); 2274 wbc->nr_to_write, inode->i_ino, ret);
2275 blk_finish_plug(&plug);
2272 goto out_writepages; 2276 goto out_writepages;
2273 } 2277 }
2274 2278
@@ -2385,7 +2389,6 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,
2385 pgoff_t index; 2389 pgoff_t index;
2386 struct inode *inode = mapping->host; 2390 struct inode *inode = mapping->host;
2387 handle_t *handle; 2391 handle_t *handle;
2388 loff_t page_len;
2389 2392
2390 index = pos >> PAGE_CACHE_SHIFT; 2393 index = pos >> PAGE_CACHE_SHIFT;
2391 2394
@@ -2432,13 +2435,6 @@ retry:
2432 */ 2435 */
2433 if (pos + len > inode->i_size) 2436 if (pos + len > inode->i_size)
2434 ext4_truncate_failed_write(inode); 2437 ext4_truncate_failed_write(inode);
2435 } else {
2436 page_len = pos & (PAGE_CACHE_SIZE - 1);
2437 if (page_len > 0) {
2438 ret = ext4_discard_partial_page_buffers_no_lock(handle,
2439 inode, page, pos - page_len, page_len,
2440 EXT4_DISCARD_PARTIAL_PG_ZERO_UNMAPPED);
2441 }
2442 } 2438 }
2443 2439
2444 if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) 2440 if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
@@ -2481,7 +2477,6 @@ static int ext4_da_write_end(struct file *file,
2481 loff_t new_i_size; 2477 loff_t new_i_size;
2482 unsigned long start, end; 2478 unsigned long start, end;
2483 int write_mode = (int)(unsigned long)fsdata; 2479 int write_mode = (int)(unsigned long)fsdata;
2484 loff_t page_len;
2485 2480
2486 if (write_mode == FALL_BACK_TO_NONDELALLOC) { 2481 if (write_mode == FALL_BACK_TO_NONDELALLOC) {
2487 if (ext4_should_order_data(inode)) { 2482 if (ext4_should_order_data(inode)) {
@@ -2506,7 +2501,7 @@ static int ext4_da_write_end(struct file *file,
2506 */ 2501 */
2507 2502
2508 new_i_size = pos + copied; 2503 new_i_size = pos + copied;
2509 if (new_i_size > EXT4_I(inode)->i_disksize) { 2504 if (copied && new_i_size > EXT4_I(inode)->i_disksize) {
2510 if (ext4_da_should_update_i_disksize(page, end)) { 2505 if (ext4_da_should_update_i_disksize(page, end)) {
2511 down_write(&EXT4_I(inode)->i_data_sem); 2506 down_write(&EXT4_I(inode)->i_data_sem);
2512 if (new_i_size > EXT4_I(inode)->i_disksize) { 2507 if (new_i_size > EXT4_I(inode)->i_disksize) {
@@ -2530,16 +2525,6 @@ static int ext4_da_write_end(struct file *file,
2530 } 2525 }
2531 ret2 = generic_write_end(file, mapping, pos, len, copied, 2526 ret2 = generic_write_end(file, mapping, pos, len, copied,
2532 page, fsdata); 2527 page, fsdata);
2533
2534 page_len = PAGE_CACHE_SIZE -
2535 ((pos + copied - 1) & (PAGE_CACHE_SIZE - 1));
2536
2537 if (page_len > 0) {
2538 ret = ext4_discard_partial_page_buffers_no_lock(handle,
2539 inode, page, pos + copied - 1, page_len,
2540 EXT4_DISCARD_PARTIAL_PG_ZERO_UNMAPPED);
2541 }
2542
2543 copied = ret2; 2528 copied = ret2;
2544 if (ret2 < 0) 2529 if (ret2 < 0)
2545 ret = ret2; 2530 ret = ret2;
@@ -2779,10 +2764,11 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
2779 iocb->private, io_end->inode->i_ino, iocb, offset, 2764 iocb->private, io_end->inode->i_ino, iocb, offset,
2780 size); 2765 size);
2781 2766
2767 iocb->private = NULL;
2768
2782 /* if not aio dio with unwritten extents, just free io and return */ 2769 /* if not aio dio with unwritten extents, just free io and return */
2783 if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) { 2770 if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) {
2784 ext4_free_io_end(io_end); 2771 ext4_free_io_end(io_end);
2785 iocb->private = NULL;
2786out: 2772out:
2787 if (is_async) 2773 if (is_async)
2788 aio_complete(iocb, ret, 0); 2774 aio_complete(iocb, ret, 0);
@@ -2806,7 +2792,6 @@ out:
2806 2792
2807 /* queue the work to convert unwritten extents to written */ 2793 /* queue the work to convert unwritten extents to written */
2808 queue_work(wq, &io_end->work); 2794 queue_work(wq, &io_end->work);
2809 iocb->private = NULL;
2810 2795
2811 /* XXX: probably should move into the real I/O completion handler */ 2796 /* XXX: probably should move into the real I/O completion handler */
2812 inode_dio_done(inode); 2797 inode_dio_done(inode);
@@ -3201,26 +3186,8 @@ int ext4_discard_partial_page_buffers_no_lock(handle_t *handle,
3201 3186
3202 iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits); 3187 iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits);
3203 3188
3204 if (!page_has_buffers(page)) { 3189 if (!page_has_buffers(page))
3205 /* 3190 create_empty_buffers(page, blocksize, 0);
3206 * If the range to be discarded covers a partial block
3207 * we need to get the page buffers. This is because
3208 * partial blocks cannot be released and the page needs
3209 * to be updated with the contents of the block before
3210 * we write the zeros on top of it.
3211 */
3212 if ((from & (blocksize - 1)) ||
3213 ((from + length) & (blocksize - 1))) {
3214 create_empty_buffers(page, blocksize, 0);
3215 } else {
3216 /*
3217 * If there are no partial blocks,
3218 * there is nothing to update,
3219 * so we can return now
3220 */
3221 return 0;
3222 }
3223 }
3224 3191
3225 /* Find the buffer that contains "offset" */ 3192 /* Find the buffer that contains "offset" */
3226 bh = page_buffers(page); 3193 bh = page_buffers(page);
@@ -3501,7 +3468,7 @@ int ext4_punch_hole(struct file *file, loff_t offset, loff_t length)
3501 * transaction, and VFS/VM ensures that ext4_truncate() cannot run 3468 * transaction, and VFS/VM ensures that ext4_truncate() cannot run
3502 * simultaneously on behalf of the same inode. 3469 * simultaneously on behalf of the same inode.
3503 * 3470 *
3504 * As we work through the truncate and commmit bits of it to the journal there 3471 * As we work through the truncate and commit bits of it to the journal there
3505 * is one core, guiding principle: the file's tree must always be consistent on 3472 * is one core, guiding principle: the file's tree must always be consistent on
3506 * disk. We must be able to restart the truncate after a crash. 3473 * disk. We must be able to restart the truncate after a crash.
3507 * 3474 *
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 46a8de6f2089..e87a932b073b 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -45,7 +45,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
45 if (get_user(flags, (int __user *) arg)) 45 if (get_user(flags, (int __user *) arg))
46 return -EFAULT; 46 return -EFAULT;
47 47
48 err = mnt_want_write(filp->f_path.mnt); 48 err = mnt_want_write_file(filp);
49 if (err) 49 if (err)
50 return err; 50 return err;
51 51
@@ -134,7 +134,7 @@ flags_err:
134 err = ext4_ext_migrate(inode); 134 err = ext4_ext_migrate(inode);
135flags_out: 135flags_out:
136 mutex_unlock(&inode->i_mutex); 136 mutex_unlock(&inode->i_mutex);
137 mnt_drop_write(filp->f_path.mnt); 137 mnt_drop_write_file(filp);
138 return err; 138 return err;
139 } 139 }
140 case EXT4_IOC_GETVERSION: 140 case EXT4_IOC_GETVERSION:
@@ -150,7 +150,7 @@ flags_out:
150 if (!inode_owner_or_capable(inode)) 150 if (!inode_owner_or_capable(inode))
151 return -EPERM; 151 return -EPERM;
152 152
153 err = mnt_want_write(filp->f_path.mnt); 153 err = mnt_want_write_file(filp);
154 if (err) 154 if (err)
155 return err; 155 return err;
156 if (get_user(generation, (int __user *) arg)) { 156 if (get_user(generation, (int __user *) arg)) {
@@ -175,7 +175,7 @@ flags_out:
175unlock_out: 175unlock_out:
176 mutex_unlock(&inode->i_mutex); 176 mutex_unlock(&inode->i_mutex);
177setversion_out: 177setversion_out:
178 mnt_drop_write(filp->f_path.mnt); 178 mnt_drop_write_file(filp);
179 return err; 179 return err;
180 } 180 }
181 case EXT4_IOC_GROUP_EXTEND: { 181 case EXT4_IOC_GROUP_EXTEND: {
@@ -196,7 +196,7 @@ setversion_out:
196 return -EOPNOTSUPP; 196 return -EOPNOTSUPP;
197 } 197 }
198 198
199 err = mnt_want_write(filp->f_path.mnt); 199 err = mnt_want_write_file(filp);
200 if (err) 200 if (err)
201 return err; 201 return err;
202 202
@@ -208,7 +208,7 @@ setversion_out:
208 } 208 }
209 if (err == 0) 209 if (err == 0)
210 err = err2; 210 err = err2;
211 mnt_drop_write(filp->f_path.mnt); 211 mnt_drop_write_file(filp);
212 ext4_resize_end(sb); 212 ext4_resize_end(sb);
213 213
214 return err; 214 return err;
@@ -244,13 +244,13 @@ setversion_out:
244 return -EOPNOTSUPP; 244 return -EOPNOTSUPP;
245 } 245 }
246 246
247 err = mnt_want_write(filp->f_path.mnt); 247 err = mnt_want_write_file(filp);
248 if (err) 248 if (err)
249 goto mext_out; 249 goto mext_out;
250 250
251 err = ext4_move_extents(filp, donor_filp, me.orig_start, 251 err = ext4_move_extents(filp, donor_filp, me.orig_start,
252 me.donor_start, me.len, &me.moved_len); 252 me.donor_start, me.len, &me.moved_len);
253 mnt_drop_write(filp->f_path.mnt); 253 mnt_drop_write_file(filp);
254 if (me.moved_len > 0) 254 if (me.moved_len > 0)
255 file_remove_suid(donor_filp); 255 file_remove_suid(donor_filp);
256 256
@@ -281,7 +281,7 @@ mext_out:
281 return -EOPNOTSUPP; 281 return -EOPNOTSUPP;
282 } 282 }
283 283
284 err = mnt_want_write(filp->f_path.mnt); 284 err = mnt_want_write_file(filp);
285 if (err) 285 if (err)
286 return err; 286 return err;
287 287
@@ -293,7 +293,7 @@ mext_out:
293 } 293 }
294 if (err == 0) 294 if (err == 0)
295 err = err2; 295 err = err2;
296 mnt_drop_write(filp->f_path.mnt); 296 mnt_drop_write_file(filp);
297 ext4_resize_end(sb); 297 ext4_resize_end(sb);
298 298
299 return err; 299 return err;
@@ -305,7 +305,7 @@ mext_out:
305 if (!inode_owner_or_capable(inode)) 305 if (!inode_owner_or_capable(inode))
306 return -EACCES; 306 return -EACCES;
307 307
308 err = mnt_want_write(filp->f_path.mnt); 308 err = mnt_want_write_file(filp);
309 if (err) 309 if (err)
310 return err; 310 return err;
311 /* 311 /*
@@ -317,7 +317,7 @@ mext_out:
317 mutex_lock(&(inode->i_mutex)); 317 mutex_lock(&(inode->i_mutex));
318 err = ext4_ext_migrate(inode); 318 err = ext4_ext_migrate(inode);
319 mutex_unlock(&(inode->i_mutex)); 319 mutex_unlock(&(inode->i_mutex));
320 mnt_drop_write(filp->f_path.mnt); 320 mnt_drop_write_file(filp);
321 return err; 321 return err;
322 } 322 }
323 323
@@ -327,11 +327,11 @@ mext_out:
327 if (!inode_owner_or_capable(inode)) 327 if (!inode_owner_or_capable(inode))
328 return -EACCES; 328 return -EACCES;
329 329
330 err = mnt_want_write(filp->f_path.mnt); 330 err = mnt_want_write_file(filp);
331 if (err) 331 if (err)
332 return err; 332 return err;
333 err = ext4_alloc_da_blocks(inode); 333 err = ext4_alloc_da_blocks(inode);
334 mnt_drop_write(filp->f_path.mnt); 334 mnt_drop_write_file(filp);
335 return err; 335 return err;
336 } 336 }
337 337
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index aa4c782c9dd7..2043f482375d 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1736,7 +1736,7 @@ static int ext4_add_nondir(handle_t *handle,
1736 * If the create succeeds, we fill in the inode information 1736 * If the create succeeds, we fill in the inode information
1737 * with d_instantiate(). 1737 * with d_instantiate().
1738 */ 1738 */
1739static int ext4_create(struct inode *dir, struct dentry *dentry, int mode, 1739static int ext4_create(struct inode *dir, struct dentry *dentry, umode_t mode,
1740 struct nameidata *nd) 1740 struct nameidata *nd)
1741{ 1741{
1742 handle_t *handle; 1742 handle_t *handle;
@@ -1770,7 +1770,7 @@ retry:
1770} 1770}
1771 1771
1772static int ext4_mknod(struct inode *dir, struct dentry *dentry, 1772static int ext4_mknod(struct inode *dir, struct dentry *dentry,
1773 int mode, dev_t rdev) 1773 umode_t mode, dev_t rdev)
1774{ 1774{
1775 handle_t *handle; 1775 handle_t *handle;
1776 struct inode *inode; 1776 struct inode *inode;
@@ -1806,7 +1806,7 @@ retry:
1806 return err; 1806 return err;
1807} 1807}
1808 1808
1809static int ext4_mkdir(struct inode *dir, struct dentry *dentry, int mode) 1809static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
1810{ 1810{
1811 handle_t *handle; 1811 handle_t *handle;
1812 struct inode *inode; 1812 struct inode *inode;
@@ -2315,7 +2315,7 @@ retry:
2315 err = PTR_ERR(handle); 2315 err = PTR_ERR(handle);
2316 goto err_drop_inode; 2316 goto err_drop_inode;
2317 } 2317 }
2318 inc_nlink(inode); 2318 set_nlink(inode, 1);
2319 err = ext4_orphan_del(handle, inode); 2319 err = ext4_orphan_del(handle, inode);
2320 if (err) { 2320 if (err) {
2321 ext4_journal_stop(handle); 2321 ext4_journal_stop(handle);
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
index b1758538b3b5..475851896518 100644
--- a/fs/ext4/page-io.c
+++ b/fs/ext4/page-io.c
@@ -384,6 +384,18 @@ int ext4_bio_write_page(struct ext4_io_submit *io,
384 384
385 block_end = block_start + blocksize; 385 block_end = block_start + blocksize;
386 if (block_start >= len) { 386 if (block_start >= len) {
387 /*
388 * Comments copied from block_write_full_page_endio:
389 *
390 * The page straddles i_size. It must be zeroed out on
391 * each and every writepage invocation because it may
392 * be mmapped. "A file is mapped in multiples of the
393 * page size. For a file that is not a multiple of
394 * the page size, the remaining memory is zeroed when
395 * mapped, and writes to that region are not written
396 * out to the file."
397 */
398 zero_user_segment(page, block_start, block_end);
387 clear_buffer_dirty(bh); 399 clear_buffer_dirty(bh);
388 set_buffer_uptodate(bh); 400 set_buffer_uptodate(bh);
389 continue; 401 continue;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 9953d80145ad..64e2529ae9bb 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -930,7 +930,6 @@ static int ext4_drop_inode(struct inode *inode)
930static void ext4_i_callback(struct rcu_head *head) 930static void ext4_i_callback(struct rcu_head *head)
931{ 931{
932 struct inode *inode = container_of(head, struct inode, i_rcu); 932 struct inode *inode = container_of(head, struct inode, i_rcu);
933 INIT_LIST_HEAD(&inode->i_dentry);
934 kmem_cache_free(ext4_inode_cachep, EXT4_I(inode)); 933 kmem_cache_free(ext4_inode_cachep, EXT4_I(inode));
935} 934}
936 935
@@ -1033,11 +1032,11 @@ static inline void ext4_show_quota_options(struct seq_file *seq,
1033 * - it's set to a non-default value OR 1032 * - it's set to a non-default value OR
1034 * - if the per-sb default is different from the global default 1033 * - if the per-sb default is different from the global default
1035 */ 1034 */
1036static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs) 1035static int ext4_show_options(struct seq_file *seq, struct dentry *root)
1037{ 1036{
1038 int def_errors; 1037 int def_errors;
1039 unsigned long def_mount_opts; 1038 unsigned long def_mount_opts;
1040 struct super_block *sb = vfs->mnt_sb; 1039 struct super_block *sb = root->d_sb;
1041 struct ext4_sb_info *sbi = EXT4_SB(sb); 1040 struct ext4_sb_info *sbi = EXT4_SB(sb);
1042 struct ext4_super_block *es = sbi->s_es; 1041 struct ext4_super_block *es = sbi->s_es;
1043 1042
@@ -1155,9 +1154,9 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
1155 seq_puts(seq, ",block_validity"); 1154 seq_puts(seq, ",block_validity");
1156 1155
1157 if (!test_opt(sb, INIT_INODE_TABLE)) 1156 if (!test_opt(sb, INIT_INODE_TABLE))
1158 seq_puts(seq, ",noinit_inode_table"); 1157 seq_puts(seq, ",noinit_itable");
1159 else if (sbi->s_li_wait_mult != EXT4_DEF_LI_WAIT_MULT) 1158 else if (sbi->s_li_wait_mult != EXT4_DEF_LI_WAIT_MULT)
1160 seq_printf(seq, ",init_inode_table=%u", 1159 seq_printf(seq, ",init_itable=%u",
1161 (unsigned) sbi->s_li_wait_mult); 1160 (unsigned) sbi->s_li_wait_mult);
1162 1161
1163 ext4_show_quota_options(seq, sb); 1162 ext4_show_quota_options(seq, sb);
@@ -1333,8 +1332,7 @@ enum {
1333 Opt_nomblk_io_submit, Opt_block_validity, Opt_noblock_validity, 1332 Opt_nomblk_io_submit, Opt_block_validity, Opt_noblock_validity,
1334 Opt_inode_readahead_blks, Opt_journal_ioprio, 1333 Opt_inode_readahead_blks, Opt_journal_ioprio,
1335 Opt_dioread_nolock, Opt_dioread_lock, 1334 Opt_dioread_nolock, Opt_dioread_lock,
1336 Opt_discard, Opt_nodiscard, 1335 Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
1337 Opt_init_inode_table, Opt_noinit_inode_table,
1338}; 1336};
1339 1337
1340static const match_table_t tokens = { 1338static const match_table_t tokens = {
@@ -1407,9 +1405,9 @@ static const match_table_t tokens = {
1407 {Opt_dioread_lock, "dioread_lock"}, 1405 {Opt_dioread_lock, "dioread_lock"},
1408 {Opt_discard, "discard"}, 1406 {Opt_discard, "discard"},
1409 {Opt_nodiscard, "nodiscard"}, 1407 {Opt_nodiscard, "nodiscard"},
1410 {Opt_init_inode_table, "init_itable=%u"}, 1408 {Opt_init_itable, "init_itable=%u"},
1411 {Opt_init_inode_table, "init_itable"}, 1409 {Opt_init_itable, "init_itable"},
1412 {Opt_noinit_inode_table, "noinit_itable"}, 1410 {Opt_noinit_itable, "noinit_itable"},
1413 {Opt_err, NULL}, 1411 {Opt_err, NULL},
1414}; 1412};
1415 1413
@@ -1683,7 +1681,9 @@ static int parse_options(char *options, struct super_block *sb,
1683 data_opt = EXT4_MOUNT_WRITEBACK_DATA; 1681 data_opt = EXT4_MOUNT_WRITEBACK_DATA;
1684 datacheck: 1682 datacheck:
1685 if (is_remount) { 1683 if (is_remount) {
1686 if (test_opt(sb, DATA_FLAGS) != data_opt) { 1684 if (!sbi->s_journal)
1685 ext4_msg(sb, KERN_WARNING, "Remounting file system with no journal so ignoring journalled data option");
1686 else if (test_opt(sb, DATA_FLAGS) != data_opt) {
1687 ext4_msg(sb, KERN_ERR, 1687 ext4_msg(sb, KERN_ERR,
1688 "Cannot change data mode on remount"); 1688 "Cannot change data mode on remount");
1689 return 0; 1689 return 0;
@@ -1890,7 +1890,7 @@ set_qf_format:
1890 case Opt_dioread_lock: 1890 case Opt_dioread_lock:
1891 clear_opt(sb, DIOREAD_NOLOCK); 1891 clear_opt(sb, DIOREAD_NOLOCK);
1892 break; 1892 break;
1893 case Opt_init_inode_table: 1893 case Opt_init_itable:
1894 set_opt(sb, INIT_INODE_TABLE); 1894 set_opt(sb, INIT_INODE_TABLE);
1895 if (args[0].from) { 1895 if (args[0].from) {
1896 if (match_int(&args[0], &option)) 1896 if (match_int(&args[0], &option))
@@ -1901,7 +1901,7 @@ set_qf_format:
1901 return 0; 1901 return 0;
1902 sbi->s_li_wait_mult = option; 1902 sbi->s_li_wait_mult = option;
1903 break; 1903 break;
1904 case Opt_noinit_inode_table: 1904 case Opt_noinit_itable:
1905 clear_opt(sb, INIT_INODE_TABLE); 1905 clear_opt(sb, INIT_INODE_TABLE);
1906 break; 1906 break;
1907 default: 1907 default:
@@ -2882,8 +2882,7 @@ cont_thread:
2882 } 2882 }
2883 mutex_unlock(&eli->li_list_mtx); 2883 mutex_unlock(&eli->li_list_mtx);
2884 2884
2885 if (freezing(current)) 2885 try_to_freeze();
2886 refrigerator();
2887 2886
2888 cur = jiffies; 2887 cur = jiffies;
2889 if ((time_after_eq(cur, next_wakeup)) || 2888 if ((time_after_eq(cur, next_wakeup)) ||
@@ -3099,8 +3098,6 @@ static void ext4_destroy_lazyinit_thread(void)
3099} 3098}
3100 3099
3101static int ext4_fill_super(struct super_block *sb, void *data, int silent) 3100static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3102 __releases(kernel_lock)
3103 __acquires(kernel_lock)
3104{ 3101{
3105 char *orig_data = kstrdup(data, GFP_KERNEL); 3102 char *orig_data = kstrdup(data, GFP_KERNEL);
3106 struct buffer_head *bh; 3103 struct buffer_head *bh;
@@ -4783,7 +4780,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
4783 return -EINVAL; 4780 return -EINVAL;
4784 4781
4785 /* Quotafile not on the same filesystem? */ 4782 /* Quotafile not on the same filesystem? */
4786 if (path->mnt->mnt_sb != sb) 4783 if (path->dentry->d_sb != sb)
4787 return -EXDEV; 4784 return -EXDEV;
4788 /* Journaling quota? */ 4785 /* Journaling quota? */
4789 if (EXT4_SB(sb)->s_qf_names[type]) { 4786 if (EXT4_SB(sb)->s_qf_names[type]) {