diff options
-rw-r--r-- | fs/ext4/inode.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 617c9cbba182..c2e6af338234 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -2761,6 +2761,16 @@ static int write_cache_pages_da(struct address_space *mapping, | |||
2761 | 2761 | ||
2762 | *done_index = page->index + 1; | 2762 | *done_index = page->index + 1; |
2763 | 2763 | ||
2764 | /* | ||
2765 | * If we can't merge this page, and we have | ||
2766 | * accumulated an contiguous region, write it | ||
2767 | */ | ||
2768 | if ((mpd->next_page != page->index) && | ||
2769 | (mpd->next_page != mpd->first_page)) { | ||
2770 | mpage_da_map_and_submit(mpd); | ||
2771 | goto ret_extent_tail; | ||
2772 | } | ||
2773 | |||
2764 | lock_page(page); | 2774 | lock_page(page); |
2765 | 2775 | ||
2766 | /* | 2776 | /* |
@@ -2784,25 +2794,8 @@ static int write_cache_pages_da(struct address_space *mapping, | |||
2784 | 2794 | ||
2785 | BUG_ON(PageWriteback(page)); | 2795 | BUG_ON(PageWriteback(page)); |
2786 | 2796 | ||
2787 | /* | ||
2788 | * Can we merge this page to current extent? | ||
2789 | */ | ||
2790 | if (mpd->next_page != page->index) { | 2797 | if (mpd->next_page != page->index) { |
2791 | /* | 2798 | /* |
2792 | * Nope, we can't. So, we map | ||
2793 | * non-allocated blocks and start IO | ||
2794 | * on them | ||
2795 | */ | ||
2796 | if (mpd->next_page != mpd->first_page) { | ||
2797 | mpage_da_map_and_submit(mpd); | ||
2798 | /* | ||
2799 | * skip rest of the page in the page_vec | ||
2800 | */ | ||
2801 | unlock_page(page); | ||
2802 | goto ret_extent_tail; | ||
2803 | } | ||
2804 | |||
2805 | /* | ||
2806 | * Start next extent of pages and blocks | 2799 | * Start next extent of pages and blocks |
2807 | */ | 2800 | */ |
2808 | mpd->first_page = page->index; | 2801 | mpd->first_page = page->index; |