aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_address.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2007-01-15 08:52:17 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2007-02-05 13:37:01 -0500
commita8d638e30e768adc6956541f79f7bf05139ba475 (patch)
tree07cee3c3d06eee9ff138f17023c7dadcb338f467 /fs/gfs2/ops_address.c
parent222d396092acc11b4af03bede309aa066945e920 (diff)
[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: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_address.c')
-rw-r--r--fs/gfs2/ops_address.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 37bfeb961eb3..9ddf9753a552 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -16,6 +16,7 @@
16#include <linux/pagevec.h> 16#include <linux/pagevec.h>
17#include <linux/mpage.h> 17#include <linux/mpage.h>
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/writeback.h>
19#include <linux/gfs2_ondisk.h> 20#include <linux/gfs2_ondisk.h>
20#include <linux/lm_interface.h> 21#include <linux/lm_interface.h>
21 22
@@ -157,6 +158,31 @@ out_ignore:
157} 158}
158 159
159/** 160/**
161 * gfs2_writepages - Write a bunch of dirty pages back to disk
162 * @mapping: The mapping to write
163 * @wbc: Write-back control
164 *
165 * For journaled files and/or ordered writes this just falls back to the
166 * kernel's default writepages path for now. We will probably want to change
167 * that eventually (i.e. when we look at allocate on flush).
168 *
169 * For the data=writeback case though we can already ignore buffer heads
170 * and write whole extents at once. This is a big reduction in the
171 * number of I/O requests we send and the bmap calls we make in this case.
172 */
173int gfs2_writepages(struct address_space *mapping, struct writeback_control *wbc)
174{
175 struct inode *inode = mapping->host;
176 struct gfs2_inode *ip = GFS2_I(inode);
177 struct gfs2_sbd *sdp = GFS2_SB(inode);
178
179 if (sdp->sd_args.ar_data == GFS2_DATA_WRITEBACK && !gfs2_is_jdata(ip))
180 return mpage_writepages(mapping, wbc, gfs2_get_block_noalloc);
181
182 return generic_writepages(mapping, wbc);
183}
184
185/**
160 * stuffed_readpage - Fill in a Linux page with stuffed file data 186 * stuffed_readpage - Fill in a Linux page with stuffed file data
161 * @ip: the inode 187 * @ip: the inode
162 * @page: the page 188 * @page: the page
@@ -757,6 +783,7 @@ out:
757 783
758const struct address_space_operations gfs2_file_aops = { 784const struct address_space_operations gfs2_file_aops = {
759 .writepage = gfs2_writepage, 785 .writepage = gfs2_writepage,
786 .writepages = gfs2_writepages,
760 .readpage = gfs2_readpage, 787 .readpage = gfs2_readpage,
761 .readpages = gfs2_readpages, 788 .readpages = gfs2_readpages,
762 .sync_page = block_sync_page, 789 .sync_page = block_sync_page,