diff options
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r-- | fs/gfs2/glock.c | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index c3dde8560827..4a2e90dc1d02 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -278,31 +278,22 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, uint64_t number, | |||
278 | if (!gl) | 278 | if (!gl) |
279 | return -ENOMEM; | 279 | return -ENOMEM; |
280 | 280 | ||
281 | memset(gl, 0, sizeof(struct gfs2_glock)); | 281 | gl->gl_flags = 0; |
282 | |||
283 | INIT_LIST_HEAD(&gl->gl_list); | ||
284 | gl->gl_name = name; | 282 | gl->gl_name = name; |
285 | kref_init(&gl->gl_ref); | 283 | kref_init(&gl->gl_ref); |
286 | |||
287 | spin_lock_init(&gl->gl_spin); | ||
288 | |||
289 | gl->gl_state = LM_ST_UNLOCKED; | 284 | gl->gl_state = LM_ST_UNLOCKED; |
290 | gl->gl_owner = NULL; | 285 | gl->gl_owner = NULL; |
291 | gl->gl_ip = 0; | 286 | gl->gl_ip = 0; |
292 | INIT_LIST_HEAD(&gl->gl_holders); | ||
293 | INIT_LIST_HEAD(&gl->gl_waiters1); | ||
294 | INIT_LIST_HEAD(&gl->gl_waiters2); | ||
295 | INIT_LIST_HEAD(&gl->gl_waiters3); | ||
296 | |||
297 | gl->gl_ops = glops; | 287 | gl->gl_ops = glops; |
298 | 288 | gl->gl_req_gh = NULL; | |
289 | gl->gl_req_bh = NULL; | ||
290 | gl->gl_vn = 0; | ||
291 | gl->gl_stamp = jiffies; | ||
292 | gl->gl_object = NULL; | ||
299 | gl->gl_bucket = bucket; | 293 | gl->gl_bucket = bucket; |
300 | INIT_LIST_HEAD(&gl->gl_reclaim); | ||
301 | |||
302 | gl->gl_sbd = sdp; | 294 | gl->gl_sbd = sdp; |
303 | 295 | gl->gl_aspace = NULL; | |
304 | lops_init_le(&gl->gl_le, &gfs2_glock_lops); | 296 | lops_init_le(&gl->gl_le, &gfs2_glock_lops); |
305 | INIT_LIST_HEAD(&gl->gl_ail_list); | ||
306 | 297 | ||
307 | /* If this glock protects actual on-disk data or metadata blocks, | 298 | /* If this glock protects actual on-disk data or metadata blocks, |
308 | create a VFS inode to manage the pages/buffers holding them. */ | 299 | create a VFS inode to manage the pages/buffers holding them. */ |
@@ -334,13 +325,11 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, uint64_t number, | |||
334 | 325 | ||
335 | return 0; | 326 | return 0; |
336 | 327 | ||
337 | fail_aspace: | 328 | fail_aspace: |
338 | if (gl->gl_aspace) | 329 | if (gl->gl_aspace) |
339 | gfs2_aspace_put(gl->gl_aspace); | 330 | gfs2_aspace_put(gl->gl_aspace); |
340 | 331 | fail: | |
341 | fail: | ||
342 | kmem_cache_free(gfs2_glock_cachep, gl); | 332 | kmem_cache_free(gfs2_glock_cachep, gl); |
343 | |||
344 | return error; | 333 | return error; |
345 | } | 334 | } |
346 | 335 | ||
@@ -495,9 +484,7 @@ static int rq_promote(struct gfs2_holder *gh) | |||
495 | gfs2_reclaim_glock(sdp); | 484 | gfs2_reclaim_glock(sdp); |
496 | } | 485 | } |
497 | 486 | ||
498 | glops->go_xmote_th(gl, gh->gh_state, | 487 | glops->go_xmote_th(gl, gh->gh_state, gh->gh_flags); |
499 | gh->gh_flags); | ||
500 | |||
501 | spin_lock(&gl->gl_spin); | 488 | spin_lock(&gl->gl_spin); |
502 | } | 489 | } |
503 | return 1; | 490 | return 1; |
@@ -935,8 +922,7 @@ void gfs2_glock_xmote_th(struct gfs2_glock *gl, unsigned int state, int flags) | |||
935 | gfs2_glock_hold(gl); | 922 | gfs2_glock_hold(gl); |
936 | gl->gl_req_bh = xmote_bh; | 923 | gl->gl_req_bh = xmote_bh; |
937 | 924 | ||
938 | lck_ret = gfs2_lm_lock(sdp, gl->gl_lock, gl->gl_state, state, | 925 | lck_ret = gfs2_lm_lock(sdp, gl->gl_lock, gl->gl_state, state, lck_flags); |
939 | lck_flags); | ||
940 | 926 | ||
941 | if (gfs2_assert_withdraw(sdp, !(lck_ret & LM_OUT_ERROR))) | 927 | if (gfs2_assert_withdraw(sdp, !(lck_ret & LM_OUT_ERROR))) |
942 | return; | 928 | return; |
@@ -1019,8 +1005,7 @@ void gfs2_glock_drop_th(struct gfs2_glock *gl) | |||
1019 | 1005 | ||
1020 | if (gl->gl_state == LM_ST_EXCLUSIVE) { | 1006 | if (gl->gl_state == LM_ST_EXCLUSIVE) { |
1021 | if (glops->go_sync) | 1007 | if (glops->go_sync) |
1022 | glops->go_sync(gl, | 1008 | glops->go_sync(gl, DIO_METADATA | DIO_DATA | DIO_RELEASE); |
1023 | DIO_METADATA | DIO_DATA | DIO_RELEASE); | ||
1024 | } | 1009 | } |
1025 | 1010 | ||
1026 | gfs2_glock_hold(gl); | 1011 | gfs2_glock_hold(gl); |