aboutsummaryrefslogtreecommitdiffstats
path: root/fs/mpage.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/mpage.c')
-rw-r--r--fs/mpage.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/mpage.c b/fs/mpage.c
index d78455a81ec9..fdfae9fa98cd 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -27,6 +27,7 @@
27#include <linux/writeback.h> 27#include <linux/writeback.h>
28#include <linux/backing-dev.h> 28#include <linux/backing-dev.h>
29#include <linux/pagevec.h> 29#include <linux/pagevec.h>
30#include <linux/cleancache.h>
30 31
31/* 32/*
32 * I/O completion handler for multipage BIOs. 33 * I/O completion handler for multipage BIOs.
@@ -271,6 +272,12 @@ do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages,
271 SetPageMappedToDisk(page); 272 SetPageMappedToDisk(page);
272 } 273 }
273 274
275 if (fully_mapped && blocks_per_page == 1 && !PageUptodate(page) &&
276 cleancache_get_page(page) == 0) {
277 SetPageUptodate(page);
278 goto confused;
279 }
280
274 /* 281 /*
275 * This page will go to BIO. Do we need to send this BIO off first? 282 * This page will go to BIO. Do we need to send this BIO off first?
276 */ 283 */
@@ -364,6 +371,9 @@ mpage_readpages(struct address_space *mapping, struct list_head *pages,
364 sector_t last_block_in_bio = 0; 371 sector_t last_block_in_bio = 0;
365 struct buffer_head map_bh; 372 struct buffer_head map_bh;
366 unsigned long first_logical_block = 0; 373 unsigned long first_logical_block = 0;
374 struct blk_plug plug;
375
376 blk_start_plug(&plug);
367 377
368 map_bh.b_state = 0; 378 map_bh.b_state = 0;
369 map_bh.b_size = 0; 379 map_bh.b_size = 0;
@@ -385,6 +395,7 @@ mpage_readpages(struct address_space *mapping, struct list_head *pages,
385 BUG_ON(!list_empty(pages)); 395 BUG_ON(!list_empty(pages));
386 if (bio) 396 if (bio)
387 mpage_bio_submit(READ, bio); 397 mpage_bio_submit(READ, bio);
398 blk_finish_plug(&plug);
388 return 0; 399 return 0;
389} 400}
390EXPORT_SYMBOL(mpage_readpages); 401EXPORT_SYMBOL(mpage_readpages);
@@ -666,8 +677,11 @@ int
666mpage_writepages(struct address_space *mapping, 677mpage_writepages(struct address_space *mapping,
667 struct writeback_control *wbc, get_block_t get_block) 678 struct writeback_control *wbc, get_block_t get_block)
668{ 679{
680 struct blk_plug plug;
669 int ret; 681 int ret;
670 682
683 blk_start_plug(&plug);
684
671 if (!get_block) 685 if (!get_block)
672 ret = generic_writepages(mapping, wbc); 686 ret = generic_writepages(mapping, wbc);
673 else { 687 else {
@@ -682,6 +696,7 @@ mpage_writepages(struct address_space *mapping,
682 if (mpd.bio) 696 if (mpd.bio)
683 mpage_bio_submit(WRITE, mpd.bio); 697 mpage_bio_submit(WRITE, mpd.bio);
684 } 698 }
699 blk_finish_plug(&plug);
685 return ret; 700 return ret;
686} 701}
687EXPORT_SYMBOL(mpage_writepages); 702EXPORT_SYMBOL(mpage_writepages);