Add readpages support for block devices
PATCH 1/1 Add readpages support for block devices
From: Shane Michael Matthews <[email protected]>
Using mpage_readpages instead of multiple calls to blkdev_readpage reduces the CPU utilisation by 35% when using dd to clone a drive.
--- fs/block_dev.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
fs/block_dev.c +7 -0
@@ -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,
Signature · 1 line
1.7.2.3
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.
Quoted 3 lines · Christoph Hellwig
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