Commit a8d638e3 authored by Steven Whitehouse's avatar Steven Whitehouse

[GFS2] Add writepages for "data=writeback" mounts

It occurred to me that although a gfs2 specific writepages for ordered
writes and journaled data would be tricky, by hooking writepages only
for "data=writeback" mounts we could take advantage of not needing
buffer heads (we don't use them on the read side, nor have we for some
time) and create much larger I/Os for the block layer.

Using blktrace both before and after, its possible to see that for large
I/Os, most of the requests generated through writepages are now 1024
sectors after this patch is applied as opposed to 8 sectors before.
Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent 222d3960
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/pagevec.h> #include <linux/pagevec.h>
#include <linux/mpage.h> #include <linux/mpage.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/writeback.h>
#include <linux/gfs2_ondisk.h> #include <linux/gfs2_ondisk.h>
#include <linux/lm_interface.h> #include <linux/lm_interface.h>
...@@ -156,6 +157,31 @@ static int gfs2_writepage(struct page *page, struct writeback_control *wbc) ...@@ -156,6 +157,31 @@ static int gfs2_writepage(struct page *page, struct writeback_control *wbc)
return 0; return 0;
} }
/**
* gfs2_writepages - Write a bunch of dirty pages back to disk
* @mapping: The mapping to write
* @wbc: Write-back control
*
* For journaled files and/or ordered writes this just falls back to the
* kernel's default writepages path for now. We will probably want to change
* that eventually (i.e. when we look at allocate on flush).
*
* For the data=writeback case though we can already ignore buffer heads
* and write whole extents at once. This is a big reduction in the
* number of I/O requests we send and the bmap calls we make in this case.
*/
int gfs2_writepages(struct address_space *mapping, struct writeback_control *wbc)
{
struct inode *inode = mapping->host;
struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = GFS2_SB(inode);
if (sdp->sd_args.ar_data == GFS2_DATA_WRITEBACK && !gfs2_is_jdata(ip))
return mpage_writepages(mapping, wbc, gfs2_get_block_noalloc);
return generic_writepages(mapping, wbc);
}
/** /**
* stuffed_readpage - Fill in a Linux page with stuffed file data * stuffed_readpage - Fill in a Linux page with stuffed file data
* @ip: the inode * @ip: the inode
...@@ -757,6 +783,7 @@ int gfs2_releasepage(struct page *page, gfp_t gfp_mask) ...@@ -757,6 +783,7 @@ int gfs2_releasepage(struct page *page, gfp_t gfp_mask)
const struct address_space_operations gfs2_file_aops = { const struct address_space_operations gfs2_file_aops = {
.writepage = gfs2_writepage, .writepage = gfs2_writepage,
.writepages = gfs2_writepages,
.readpage = gfs2_readpage, .readpage = gfs2_readpage,
.readpages = gfs2_readpages, .readpages = gfs2_readpages,
.sync_page = block_sync_page, .sync_page = block_sync_page,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment