aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/glops.c
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2015-06-05 09:38:57 -0400
committerBob Peterson <rpeterso@redhat.com>2015-06-19 08:40:22 -0400
commit39b0f1e9290880a6c905f639e7db6b646e302a4f (patch)
tree6076698c4f876af5e3228690f53346a57accd801 /fs/gfs2/glops.c
parente7ccaf5fe1590667b3fa2f8df5c5ec9ba0dc5b85 (diff)
GFS2: Don't brelse rgrp buffer_heads every allocation
This patch allows the block allocation code to retain the buffers for the resource groups so they don't need to be re-read from buffer cache with every request. This is a performance improvement that's especially noticeable when resource groups are very large. For example, with 2GB resource groups and 4K blocks, there can be 33 blocks for every resource group. This patch allows those 33 buffers to be kept around and not read in and thrown away with every operation. The buffers are released when the resource group is either synced or invalidated. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Reviewed-by: Steven Whitehouse <swhiteho@redhat.com> Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Diffstat (limited to 'fs/gfs2/glops.c')
-rw-r--r--fs/gfs2/glops.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 1249b2bb2830..fa3fa5e94553 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -144,6 +144,12 @@ static void rgrp_go_sync(struct gfs2_glock *gl)
144 struct gfs2_rgrpd *rgd; 144 struct gfs2_rgrpd *rgd;
145 int error; 145 int error;
146 146
147 spin_lock(&gl->gl_spin);
148 rgd = gl->gl_object;
149 if (rgd)
150 gfs2_rgrp_brelse(rgd);
151 spin_unlock(&gl->gl_spin);
152
147 if (!test_and_clear_bit(GLF_DIRTY, &gl->gl_flags)) 153 if (!test_and_clear_bit(GLF_DIRTY, &gl->gl_flags))
148 return; 154 return;
149 GLOCK_BUG_ON(gl, gl->gl_state != LM_ST_EXCLUSIVE); 155 GLOCK_BUG_ON(gl, gl->gl_state != LM_ST_EXCLUSIVE);
@@ -175,15 +181,17 @@ static void rgrp_go_inval(struct gfs2_glock *gl, int flags)
175{ 181{
176 struct gfs2_sbd *sdp = gl->gl_sbd; 182 struct gfs2_sbd *sdp = gl->gl_sbd;
177 struct address_space *mapping = &sdp->sd_aspace; 183 struct address_space *mapping = &sdp->sd_aspace;
184 struct gfs2_rgrpd *rgd = gl->gl_object;
185
186 if (rgd)
187 gfs2_rgrp_brelse(rgd);
178 188
179 WARN_ON_ONCE(!(flags & DIO_METADATA)); 189 WARN_ON_ONCE(!(flags & DIO_METADATA));
180 gfs2_assert_withdraw(sdp, !atomic_read(&gl->gl_ail_count)); 190 gfs2_assert_withdraw(sdp, !atomic_read(&gl->gl_ail_count));
181 truncate_inode_pages_range(mapping, gl->gl_vm.start, gl->gl_vm.end); 191 truncate_inode_pages_range(mapping, gl->gl_vm.start, gl->gl_vm.end);
182 192
183 if (gl->gl_object) { 193 if (rgd)
184 struct gfs2_rgrpd *rgd = (struct gfs2_rgrpd *)gl->gl_object;
185 rgd->rd_flags &= ~GFS2_RDF_UPTODATE; 194 rgd->rd_flags &= ~GFS2_RDF_UPTODATE;
186 }
187} 195}
188 196
189/** 197/**