public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add readpages support for block devices
@ 2010-12-18  0:27 Matthew Wilcox
  2010-12-18  9:20 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2010-12-18  0:27 UTC (permalink / raw)
  To: Jens Axboe, Al Viro, Christoph Hellwig, linux-kernel
  Cc: Shane Michael Matthews, Matthew Wilcox

From: Shane Michael Matthews <shane.matthews@intel.com>

Using mpage_readpages instead of multiple calls to blkdev_readpage reduces
the CPU utilisation by 35% when using dd to clone a drive.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Shane Michael Matthews <shane.matthews@intel.com>
---
 fs/block_dev.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 4230252..55cf932 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -318,6 +318,12 @@ static int blkdev_readpage(struct file * file, struct page * page)
 	return block_read_full_page(page, blkdev_get_block);
 }
 
+static int blkdev_readpages(struct file *file, struct address_space *mapping,
+			struct list_head *pages, unsigned nr_pages)
+{
+	return mpage_readpages(mapping, pages, nr_pages, blkdev_get_block);
+}
+
 static int blkdev_write_begin(struct file *file, struct address_space *mapping,
 			loff_t pos, unsigned len, unsigned flags,
 			struct page **pagep, void **fsdata)
@@ -1634,6 +1640,7 @@ static int blkdev_releasepage(struct page *page, gfp_t wait)
 
 static const struct address_space_operations def_blk_aops = {
 	.readpage	= blkdev_readpage,
+	.readpages	= blkdev_readpages,
 	.writepage	= blkdev_writepage,
 	.sync_page	= block_sync_page,
 	.write_begin	= blkdev_write_begin,
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add readpages support for block devices
  2010-12-18  0:27 [PATCH] Add readpages support for block devices Matthew Wilcox
@ 2010-12-18  9:20 ` Christoph Hellwig
  2010-12-19  3:35   ` Wu Fengguang
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2010-12-18  9:20 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Jens Axboe, Al Viro, Christoph Hellwig, linux-kernel,
	Shane Michael Matthews

We already used to have this and Jens reverted it in commit
172124e220f1854acc99ee394671781b8b5e2120.  I can't find a better
explanation than his rather brief commit message, but he might not more.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add readpages support for block devices
  2010-12-18  9:20 ` Christoph Hellwig
@ 2010-12-19  3:35   ` Wu Fengguang
  0 siblings, 0 replies; 3+ messages in thread
From: Wu Fengguang @ 2010-12-19  3:35 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Matthew Wilcox, Jens Axboe, Al Viro, linux-kernel,
	Shane Michael Matthews, Jeff Moyer, Jens Axboe, Luck, Tony,
	Florian Mickler

On Sat, Dec 18, 2010 at 10:20:49AM +0100, Christoph Hellwig wrote:
> We already used to have this and Jens reverted it in commit
> 172124e220f1854acc99ee394671781b8b5e2120.  I can't find a better
> explanation than his rather brief commit message, but he might not more.

The discussion goes here

http://www.gossamer-threads.com/lists/linux/kernel/1085325?do=post_view_threaded#1085325

The problem happens on ext3 fs, non-4k aligned partition and 64K page
size. Jeff also find it hurts dump performance. Then it's reverted
since no one seems to have the time to dig further.

Thanks,
Fengguang

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-19  3:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-18  0:27 [PATCH] Add readpages support for block devices Matthew Wilcox
2010-12-18  9:20 ` Christoph Hellwig
2010-12-19  3:35   ` Wu Fengguang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox