aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/glops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/glops.c')
-rw-r--r--fs/gfs2/glops.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 6985eef06c39..49f97d3bb690 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -7,12 +7,12 @@
7 * of the GNU General Public License version 2. 7 * of the GNU General Public License version 2.
8 */ 8 */
9 9
10#include <linux/slab.h>
11#include <linux/spinlock.h> 10#include <linux/spinlock.h>
12#include <linux/completion.h> 11#include <linux/completion.h>
13#include <linux/buffer_head.h> 12#include <linux/buffer_head.h>
14#include <linux/gfs2_ondisk.h> 13#include <linux/gfs2_ondisk.h>
15#include <linux/bio.h> 14#include <linux/bio.h>
15#include <linux/posix_acl.h>
16 16
17#include "gfs2.h" 17#include "gfs2.h"
18#include "incore.h" 18#include "incore.h"
@@ -86,7 +86,7 @@ static void gfs2_ail_empty_gl(struct gfs2_glock *gl)
86 86
87static void rgrp_go_sync(struct gfs2_glock *gl) 87static void rgrp_go_sync(struct gfs2_glock *gl)
88{ 88{
89 struct address_space *metamapping = gl->gl_aspace->i_mapping; 89 struct address_space *metamapping = gfs2_glock2aspace(gl);
90 int error; 90 int error;
91 91
92 if (!test_and_clear_bit(GLF_DIRTY, &gl->gl_flags)) 92 if (!test_and_clear_bit(GLF_DIRTY, &gl->gl_flags))
@@ -112,7 +112,7 @@ static void rgrp_go_sync(struct gfs2_glock *gl)
112 112
113static void rgrp_go_inval(struct gfs2_glock *gl, int flags) 113static void rgrp_go_inval(struct gfs2_glock *gl, int flags)
114{ 114{
115 struct address_space *mapping = gl->gl_aspace->i_mapping; 115 struct address_space *mapping = gfs2_glock2aspace(gl);
116 116
117 BUG_ON(!(flags & DIO_METADATA)); 117 BUG_ON(!(flags & DIO_METADATA));
118 gfs2_assert_withdraw(gl->gl_sbd, !atomic_read(&gl->gl_ail_count)); 118 gfs2_assert_withdraw(gl->gl_sbd, !atomic_read(&gl->gl_ail_count));
@@ -133,7 +133,7 @@ static void rgrp_go_inval(struct gfs2_glock *gl, int flags)
133static void inode_go_sync(struct gfs2_glock *gl) 133static void inode_go_sync(struct gfs2_glock *gl)
134{ 134{
135 struct gfs2_inode *ip = gl->gl_object; 135 struct gfs2_inode *ip = gl->gl_object;
136 struct address_space *metamapping = gl->gl_aspace->i_mapping; 136 struct address_space *metamapping = gfs2_glock2aspace(gl);
137 int error; 137 int error;
138 138
139 if (ip && !S_ISREG(ip->i_inode.i_mode)) 139 if (ip && !S_ISREG(ip->i_inode.i_mode))
@@ -182,10 +182,12 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags)
182 gfs2_assert_withdraw(gl->gl_sbd, !atomic_read(&gl->gl_ail_count)); 182 gfs2_assert_withdraw(gl->gl_sbd, !atomic_read(&gl->gl_ail_count));
183 183
184 if (flags & DIO_METADATA) { 184 if (flags & DIO_METADATA) {
185 struct address_space *mapping = gl->gl_aspace->i_mapping; 185 struct address_space *mapping = gfs2_glock2aspace(gl);
186 truncate_inode_pages(mapping, 0); 186 truncate_inode_pages(mapping, 0);
187 if (ip) 187 if (ip) {
188 set_bit(GIF_INVALID, &ip->i_flags); 188 set_bit(GIF_INVALID, &ip->i_flags);
189 forget_all_cached_acls(&ip->i_inode);
190 }
189 } 191 }
190 192
191 if (ip == GFS2_I(gl->gl_sbd->sd_rindex)) 193 if (ip == GFS2_I(gl->gl_sbd->sd_rindex))
@@ -279,7 +281,8 @@ static int inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl)
279 281
280static int rgrp_go_demote_ok(const struct gfs2_glock *gl) 282static int rgrp_go_demote_ok(const struct gfs2_glock *gl)
281{ 283{
282 return !gl->gl_aspace->i_mapping->nrpages; 284 const struct address_space *mapping = (const struct address_space *)(gl + 1);
285 return !mapping->nrpages;
283} 286}
284 287
285/** 288/**
@@ -384,8 +387,7 @@ static void iopen_go_callback(struct gfs2_glock *gl)
384 struct gfs2_inode *ip = (struct gfs2_inode *)gl->gl_object; 387 struct gfs2_inode *ip = (struct gfs2_inode *)gl->gl_object;
385 388
386 if (gl->gl_demote_state == LM_ST_UNLOCKED && 389 if (gl->gl_demote_state == LM_ST_UNLOCKED &&
387 gl->gl_state == LM_ST_SHARED && 390 gl->gl_state == LM_ST_SHARED && ip) {
388 ip && test_bit(GIF_USER, &ip->i_flags)) {
389 gfs2_glock_hold(gl); 391 gfs2_glock_hold(gl);
390 if (queue_work(gfs2_delete_workqueue, &gl->gl_delete) == 0) 392 if (queue_work(gfs2_delete_workqueue, &gl->gl_delete) == 0)
391 gfs2_glock_put_nolock(gl); 393 gfs2_glock_put_nolock(gl);
@@ -404,6 +406,7 @@ const struct gfs2_glock_operations gfs2_inode_glops = {
404 .go_dump = inode_go_dump, 406 .go_dump = inode_go_dump,
405 .go_type = LM_TYPE_INODE, 407 .go_type = LM_TYPE_INODE,
406 .go_min_hold_time = HZ / 5, 408 .go_min_hold_time = HZ / 5,
409 .go_flags = GLOF_ASPACE,
407}; 410};
408 411
409const struct gfs2_glock_operations gfs2_rgrp_glops = { 412const struct gfs2_glock_operations gfs2_rgrp_glops = {
@@ -415,6 +418,7 @@ const struct gfs2_glock_operations gfs2_rgrp_glops = {
415 .go_dump = gfs2_rgrp_dump, 418 .go_dump = gfs2_rgrp_dump,
416 .go_type = LM_TYPE_RGRP, 419 .go_type = LM_TYPE_RGRP,
417 .go_min_hold_time = HZ / 5, 420 .go_min_hold_time = HZ / 5,
421 .go_flags = GLOF_ASPACE,
418}; 422};
419 423
420const struct gfs2_glock_operations gfs2_trans_glops = { 424const struct gfs2_glock_operations gfs2_trans_glops = {