aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2014-10-29 09:02:29 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2014-11-03 14:25:41 -0500
commit33ad5d54284adf110f6e78aa9c4f42d3d17d7f68 (patch)
treec6a8aa392ef601695d67f3747ac224ac36e4e843 /fs/gfs2
parent0e27c18c30f6850ecd0fb67143f202f0426d76d7 (diff)
GFS2: Only increase rs_sizehint
If an application does a sequence of (1) big write, (2) little write we don't necessarily want to reset the size hint based on the smaller size. The fact that they did any big writes implies they may do more, and therefore we should try to allocate bigger block reservations, even if the last few were small writes. Therefore this patch changes function gfs2_size_hint so that the size hint can only grow; it cannot shrink. This is especially important where there are multiple writers. 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/file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 80dd44dca028..5ebe56831794 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -337,7 +337,8 @@ static void gfs2_size_hint(struct file *filep, loff_t offset, size_t size)
337 size_t blks = (size + sdp->sd_sb.sb_bsize - 1) >> sdp->sd_sb.sb_bsize_shift; 337 size_t blks = (size + sdp->sd_sb.sb_bsize - 1) >> sdp->sd_sb.sb_bsize_shift;
338 int hint = min_t(size_t, INT_MAX, blks); 338 int hint = min_t(size_t, INT_MAX, blks);
339 339
340 atomic_set(&ip->i_res->rs_sizehint, hint); 340 if (hint > atomic_read(&ip->i_res->rs_sizehint))
341 atomic_set(&ip->i_res->rs_sizehint, hint);
341} 342}
342 343
343/** 344/**