Lines Matching refs:gl
34 static void gfs2_ail_error(struct gfs2_glock *gl, const struct buffer_head *bh) in gfs2_ail_error() argument
36 fs_err(gl->gl_name.ln_sbd, in gfs2_ail_error()
41 fs_err(gl->gl_name.ln_sbd, "AIL glock %u:%llu mapping %p\n", in gfs2_ail_error()
42 gl->gl_name.ln_type, gl->gl_name.ln_number, in gfs2_ail_error()
43 gfs2_glock2aspace(gl)); in gfs2_ail_error()
44 gfs2_lm_withdraw(gl->gl_name.ln_sbd, "AIL error\n"); in gfs2_ail_error()
55 static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync, in __gfs2_ail_flush() argument
58 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; in __gfs2_ail_flush()
59 struct list_head *head = &gl->gl_ail_list; in __gfs2_ail_flush()
73 gfs2_ail_error(gl, bh); in __gfs2_ail_flush()
78 GLOCK_BUG_ON(gl, !fsync && atomic_read(&gl->gl_ail_count)); in __gfs2_ail_flush()
84 static void gfs2_ail_empty_gl(struct gfs2_glock *gl) in gfs2_ail_empty_gl() argument
86 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; in gfs2_ail_empty_gl()
92 tr.tr_revokes = atomic_read(&gl->gl_ail_count); in gfs2_ail_empty_gl()
107 __gfs2_ail_flush(gl, 0, tr.tr_revokes); in gfs2_ail_empty_gl()
114 void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) in gfs2_ail_flush() argument
116 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; in gfs2_ail_flush()
117 unsigned int revokes = atomic_read(&gl->gl_ail_count); in gfs2_ail_flush()
130 __gfs2_ail_flush(gl, fsync, max_revokes); in gfs2_ail_flush()
145 static void rgrp_go_sync(struct gfs2_glock *gl) in rgrp_go_sync() argument
147 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; in rgrp_go_sync()
152 spin_lock(&gl->gl_lockref.lock); in rgrp_go_sync()
153 rgd = gl->gl_object; in rgrp_go_sync()
156 spin_unlock(&gl->gl_lockref.lock); in rgrp_go_sync()
158 if (!test_and_clear_bit(GLF_DIRTY, &gl->gl_flags)) in rgrp_go_sync()
160 GLOCK_BUG_ON(gl, gl->gl_state != LM_ST_EXCLUSIVE); in rgrp_go_sync()
162 gfs2_log_flush(sdp, gl, GFS2_LOG_HEAD_FLUSH_NORMAL | in rgrp_go_sync()
164 filemap_fdatawrite_range(mapping, gl->gl_vm.start, gl->gl_vm.end); in rgrp_go_sync()
165 error = filemap_fdatawait_range(mapping, gl->gl_vm.start, gl->gl_vm.end); in rgrp_go_sync()
167 gfs2_ail_empty_gl(gl); in rgrp_go_sync()
169 spin_lock(&gl->gl_lockref.lock); in rgrp_go_sync()
170 rgd = gl->gl_object; in rgrp_go_sync()
173 spin_unlock(&gl->gl_lockref.lock); in rgrp_go_sync()
186 static void rgrp_go_inval(struct gfs2_glock *gl, int flags) in rgrp_go_inval() argument
188 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; in rgrp_go_inval()
190 struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(gl); in rgrp_go_inval()
196 gfs2_assert_withdraw(sdp, !atomic_read(&gl->gl_ail_count)); in rgrp_go_inval()
197 truncate_inode_pages_range(mapping, gl->gl_vm.start, gl->gl_vm.end); in rgrp_go_inval()
203 static struct gfs2_inode *gfs2_glock2inode(struct gfs2_glock *gl) in gfs2_glock2inode() argument
207 spin_lock(&gl->gl_lockref.lock); in gfs2_glock2inode()
208 ip = gl->gl_object; in gfs2_glock2inode()
211 spin_unlock(&gl->gl_lockref.lock); in gfs2_glock2inode()
215 struct gfs2_rgrpd *gfs2_glock2rgrp(struct gfs2_glock *gl) in gfs2_glock2rgrp() argument
219 spin_lock(&gl->gl_lockref.lock); in gfs2_glock2rgrp()
220 rgd = gl->gl_object; in gfs2_glock2rgrp()
221 spin_unlock(&gl->gl_lockref.lock); in gfs2_glock2rgrp()
241 static void inode_go_sync(struct gfs2_glock *gl) in inode_go_sync() argument
243 struct gfs2_inode *ip = gfs2_glock2inode(gl); in inode_go_sync()
245 struct address_space *metamapping = gfs2_glock2aspace(gl); in inode_go_sync()
253 if (!test_and_clear_bit(GLF_DIRTY, &gl->gl_flags)) in inode_go_sync()
256 GLOCK_BUG_ON(gl, gl->gl_state != LM_ST_EXCLUSIVE); in inode_go_sync()
258 gfs2_log_flush(gl->gl_name.ln_sbd, gl, GFS2_LOG_HEAD_FLUSH_NORMAL | in inode_go_sync()
269 gfs2_ail_empty_gl(gl); in inode_go_sync()
275 clear_bit(GLF_DIRTY, &gl->gl_flags); in inode_go_sync()
292 static void inode_go_inval(struct gfs2_glock *gl, int flags) in inode_go_inval() argument
294 struct gfs2_inode *ip = gfs2_glock2inode(gl); in inode_go_inval()
296 gfs2_assert_withdraw(gl->gl_name.ln_sbd, !atomic_read(&gl->gl_ail_count)); in inode_go_inval()
299 struct address_space *mapping = gfs2_glock2aspace(gl); in inode_go_inval()
309 if (ip == GFS2_I(gl->gl_name.ln_sbd->sd_rindex)) { in inode_go_inval()
310 gfs2_log_flush(gl->gl_name.ln_sbd, NULL, in inode_go_inval()
313 gl->gl_name.ln_sbd->sd_rindex_uptodate = 0; in inode_go_inval()
328 static int inode_go_demote_ok(const struct gfs2_glock *gl) in inode_go_demote_ok() argument
330 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; in inode_go_demote_ok()
332 if (sdp->sd_jindex == gl->gl_object || sdp->sd_rindex == gl->gl_object) in inode_go_demote_ok()
431 struct gfs2_glock *gl = gh->gh_gl; in inode_go_lock() local
432 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; in inode_go_lock()
433 struct gfs2_inode *ip = gl->gl_object; in inode_go_lock()
449 (gl->gl_state == LM_ST_EXCLUSIVE) && in inode_go_lock()
469 static void inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl) in inode_go_dump() argument
471 const struct gfs2_inode *ip = gl->gl_object; in inode_go_dump()
490 static void freeze_go_sync(struct gfs2_glock *gl) in freeze_go_sync() argument
493 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; in freeze_go_sync()
495 if (gl->gl_state == LM_ST_SHARED && in freeze_go_sync()
515 static int freeze_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh) in freeze_go_xmote_bh() argument
517 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; in freeze_go_xmote_bh()
548 static int freeze_go_demote_ok(const struct gfs2_glock *gl) in freeze_go_demote_ok() argument
559 static void iopen_go_callback(struct gfs2_glock *gl, bool remote) in iopen_go_callback() argument
561 struct gfs2_inode *ip = gl->gl_object; in iopen_go_callback()
562 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; in iopen_go_callback()
567 if (gl->gl_demote_state == LM_ST_UNLOCKED && in iopen_go_callback()
568 gl->gl_state == LM_ST_SHARED && ip) { in iopen_go_callback()
569 gl->gl_lockref.count++; in iopen_go_callback()
570 if (queue_work(gfs2_delete_workqueue, &gl->gl_delete) == 0) in iopen_go_callback()
571 gl->gl_lockref.count--; in iopen_go_callback()