diff options
author | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2014-06-04 19:07:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-04 19:54:02 -0400 |
commit | 47a191fd38ebddb1bd1510ec2bc1085c578c8868 (patch) | |
tree | 5c65289e7195f4ecd445b2b55e8d44cfa7e7ea00 /fs/mpage.c | |
parent | 57d998456ae8680ed446aa1993f45f4d8a9a5973 (diff) |
fs/block_dev.c: add bdev_read_page() and bdev_write_page()
A block device driver may choose to provide a rw_page operation. These
will be called when the filesystem is attempting to do page sized I/O to
page cache pages (ie not for direct I/O). This does preclude I/Os that
are larger than page size, so this may only be a performance gain for
some devices.
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Tested-by: Dheeraj Reddy <dheeraj.reddy@intel.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/mpage.c')
-rw-r--r-- | fs/mpage.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/mpage.c b/fs/mpage.c index 10da0da73017..5f9ed622274f 100644 --- a/fs/mpage.c +++ b/fs/mpage.c | |||
@@ -269,6 +269,11 @@ do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages, | |||
269 | 269 | ||
270 | alloc_new: | 270 | alloc_new: |
271 | if (bio == NULL) { | 271 | if (bio == NULL) { |
272 | if (first_hole == blocks_per_page) { | ||
273 | if (!bdev_read_page(bdev, blocks[0] << (blkbits - 9), | ||
274 | page)) | ||
275 | goto out; | ||
276 | } | ||
272 | bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9), | 277 | bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9), |
273 | min_t(int, nr_pages, bio_get_nr_vecs(bdev)), | 278 | min_t(int, nr_pages, bio_get_nr_vecs(bdev)), |
274 | GFP_KERNEL); | 279 | GFP_KERNEL); |
@@ -587,6 +592,13 @@ page_is_mapped: | |||
587 | 592 | ||
588 | alloc_new: | 593 | alloc_new: |
589 | if (bio == NULL) { | 594 | if (bio == NULL) { |
595 | if (first_unmapped == blocks_per_page) { | ||
596 | if (!bdev_write_page(bdev, blocks[0] << (blkbits - 9), | ||
597 | page, wbc)) { | ||
598 | clean_buffers(page, first_unmapped); | ||
599 | goto out; | ||
600 | } | ||
601 | } | ||
590 | bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9), | 602 | bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9), |
591 | bio_get_nr_vecs(bdev), GFP_NOFS|__GFP_HIGH); | 603 | bio_get_nr_vecs(bdev), GFP_NOFS|__GFP_HIGH); |
592 | if (bio == NULL) | 604 | if (bio == NULL) |