aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-11-20 10:37:45 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-11-30 10:36:30 -0500
commit1a14d3a68f04527546121eb7b45187ff6af63151 (patch)
tree7bc48436f7c6aad5433398311b67a10661e2633d /fs
parentfa2ecfc5e11b12f25b67f9c84ac6b0e74a6a0115 (diff)
[GFS2] Simplify glops functions
The go_sync callback took two flags, but one of them was set on every call, so this patch removes once of the flags and makes the previously conditional operations (on this flag), unconditional. The go_inval callback took three flags, each of which was set on every call to it. This patch removes the flags and makes the operations unconditional, which makes the logic rather more obvious. Two now unused flags are also removed from incore.h. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/gfs2/glock.c10
-rw-r--r--fs/gfs2/glops.c42
-rw-r--r--fs/gfs2/incore.h25
-rw-r--r--fs/gfs2/super.c2
4 files changed, 28 insertions, 51 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index edc21c8d7faa..b8ba4d5c1d9e 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -847,12 +847,12 @@ static void xmote_bh(struct gfs2_glock *gl, unsigned int ret)
847 847
848 if (prev_state != LM_ST_UNLOCKED && !(ret & LM_OUT_CACHEABLE)) { 848 if (prev_state != LM_ST_UNLOCKED && !(ret & LM_OUT_CACHEABLE)) {
849 if (glops->go_inval) 849 if (glops->go_inval)
850 glops->go_inval(gl, DIO_METADATA | DIO_DATA); 850 glops->go_inval(gl, DIO_METADATA);
851 } else if (gl->gl_state == LM_ST_DEFERRED) { 851 } else if (gl->gl_state == LM_ST_DEFERRED) {
852 /* We might not want to do this here. 852 /* We might not want to do this here.
853 Look at moving to the inode glops. */ 853 Look at moving to the inode glops. */
854 if (glops->go_inval) 854 if (glops->go_inval)
855 glops->go_inval(gl, DIO_DATA); 855 glops->go_inval(gl, 0);
856 } 856 }
857 857
858 /* Deal with each possible exit condition */ 858 /* Deal with each possible exit condition */
@@ -954,7 +954,7 @@ void gfs2_glock_xmote_th(struct gfs2_glock *gl, unsigned int state, int flags)
954 gfs2_assert_warn(sdp, state != gl->gl_state); 954 gfs2_assert_warn(sdp, state != gl->gl_state);
955 955
956 if (gl->gl_state == LM_ST_EXCLUSIVE && glops->go_sync) 956 if (gl->gl_state == LM_ST_EXCLUSIVE && glops->go_sync)
957 glops->go_sync(gl, DIO_METADATA | DIO_DATA | DIO_RELEASE); 957 glops->go_sync(gl);
958 958
959 gfs2_glock_hold(gl); 959 gfs2_glock_hold(gl);
960 gl->gl_req_bh = xmote_bh; 960 gl->gl_req_bh = xmote_bh;
@@ -995,7 +995,7 @@ static void drop_bh(struct gfs2_glock *gl, unsigned int ret)
995 state_change(gl, LM_ST_UNLOCKED); 995 state_change(gl, LM_ST_UNLOCKED);
996 996
997 if (glops->go_inval) 997 if (glops->go_inval)
998 glops->go_inval(gl, DIO_METADATA | DIO_DATA); 998 glops->go_inval(gl, DIO_METADATA);
999 999
1000 if (gh) { 1000 if (gh) {
1001 spin_lock(&gl->gl_spin); 1001 spin_lock(&gl->gl_spin);
@@ -1041,7 +1041,7 @@ void gfs2_glock_drop_th(struct gfs2_glock *gl)
1041 gfs2_assert_warn(sdp, gl->gl_state != LM_ST_UNLOCKED); 1041 gfs2_assert_warn(sdp, gl->gl_state != LM_ST_UNLOCKED);
1042 1042
1043 if (gl->gl_state == LM_ST_EXCLUSIVE && glops->go_sync) 1043 if (gl->gl_state == LM_ST_EXCLUSIVE && glops->go_sync)
1044 glops->go_sync(gl, DIO_METADATA | DIO_DATA | DIO_RELEASE); 1044 glops->go_sync(gl);
1045 1045
1046 gfs2_glock_hold(gl); 1046 gfs2_glock_hold(gl);
1047 gl->gl_req_bh = drop_bh; 1047 gl->gl_req_bh = drop_bh;
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index b92de0af0bf3..60561ca070c2 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -173,23 +173,18 @@ static void gfs2_page_writeback(struct gfs2_glock *gl)
173/** 173/**
174 * meta_go_sync - sync out the metadata for this glock 174 * meta_go_sync - sync out the metadata for this glock
175 * @gl: the glock 175 * @gl: the glock
176 * @flags: DIO_*
177 * 176 *
178 * Called when demoting or unlocking an EX glock. We must flush 177 * Called when demoting or unlocking an EX glock. We must flush
179 * to disk all dirty buffers/pages relating to this glock, and must not 178 * to disk all dirty buffers/pages relating to this glock, and must not
180 * not return to caller to demote/unlock the glock until I/O is complete. 179 * not return to caller to demote/unlock the glock until I/O is complete.
181 */ 180 */
182 181
183static void meta_go_sync(struct gfs2_glock *gl, int flags) 182static void meta_go_sync(struct gfs2_glock *gl)
184{ 183{
185 if (!(flags & DIO_METADATA))
186 return;
187
188 if (test_and_clear_bit(GLF_DIRTY, &gl->gl_flags)) { 184 if (test_and_clear_bit(GLF_DIRTY, &gl->gl_flags)) {
189 gfs2_log_flush(gl->gl_sbd, gl); 185 gfs2_log_flush(gl->gl_sbd, gl);
190 gfs2_meta_sync(gl); 186 gfs2_meta_sync(gl);
191 if (flags & DIO_RELEASE) 187 gfs2_ail_empty_gl(gl);
192 gfs2_ail_empty_gl(gl);
193 } 188 }
194 189
195} 190}
@@ -264,31 +259,18 @@ static void inode_go_drop_th(struct gfs2_glock *gl)
264/** 259/**
265 * inode_go_sync - Sync the dirty data and/or metadata for an inode glock 260 * inode_go_sync - Sync the dirty data and/or metadata for an inode glock
266 * @gl: the glock protecting the inode 261 * @gl: the glock protecting the inode
267 * @flags:
268 * 262 *
269 */ 263 */
270 264
271static void inode_go_sync(struct gfs2_glock *gl, int flags) 265static void inode_go_sync(struct gfs2_glock *gl)
272{ 266{
273 int meta = (flags & DIO_METADATA);
274 int data = (flags & DIO_DATA);
275
276 if (test_bit(GLF_DIRTY, &gl->gl_flags)) { 267 if (test_bit(GLF_DIRTY, &gl->gl_flags)) {
277 if (meta && data) { 268 gfs2_page_writeback(gl);
278 gfs2_page_writeback(gl); 269 gfs2_log_flush(gl->gl_sbd, gl);
279 gfs2_log_flush(gl->gl_sbd, gl); 270 gfs2_meta_sync(gl);
280 gfs2_meta_sync(gl); 271 gfs2_page_wait(gl);
281 gfs2_page_wait(gl); 272 clear_bit(GLF_DIRTY, &gl->gl_flags);
282 clear_bit(GLF_DIRTY, &gl->gl_flags); 273 gfs2_ail_empty_gl(gl);
283 } else if (meta) {
284 gfs2_log_flush(gl->gl_sbd, gl);
285 gfs2_meta_sync(gl);
286 } else if (data) {
287 gfs2_page_writeback(gl);
288 gfs2_page_wait(gl);
289 }
290 if (flags & DIO_RELEASE)
291 gfs2_ail_empty_gl(gl);
292 } 274 }
293} 275}
294 276
@@ -302,15 +284,13 @@ static void inode_go_sync(struct gfs2_glock *gl, int flags)
302static void inode_go_inval(struct gfs2_glock *gl, int flags) 284static void inode_go_inval(struct gfs2_glock *gl, int flags)
303{ 285{
304 int meta = (flags & DIO_METADATA); 286 int meta = (flags & DIO_METADATA);
305 int data = (flags & DIO_DATA);
306 287
307 if (meta) { 288 if (meta) {
308 struct gfs2_inode *ip = gl->gl_object; 289 struct gfs2_inode *ip = gl->gl_object;
309 gfs2_meta_inval(gl); 290 gfs2_meta_inval(gl);
310 set_bit(GIF_INVALID, &ip->i_flags); 291 set_bit(GIF_INVALID, &ip->i_flags);
311 } 292 }
312 if (data) 293 gfs2_page_inval(gl);
313 gfs2_page_inval(gl);
314} 294}
315 295
316/** 296/**
@@ -494,7 +474,7 @@ static void trans_go_xmote_bh(struct gfs2_glock *gl)
494 if (gl->gl_state != LM_ST_UNLOCKED && 474 if (gl->gl_state != LM_ST_UNLOCKED &&
495 test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) { 475 test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) {
496 gfs2_meta_cache_flush(GFS2_I(sdp->sd_jdesc->jd_inode)); 476 gfs2_meta_cache_flush(GFS2_I(sdp->sd_jdesc->jd_inode));
497 j_gl->gl_ops->go_inval(j_gl, DIO_METADATA | DIO_DATA); 477 j_gl->gl_ops->go_inval(j_gl, DIO_METADATA);
498 478
499 error = gfs2_find_jhead(sdp->sd_jdesc, &head); 479 error = gfs2_find_jhead(sdp->sd_jdesc, &head);
500 if (error) 480 if (error)
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 227a74dc5ec0..734421edae85 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -14,8 +14,6 @@
14 14
15#define DIO_WAIT 0x00000010 15#define DIO_WAIT 0x00000010
16#define DIO_METADATA 0x00000020 16#define DIO_METADATA 0x00000020
17#define DIO_DATA 0x00000040
18#define DIO_RELEASE 0x00000080
19#define DIO_ALL 0x00000100 17#define DIO_ALL 0x00000100
20 18
21struct gfs2_log_operations; 19struct gfs2_log_operations;
@@ -103,18 +101,17 @@ struct gfs2_bufdata {
103}; 101};
104 102
105struct gfs2_glock_operations { 103struct gfs2_glock_operations {
106 void (*go_xmote_th) (struct gfs2_glock * gl, unsigned int state, 104 void (*go_xmote_th) (struct gfs2_glock *gl, unsigned int state, int flags);
107 int flags); 105 void (*go_xmote_bh) (struct gfs2_glock *gl);
108 void (*go_xmote_bh) (struct gfs2_glock * gl); 106 void (*go_drop_th) (struct gfs2_glock *gl);
109 void (*go_drop_th) (struct gfs2_glock * gl); 107 void (*go_drop_bh) (struct gfs2_glock *gl);
110 void (*go_drop_bh) (struct gfs2_glock * gl); 108 void (*go_sync) (struct gfs2_glock *gl);
111 void (*go_sync) (struct gfs2_glock * gl, int flags); 109 void (*go_inval) (struct gfs2_glock *gl, int flags);
112 void (*go_inval) (struct gfs2_glock * gl, int flags); 110 int (*go_demote_ok) (struct gfs2_glock *gl);
113 int (*go_demote_ok) (struct gfs2_glock * gl); 111 int (*go_lock) (struct gfs2_holder *gh);
114 int (*go_lock) (struct gfs2_holder * gh); 112 void (*go_unlock) (struct gfs2_holder *gh);
115 void (*go_unlock) (struct gfs2_holder * gh); 113 void (*go_callback) (struct gfs2_glock *gl, unsigned int state);
116 void (*go_callback) (struct gfs2_glock * gl, unsigned int state); 114 void (*go_greedy) (struct gfs2_glock *gl);
117 void (*go_greedy) (struct gfs2_glock * gl);
118 const int go_type; 115 const int go_type;
119}; 116};
120 117
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 0ef831727086..1408c5f31379 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -517,7 +517,7 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp)
517 return error; 517 return error;
518 518
519 gfs2_meta_cache_flush(ip); 519 gfs2_meta_cache_flush(ip);
520 j_gl->gl_ops->go_inval(j_gl, DIO_METADATA | DIO_DATA); 520 j_gl->gl_ops->go_inval(j_gl, DIO_METADATA);
521 521
522 error = gfs2_find_jhead(sdp->sd_jdesc, &head); 522 error = gfs2_find_jhead(sdp->sd_jdesc, &head);
523 if (error) 523 if (error)