diff options
author | David S. Miller <davem@davemloft.net> | 2009-03-19 02:53:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-19 02:53:57 -0400 |
commit | 0702b30dd821ac8a4103ddbe545518713fdca9be (patch) | |
tree | 8ce0c9f5e58c5ccb99870505eecd139986caa05e /fs/ext4 | |
parent | 192d7a4667c6d11d1a174ec4cad9a3c5d5f9043c (diff) | |
parent | a1e4ee22863d41a6fbb24310d7951836cb6dafe7 (diff) |
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/balloc.c | 4 | ||||
-rw-r--r-- | fs/ext4/ext4.h | 2 | ||||
-rw-r--r-- | fs/ext4/extents.c | 6 | ||||
-rw-r--r-- | fs/ext4/ialloc.c | 17 | ||||
-rw-r--r-- | fs/ext4/inode.c | 38 | ||||
-rw-r--r-- | fs/ext4/mballoc.c | 45 | ||||
-rw-r--r-- | fs/ext4/migrate.c | 8 | ||||
-rw-r--r-- | fs/ext4/super.c | 12 |
8 files changed, 92 insertions, 40 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 9a50b8052dcf..de9459b4cb94 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -609,7 +609,9 @@ int ext4_claim_free_blocks(struct ext4_sb_info *sbi, | |||
609 | */ | 609 | */ |
610 | int ext4_should_retry_alloc(struct super_block *sb, int *retries) | 610 | int ext4_should_retry_alloc(struct super_block *sb, int *retries) |
611 | { | 611 | { |
612 | if (!ext4_has_free_blocks(EXT4_SB(sb), 1) || (*retries)++ > 3) | 612 | if (!ext4_has_free_blocks(EXT4_SB(sb), 1) || |
613 | (*retries)++ > 3 || | ||
614 | !EXT4_SB(sb)->s_journal) | ||
613 | return 0; | 615 | return 0; |
614 | 616 | ||
615 | jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id); | 617 | jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id); |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index aafc9eba1c25..b0c87dce66a3 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -868,7 +868,7 @@ static inline unsigned ext4_rec_len_from_disk(__le16 dlen) | |||
868 | { | 868 | { |
869 | unsigned len = le16_to_cpu(dlen); | 869 | unsigned len = le16_to_cpu(dlen); |
870 | 870 | ||
871 | if (len == EXT4_MAX_REC_LEN) | 871 | if (len == EXT4_MAX_REC_LEN || len == 0) |
872 | return 1 << 16; | 872 | return 1 << 16; |
873 | return len; | 873 | return len; |
874 | } | 874 | } |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index e2eab196875f..e0aa4fe4f596 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -1122,7 +1122,8 @@ ext4_ext_search_right(struct inode *inode, struct ext4_ext_path *path, | |||
1122 | struct ext4_extent_idx *ix; | 1122 | struct ext4_extent_idx *ix; |
1123 | struct ext4_extent *ex; | 1123 | struct ext4_extent *ex; |
1124 | ext4_fsblk_t block; | 1124 | ext4_fsblk_t block; |
1125 | int depth, ee_len; | 1125 | int depth; /* Note, NOT eh_depth; depth from top of tree */ |
1126 | int ee_len; | ||
1126 | 1127 | ||
1127 | BUG_ON(path == NULL); | 1128 | BUG_ON(path == NULL); |
1128 | depth = path->p_depth; | 1129 | depth = path->p_depth; |
@@ -1179,7 +1180,8 @@ got_index: | |||
1179 | if (bh == NULL) | 1180 | if (bh == NULL) |
1180 | return -EIO; | 1181 | return -EIO; |
1181 | eh = ext_block_hdr(bh); | 1182 | eh = ext_block_hdr(bh); |
1182 | if (ext4_ext_check_header(inode, eh, depth)) { | 1183 | /* subtract from p_depth to get proper eh_depth */ |
1184 | if (ext4_ext_check_header(inode, eh, path->p_depth - depth)) { | ||
1183 | put_bh(bh); | 1185 | put_bh(bh); |
1184 | return -EIO; | 1186 | return -EIO; |
1185 | } | 1187 | } |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 4fb86a0061d0..2d2b3585ee91 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -188,7 +188,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode) | |||
188 | struct ext4_group_desc *gdp; | 188 | struct ext4_group_desc *gdp; |
189 | struct ext4_super_block *es; | 189 | struct ext4_super_block *es; |
190 | struct ext4_sb_info *sbi; | 190 | struct ext4_sb_info *sbi; |
191 | int fatal = 0, err, count; | 191 | int fatal = 0, err, count, cleared; |
192 | ext4_group_t flex_group; | 192 | ext4_group_t flex_group; |
193 | 193 | ||
194 | if (atomic_read(&inode->i_count) > 1) { | 194 | if (atomic_read(&inode->i_count) > 1) { |
@@ -248,8 +248,10 @@ void ext4_free_inode(handle_t *handle, struct inode *inode) | |||
248 | goto error_return; | 248 | goto error_return; |
249 | 249 | ||
250 | /* Ok, now we can actually update the inode bitmaps.. */ | 250 | /* Ok, now we can actually update the inode bitmaps.. */ |
251 | if (!ext4_clear_bit_atomic(sb_bgl_lock(sbi, block_group), | 251 | spin_lock(sb_bgl_lock(sbi, block_group)); |
252 | bit, bitmap_bh->b_data)) | 252 | cleared = ext4_clear_bit(bit, bitmap_bh->b_data); |
253 | spin_unlock(sb_bgl_lock(sbi, block_group)); | ||
254 | if (!cleared) | ||
253 | ext4_error(sb, "ext4_free_inode", | 255 | ext4_error(sb, "ext4_free_inode", |
254 | "bit already cleared for inode %lu", ino); | 256 | "bit already cleared for inode %lu", ino); |
255 | else { | 257 | else { |
@@ -696,6 +698,7 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode) | |||
696 | struct inode *ret; | 698 | struct inode *ret; |
697 | ext4_group_t i; | 699 | ext4_group_t i; |
698 | int free = 0; | 700 | int free = 0; |
701 | static int once = 1; | ||
699 | ext4_group_t flex_group; | 702 | ext4_group_t flex_group; |
700 | 703 | ||
701 | /* Cannot create files in a deleted directory */ | 704 | /* Cannot create files in a deleted directory */ |
@@ -715,6 +718,14 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode) | |||
715 | 718 | ||
716 | if (sbi->s_log_groups_per_flex) { | 719 | if (sbi->s_log_groups_per_flex) { |
717 | ret2 = find_group_flex(sb, dir, &group); | 720 | ret2 = find_group_flex(sb, dir, &group); |
721 | if (ret2 == -1) { | ||
722 | ret2 = find_group_other(sb, dir, &group); | ||
723 | if (ret2 == 0 && once) | ||
724 | once = 0; | ||
725 | printk(KERN_NOTICE "ext4: find_group_flex " | ||
726 | "failed, fallback succeeded dir %lu\n", | ||
727 | dir->i_ino); | ||
728 | } | ||
718 | goto got_group; | 729 | goto got_group; |
719 | } | 730 | } |
720 | 731 | ||
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 03ba20be1329..c7fed5b18745 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -47,8 +47,10 @@ | |||
47 | static inline int ext4_begin_ordered_truncate(struct inode *inode, | 47 | static inline int ext4_begin_ordered_truncate(struct inode *inode, |
48 | loff_t new_size) | 48 | loff_t new_size) |
49 | { | 49 | { |
50 | return jbd2_journal_begin_ordered_truncate(&EXT4_I(inode)->jinode, | 50 | return jbd2_journal_begin_ordered_truncate( |
51 | new_size); | 51 | EXT4_SB(inode->i_sb)->s_journal, |
52 | &EXT4_I(inode)->jinode, | ||
53 | new_size); | ||
52 | } | 54 | } |
53 | 55 | ||
54 | static void ext4_invalidatepage(struct page *page, unsigned long offset); | 56 | static void ext4_invalidatepage(struct page *page, unsigned long offset); |
@@ -1366,6 +1368,10 @@ retry: | |||
1366 | goto out; | 1368 | goto out; |
1367 | } | 1369 | } |
1368 | 1370 | ||
1371 | /* We cannot recurse into the filesystem as the transaction is already | ||
1372 | * started */ | ||
1373 | flags |= AOP_FLAG_NOFS; | ||
1374 | |||
1369 | page = grab_cache_page_write_begin(mapping, index, flags); | 1375 | page = grab_cache_page_write_begin(mapping, index, flags); |
1370 | if (!page) { | 1376 | if (!page) { |
1371 | ext4_journal_stop(handle); | 1377 | ext4_journal_stop(handle); |
@@ -1375,7 +1381,7 @@ retry: | |||
1375 | *pagep = page; | 1381 | *pagep = page; |
1376 | 1382 | ||
1377 | ret = block_write_begin(file, mapping, pos, len, flags, pagep, fsdata, | 1383 | ret = block_write_begin(file, mapping, pos, len, flags, pagep, fsdata, |
1378 | ext4_get_block); | 1384 | ext4_get_block); |
1379 | 1385 | ||
1380 | if (!ret && ext4_should_journal_data(inode)) { | 1386 | if (!ret && ext4_should_journal_data(inode)) { |
1381 | ret = walk_page_buffers(handle, page_buffers(page), | 1387 | ret = walk_page_buffers(handle, page_buffers(page), |
@@ -2437,6 +2443,7 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2437 | int no_nrwrite_index_update; | 2443 | int no_nrwrite_index_update; |
2438 | int pages_written = 0; | 2444 | int pages_written = 0; |
2439 | long pages_skipped; | 2445 | long pages_skipped; |
2446 | int range_cyclic, cycled = 1, io_done = 0; | ||
2440 | int needed_blocks, ret = 0, nr_to_writebump = 0; | 2447 | int needed_blocks, ret = 0, nr_to_writebump = 0; |
2441 | struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb); | 2448 | struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb); |
2442 | 2449 | ||
@@ -2488,9 +2495,15 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2488 | if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) | 2495 | if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) |
2489 | range_whole = 1; | 2496 | range_whole = 1; |
2490 | 2497 | ||
2491 | if (wbc->range_cyclic) | 2498 | range_cyclic = wbc->range_cyclic; |
2499 | if (wbc->range_cyclic) { | ||
2492 | index = mapping->writeback_index; | 2500 | index = mapping->writeback_index; |
2493 | else | 2501 | if (index) |
2502 | cycled = 0; | ||
2503 | wbc->range_start = index << PAGE_CACHE_SHIFT; | ||
2504 | wbc->range_end = LLONG_MAX; | ||
2505 | wbc->range_cyclic = 0; | ||
2506 | } else | ||
2494 | index = wbc->range_start >> PAGE_CACHE_SHIFT; | 2507 | index = wbc->range_start >> PAGE_CACHE_SHIFT; |
2495 | 2508 | ||
2496 | mpd.wbc = wbc; | 2509 | mpd.wbc = wbc; |
@@ -2504,6 +2517,7 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2504 | wbc->no_nrwrite_index_update = 1; | 2517 | wbc->no_nrwrite_index_update = 1; |
2505 | pages_skipped = wbc->pages_skipped; | 2518 | pages_skipped = wbc->pages_skipped; |
2506 | 2519 | ||
2520 | retry: | ||
2507 | while (!ret && wbc->nr_to_write > 0) { | 2521 | while (!ret && wbc->nr_to_write > 0) { |
2508 | 2522 | ||
2509 | /* | 2523 | /* |
@@ -2530,7 +2544,7 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2530 | 2544 | ||
2531 | ext4_journal_stop(handle); | 2545 | ext4_journal_stop(handle); |
2532 | 2546 | ||
2533 | if (mpd.retval == -ENOSPC) { | 2547 | if ((mpd.retval == -ENOSPC) && sbi->s_journal) { |
2534 | /* commit the transaction which would | 2548 | /* commit the transaction which would |
2535 | * free blocks released in the transaction | 2549 | * free blocks released in the transaction |
2536 | * and try again | 2550 | * and try again |
@@ -2546,6 +2560,7 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2546 | pages_written += mpd.pages_written; | 2560 | pages_written += mpd.pages_written; |
2547 | wbc->pages_skipped = pages_skipped; | 2561 | wbc->pages_skipped = pages_skipped; |
2548 | ret = 0; | 2562 | ret = 0; |
2563 | io_done = 1; | ||
2549 | } else if (wbc->nr_to_write) | 2564 | } else if (wbc->nr_to_write) |
2550 | /* | 2565 | /* |
2551 | * There is no more writeout needed | 2566 | * There is no more writeout needed |
@@ -2554,6 +2569,13 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2554 | */ | 2569 | */ |
2555 | break; | 2570 | break; |
2556 | } | 2571 | } |
2572 | if (!io_done && !cycled) { | ||
2573 | cycled = 1; | ||
2574 | index = 0; | ||
2575 | wbc->range_start = index << PAGE_CACHE_SHIFT; | ||
2576 | wbc->range_end = mapping->writeback_index - 1; | ||
2577 | goto retry; | ||
2578 | } | ||
2557 | if (pages_skipped != wbc->pages_skipped) | 2579 | if (pages_skipped != wbc->pages_skipped) |
2558 | printk(KERN_EMERG "This should not happen leaving %s " | 2580 | printk(KERN_EMERG "This should not happen leaving %s " |
2559 | "with nr_to_write = %ld ret = %d\n", | 2581 | "with nr_to_write = %ld ret = %d\n", |
@@ -2561,6 +2583,7 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2561 | 2583 | ||
2562 | /* Update index */ | 2584 | /* Update index */ |
2563 | index += pages_written; | 2585 | index += pages_written; |
2586 | wbc->range_cyclic = range_cyclic; | ||
2564 | if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) | 2587 | if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) |
2565 | /* | 2588 | /* |
2566 | * set the writeback_index so that range_cyclic | 2589 | * set the writeback_index so that range_cyclic |
@@ -2648,6 +2671,9 @@ retry: | |||
2648 | ret = PTR_ERR(handle); | 2671 | ret = PTR_ERR(handle); |
2649 | goto out; | 2672 | goto out; |
2650 | } | 2673 | } |
2674 | /* We cannot recurse into the filesystem as the transaction is already | ||
2675 | * started */ | ||
2676 | flags |= AOP_FLAG_NOFS; | ||
2651 | 2677 | ||
2652 | page = grab_cache_page_write_begin(mapping, index, flags); | 2678 | page = grab_cache_page_write_begin(mapping, index, flags); |
2653 | if (!page) { | 2679 | if (!page) { |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index deba54f6cbed..9f61e62f435f 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -1447,7 +1447,7 @@ static void ext4_mb_measure_extent(struct ext4_allocation_context *ac, | |||
1447 | struct ext4_free_extent *gex = &ac->ac_g_ex; | 1447 | struct ext4_free_extent *gex = &ac->ac_g_ex; |
1448 | 1448 | ||
1449 | BUG_ON(ex->fe_len <= 0); | 1449 | BUG_ON(ex->fe_len <= 0); |
1450 | BUG_ON(ex->fe_len >= EXT4_BLOCKS_PER_GROUP(ac->ac_sb)); | 1450 | BUG_ON(ex->fe_len > EXT4_BLOCKS_PER_GROUP(ac->ac_sb)); |
1451 | BUG_ON(ex->fe_start >= EXT4_BLOCKS_PER_GROUP(ac->ac_sb)); | 1451 | BUG_ON(ex->fe_start >= EXT4_BLOCKS_PER_GROUP(ac->ac_sb)); |
1452 | BUG_ON(ac->ac_status != AC_STATUS_CONTINUE); | 1452 | BUG_ON(ac->ac_status != AC_STATUS_CONTINUE); |
1453 | 1453 | ||
@@ -3292,7 +3292,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, | |||
3292 | } | 3292 | } |
3293 | BUG_ON(start + size <= ac->ac_o_ex.fe_logical && | 3293 | BUG_ON(start + size <= ac->ac_o_ex.fe_logical && |
3294 | start > ac->ac_o_ex.fe_logical); | 3294 | start > ac->ac_o_ex.fe_logical); |
3295 | BUG_ON(size <= 0 || size >= EXT4_BLOCKS_PER_GROUP(ac->ac_sb)); | 3295 | BUG_ON(size <= 0 || size > EXT4_BLOCKS_PER_GROUP(ac->ac_sb)); |
3296 | 3296 | ||
3297 | /* now prepare goal request */ | 3297 | /* now prepare goal request */ |
3298 | 3298 | ||
@@ -3589,6 +3589,7 @@ static void ext4_mb_put_pa(struct ext4_allocation_context *ac, | |||
3589 | struct super_block *sb, struct ext4_prealloc_space *pa) | 3589 | struct super_block *sb, struct ext4_prealloc_space *pa) |
3590 | { | 3590 | { |
3591 | ext4_group_t grp; | 3591 | ext4_group_t grp; |
3592 | ext4_fsblk_t grp_blk; | ||
3592 | 3593 | ||
3593 | if (!atomic_dec_and_test(&pa->pa_count) || pa->pa_free != 0) | 3594 | if (!atomic_dec_and_test(&pa->pa_count) || pa->pa_free != 0) |
3594 | return; | 3595 | return; |
@@ -3603,8 +3604,12 @@ static void ext4_mb_put_pa(struct ext4_allocation_context *ac, | |||
3603 | pa->pa_deleted = 1; | 3604 | pa->pa_deleted = 1; |
3604 | spin_unlock(&pa->pa_lock); | 3605 | spin_unlock(&pa->pa_lock); |
3605 | 3606 | ||
3606 | /* -1 is to protect from crossing allocation group */ | 3607 | grp_blk = pa->pa_pstart; |
3607 | ext4_get_group_no_and_offset(sb, pa->pa_pstart - 1, &grp, NULL); | 3608 | /* If linear, pa_pstart may be in the next group when pa is used up */ |
3609 | if (pa->pa_linear) | ||
3610 | grp_blk--; | ||
3611 | |||
3612 | ext4_get_group_no_and_offset(sb, grp_blk, &grp, NULL); | ||
3608 | 3613 | ||
3609 | /* | 3614 | /* |
3610 | * possible race: | 3615 | * possible race: |
@@ -3693,6 +3698,8 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac) | |||
3693 | pa->pa_free = pa->pa_len; | 3698 | pa->pa_free = pa->pa_len; |
3694 | atomic_set(&pa->pa_count, 1); | 3699 | atomic_set(&pa->pa_count, 1); |
3695 | spin_lock_init(&pa->pa_lock); | 3700 | spin_lock_init(&pa->pa_lock); |
3701 | INIT_LIST_HEAD(&pa->pa_inode_list); | ||
3702 | INIT_LIST_HEAD(&pa->pa_group_list); | ||
3696 | pa->pa_deleted = 0; | 3703 | pa->pa_deleted = 0; |
3697 | pa->pa_linear = 0; | 3704 | pa->pa_linear = 0; |
3698 | 3705 | ||
@@ -3755,6 +3762,7 @@ ext4_mb_new_group_pa(struct ext4_allocation_context *ac) | |||
3755 | atomic_set(&pa->pa_count, 1); | 3762 | atomic_set(&pa->pa_count, 1); |
3756 | spin_lock_init(&pa->pa_lock); | 3763 | spin_lock_init(&pa->pa_lock); |
3757 | INIT_LIST_HEAD(&pa->pa_inode_list); | 3764 | INIT_LIST_HEAD(&pa->pa_inode_list); |
3765 | INIT_LIST_HEAD(&pa->pa_group_list); | ||
3758 | pa->pa_deleted = 0; | 3766 | pa->pa_deleted = 0; |
3759 | pa->pa_linear = 1; | 3767 | pa->pa_linear = 1; |
3760 | 3768 | ||
@@ -4476,23 +4484,26 @@ static int ext4_mb_release_context(struct ext4_allocation_context *ac) | |||
4476 | pa->pa_free -= ac->ac_b_ex.fe_len; | 4484 | pa->pa_free -= ac->ac_b_ex.fe_len; |
4477 | pa->pa_len -= ac->ac_b_ex.fe_len; | 4485 | pa->pa_len -= ac->ac_b_ex.fe_len; |
4478 | spin_unlock(&pa->pa_lock); | 4486 | spin_unlock(&pa->pa_lock); |
4479 | /* | ||
4480 | * We want to add the pa to the right bucket. | ||
4481 | * Remove it from the list and while adding | ||
4482 | * make sure the list to which we are adding | ||
4483 | * doesn't grow big. | ||
4484 | */ | ||
4485 | if (likely(pa->pa_free)) { | ||
4486 | spin_lock(pa->pa_obj_lock); | ||
4487 | list_del_rcu(&pa->pa_inode_list); | ||
4488 | spin_unlock(pa->pa_obj_lock); | ||
4489 | ext4_mb_add_n_trim(ac); | ||
4490 | } | ||
4491 | } | 4487 | } |
4492 | ext4_mb_put_pa(ac, ac->ac_sb, pa); | ||
4493 | } | 4488 | } |
4494 | if (ac->alloc_semp) | 4489 | if (ac->alloc_semp) |
4495 | up_read(ac->alloc_semp); | 4490 | up_read(ac->alloc_semp); |
4491 | if (pa) { | ||
4492 | /* | ||
4493 | * We want to add the pa to the right bucket. | ||
4494 | * Remove it from the list and while adding | ||
4495 | * make sure the list to which we are adding | ||
4496 | * doesn't grow big. We need to release | ||
4497 | * alloc_semp before calling ext4_mb_add_n_trim() | ||
4498 | */ | ||
4499 | if (pa->pa_linear && likely(pa->pa_free)) { | ||
4500 | spin_lock(pa->pa_obj_lock); | ||
4501 | list_del_rcu(&pa->pa_inode_list); | ||
4502 | spin_unlock(pa->pa_obj_lock); | ||
4503 | ext4_mb_add_n_trim(ac); | ||
4504 | } | ||
4505 | ext4_mb_put_pa(ac, ac->ac_sb, pa); | ||
4506 | } | ||
4496 | if (ac->ac_bitmap_page) | 4507 | if (ac->ac_bitmap_page) |
4497 | page_cache_release(ac->ac_bitmap_page); | 4508 | page_cache_release(ac->ac_bitmap_page); |
4498 | if (ac->ac_buddy_page) | 4509 | if (ac->ac_buddy_page) |
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index 734abca25e35..fe64d9f79852 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c | |||
@@ -481,7 +481,7 @@ int ext4_ext_migrate(struct inode *inode) | |||
481 | + 1); | 481 | + 1); |
482 | if (IS_ERR(handle)) { | 482 | if (IS_ERR(handle)) { |
483 | retval = PTR_ERR(handle); | 483 | retval = PTR_ERR(handle); |
484 | goto err_out; | 484 | return retval; |
485 | } | 485 | } |
486 | tmp_inode = ext4_new_inode(handle, | 486 | tmp_inode = ext4_new_inode(handle, |
487 | inode->i_sb->s_root->d_inode, | 487 | inode->i_sb->s_root->d_inode, |
@@ -489,8 +489,7 @@ int ext4_ext_migrate(struct inode *inode) | |||
489 | if (IS_ERR(tmp_inode)) { | 489 | if (IS_ERR(tmp_inode)) { |
490 | retval = -ENOMEM; | 490 | retval = -ENOMEM; |
491 | ext4_journal_stop(handle); | 491 | ext4_journal_stop(handle); |
492 | tmp_inode = NULL; | 492 | return retval; |
493 | goto err_out; | ||
494 | } | 493 | } |
495 | i_size_write(tmp_inode, i_size_read(inode)); | 494 | i_size_write(tmp_inode, i_size_read(inode)); |
496 | /* | 495 | /* |
@@ -618,8 +617,7 @@ err_out: | |||
618 | 617 | ||
619 | ext4_journal_stop(handle); | 618 | ext4_journal_stop(handle); |
620 | 619 | ||
621 | if (tmp_inode) | 620 | iput(tmp_inode); |
622 | iput(tmp_inode); | ||
623 | 621 | ||
624 | return retval; | 622 | return retval; |
625 | } | 623 | } |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index e5f06a5f045e..39d1993cfa13 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -3046,14 +3046,17 @@ static void ext4_write_super(struct super_block *sb) | |||
3046 | static int ext4_sync_fs(struct super_block *sb, int wait) | 3046 | static int ext4_sync_fs(struct super_block *sb, int wait) |
3047 | { | 3047 | { |
3048 | int ret = 0; | 3048 | int ret = 0; |
3049 | tid_t target; | ||
3049 | 3050 | ||
3050 | trace_mark(ext4_sync_fs, "dev %s wait %d", sb->s_id, wait); | 3051 | trace_mark(ext4_sync_fs, "dev %s wait %d", sb->s_id, wait); |
3051 | sb->s_dirt = 0; | 3052 | sb->s_dirt = 0; |
3052 | if (EXT4_SB(sb)->s_journal) { | 3053 | if (EXT4_SB(sb)->s_journal) { |
3053 | if (wait) | 3054 | if (jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, |
3054 | ret = ext4_force_commit(sb); | 3055 | &target)) { |
3055 | else | 3056 | if (wait) |
3056 | jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, NULL); | 3057 | jbd2_log_wait_commit(EXT4_SB(sb)->s_journal, |
3058 | target); | ||
3059 | } | ||
3057 | } else { | 3060 | } else { |
3058 | ext4_commit_super(sb, EXT4_SB(sb)->s_es, wait); | 3061 | ext4_commit_super(sb, EXT4_SB(sb)->s_es, wait); |
3059 | } | 3062 | } |
@@ -3088,7 +3091,6 @@ static int ext4_freeze(struct super_block *sb) | |||
3088 | 3091 | ||
3089 | /* Journal blocked and flushed, clear needs_recovery flag. */ | 3092 | /* Journal blocked and flushed, clear needs_recovery flag. */ |
3090 | EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); | 3093 | EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); |
3091 | ext4_commit_super(sb, EXT4_SB(sb)->s_es, 1); | ||
3092 | error = ext4_commit_super(sb, EXT4_SB(sb)->s_es, 1); | 3094 | error = ext4_commit_super(sb, EXT4_SB(sb)->s_es, 1); |
3093 | if (error) | 3095 | if (error) |
3094 | goto out; | 3096 | goto out; |