aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2008-01-11 14:44:50 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2008-01-25 03:19:03 -0500
commit05220535196d413db434527a3edcba79b7187df8 (patch)
tree5811b6f1caeac55102afb993f0b1538bbe9ed2b8 /fs/gfs2
parent598278bd4808ed81b0e6fa445458a7d549f72a32 (diff)
[GFS2] gfs2_alloc_required performance
This is a small I/O performance enhancement to gfs2. (Actually, it is a rework of an earlier version I got wrong). The idea here is to check if the write extends past the last block in the file. If so, the function can save itself a lot of time and trouble because it knows an allocate will be required. Benchmarks like iozone should see better performance. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/bmap.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 73dfad70de66..4356cc2fb3f5 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -1224,6 +1224,11 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,
1224 unsigned int shift = sdp->sd_sb.sb_bsize_shift; 1224 unsigned int shift = sdp->sd_sb.sb_bsize_shift;
1225 lblock = offset >> shift; 1225 lblock = offset >> shift;
1226 lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift; 1226 lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift;
1227 if (lblock_stop > ip->i_di.di_blocks) { /* writing past the
1228 last block */
1229 *alloc_required = 1;
1230 return 0;
1231 }
1227 } 1232 }
1228 1233
1229 for (; lblock < lblock_stop; lblock += extlen) { 1234 for (; lblock < lblock_stop; lblock += extlen) {