diff options
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/incore.h | 2 | ||||
-rw-r--r-- | fs/gfs2/log.c | 26 | ||||
-rw-r--r-- | fs/gfs2/ops_fstype.c | 4 |
3 files changed, 16 insertions, 16 deletions
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 911822d1e4c0..7ae0206e9a61 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -595,7 +595,7 @@ struct gfs2_sbd { | |||
595 | struct list_head sd_log_le_databuf; | 595 | struct list_head sd_log_le_databuf; |
596 | struct list_head sd_log_le_ordered; | 596 | struct list_head sd_log_le_ordered; |
597 | 597 | ||
598 | unsigned int sd_log_blks_free; | 598 | atomic_t sd_log_blks_free; |
599 | struct mutex sd_log_reserve_mutex; | 599 | struct mutex sd_log_reserve_mutex; |
600 | 600 | ||
601 | u64 sd_log_sequence; | 601 | u64 sd_log_sequence; |
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index d24684330bc3..9192398408f2 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c | |||
@@ -301,7 +301,7 @@ int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks) | |||
301 | 301 | ||
302 | mutex_lock(&sdp->sd_log_reserve_mutex); | 302 | mutex_lock(&sdp->sd_log_reserve_mutex); |
303 | gfs2_log_lock(sdp); | 303 | gfs2_log_lock(sdp); |
304 | while(sdp->sd_log_blks_free <= (blks + reserved_blks)) { | 304 | while(atomic_read(&sdp->sd_log_blks_free) <= (blks + reserved_blks)) { |
305 | gfs2_log_unlock(sdp); | 305 | gfs2_log_unlock(sdp); |
306 | gfs2_ail1_empty(sdp, 0); | 306 | gfs2_ail1_empty(sdp, 0); |
307 | gfs2_log_flush(sdp, NULL); | 307 | gfs2_log_flush(sdp, NULL); |
@@ -310,7 +310,7 @@ int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks) | |||
310 | gfs2_ail1_start(sdp, 0); | 310 | gfs2_ail1_start(sdp, 0); |
311 | gfs2_log_lock(sdp); | 311 | gfs2_log_lock(sdp); |
312 | } | 312 | } |
313 | sdp->sd_log_blks_free -= blks; | 313 | atomic_sub(blks, &sdp->sd_log_blks_free); |
314 | gfs2_log_unlock(sdp); | 314 | gfs2_log_unlock(sdp); |
315 | mutex_unlock(&sdp->sd_log_reserve_mutex); | 315 | mutex_unlock(&sdp->sd_log_reserve_mutex); |
316 | 316 | ||
@@ -330,9 +330,9 @@ void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks) | |||
330 | { | 330 | { |
331 | 331 | ||
332 | gfs2_log_lock(sdp); | 332 | gfs2_log_lock(sdp); |
333 | sdp->sd_log_blks_free += blks; | 333 | atomic_add(blks, &sdp->sd_log_blks_free); |
334 | gfs2_assert_withdraw(sdp, | 334 | gfs2_assert_withdraw(sdp, |
335 | sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks); | 335 | atomic_read(&sdp->sd_log_blks_free) <= sdp->sd_jdesc->jd_blocks); |
336 | gfs2_log_unlock(sdp); | 336 | gfs2_log_unlock(sdp); |
337 | up_read(&sdp->sd_log_flush_lock); | 337 | up_read(&sdp->sd_log_flush_lock); |
338 | } | 338 | } |
@@ -559,8 +559,8 @@ static void log_pull_tail(struct gfs2_sbd *sdp, unsigned int new_tail) | |||
559 | ail2_empty(sdp, new_tail); | 559 | ail2_empty(sdp, new_tail); |
560 | 560 | ||
561 | gfs2_log_lock(sdp); | 561 | gfs2_log_lock(sdp); |
562 | sdp->sd_log_blks_free += dist; | 562 | atomic_add(dist, &sdp->sd_log_blks_free); |
563 | gfs2_assert_withdraw(sdp, sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks); | 563 | gfs2_assert_withdraw(sdp, atomic_read(&sdp->sd_log_blks_free) <= sdp->sd_jdesc->jd_blocks); |
564 | gfs2_log_unlock(sdp); | 564 | gfs2_log_unlock(sdp); |
565 | 565 | ||
566 | sdp->sd_log_tail = new_tail; | 566 | sdp->sd_log_tail = new_tail; |
@@ -733,7 +733,7 @@ void __gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl) | |||
733 | log_flush_commit(sdp); | 733 | log_flush_commit(sdp); |
734 | else if (sdp->sd_log_tail != current_tail(sdp) && !sdp->sd_log_idle){ | 734 | else if (sdp->sd_log_tail != current_tail(sdp) && !sdp->sd_log_idle){ |
735 | gfs2_log_lock(sdp); | 735 | gfs2_log_lock(sdp); |
736 | sdp->sd_log_blks_free--; /* Adjust for unreserved buffer */ | 736 | atomic_dec(&sdp->sd_log_blks_free); /* Adjust for unreserved buffer */ |
737 | gfs2_log_unlock(sdp); | 737 | gfs2_log_unlock(sdp); |
738 | log_write_header(sdp, 0, PULL); | 738 | log_write_header(sdp, 0, PULL); |
739 | } | 739 | } |
@@ -773,12 +773,12 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr) | |||
773 | sdp->sd_log_commited_revoke += tr->tr_num_revoke - tr->tr_num_revoke_rm; | 773 | sdp->sd_log_commited_revoke += tr->tr_num_revoke - tr->tr_num_revoke_rm; |
774 | gfs2_assert_withdraw(sdp, ((int)sdp->sd_log_commited_revoke) >= 0); | 774 | gfs2_assert_withdraw(sdp, ((int)sdp->sd_log_commited_revoke) >= 0); |
775 | reserved = calc_reserved(sdp); | 775 | reserved = calc_reserved(sdp); |
776 | old = sdp->sd_log_blks_free; | 776 | old = atomic_read(&sdp->sd_log_blks_free); |
777 | sdp->sd_log_blks_free += tr->tr_reserved - | 777 | atomic_add(tr->tr_reserved - (reserved - sdp->sd_log_blks_reserved), |
778 | (reserved - sdp->sd_log_blks_reserved); | 778 | &sdp->sd_log_blks_free); |
779 | 779 | ||
780 | gfs2_assert_withdraw(sdp, sdp->sd_log_blks_free >= old); | 780 | gfs2_assert_withdraw(sdp, atomic_read(&sdp->sd_log_blks_free) >= old); |
781 | gfs2_assert_withdraw(sdp, sdp->sd_log_blks_free <= | 781 | gfs2_assert_withdraw(sdp, atomic_read(&sdp->sd_log_blks_free) <= |
782 | sdp->sd_jdesc->jd_blocks); | 782 | sdp->sd_jdesc->jd_blocks); |
783 | 783 | ||
784 | sdp->sd_log_blks_reserved = reserved; | 784 | sdp->sd_log_blks_reserved = reserved; |
@@ -831,7 +831,7 @@ void gfs2_log_shutdown(struct gfs2_sbd *sdp) | |||
831 | log_write_header(sdp, GFS2_LOG_HEAD_UNMOUNT, | 831 | log_write_header(sdp, GFS2_LOG_HEAD_UNMOUNT, |
832 | (sdp->sd_log_tail == current_tail(sdp)) ? 0 : PULL); | 832 | (sdp->sd_log_tail == current_tail(sdp)) ? 0 : PULL); |
833 | 833 | ||
834 | gfs2_assert_warn(sdp, sdp->sd_log_blks_free == sdp->sd_jdesc->jd_blocks); | 834 | gfs2_assert_warn(sdp, atomic_read(&sdp->sd_log_blks_free) == sdp->sd_jdesc->jd_blocks); |
835 | gfs2_assert_warn(sdp, sdp->sd_log_head == sdp->sd_log_tail); | 835 | gfs2_assert_warn(sdp, sdp->sd_log_head == sdp->sd_log_tail); |
836 | gfs2_assert_warn(sdp, list_empty(&sdp->sd_ail2_list)); | 836 | gfs2_assert_warn(sdp, list_empty(&sdp->sd_ail2_list)); |
837 | 837 | ||
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 52aaba96d5da..1bba6ac0bcac 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -339,7 +339,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo) | |||
339 | 339 | ||
340 | if (sdp->sd_args.ar_spectator) { | 340 | if (sdp->sd_args.ar_spectator) { |
341 | sdp->sd_jdesc = gfs2_jdesc_find(sdp, 0); | 341 | sdp->sd_jdesc = gfs2_jdesc_find(sdp, 0); |
342 | sdp->sd_log_blks_free = sdp->sd_jdesc->jd_blocks; | 342 | atomic_set(&sdp->sd_log_blks_free, sdp->sd_jdesc->jd_blocks); |
343 | } else { | 343 | } else { |
344 | if (sdp->sd_lockstruct.ls_jid >= gfs2_jindex_size(sdp)) { | 344 | if (sdp->sd_lockstruct.ls_jid >= gfs2_jindex_size(sdp)) { |
345 | fs_err(sdp, "can't mount journal #%u\n", | 345 | fs_err(sdp, "can't mount journal #%u\n", |
@@ -376,7 +376,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo) | |||
376 | sdp->sd_jdesc->jd_jid, error); | 376 | sdp->sd_jdesc->jd_jid, error); |
377 | goto fail_jinode_gh; | 377 | goto fail_jinode_gh; |
378 | } | 378 | } |
379 | sdp->sd_log_blks_free = sdp->sd_jdesc->jd_blocks; | 379 | atomic_set(&sdp->sd_log_blks_free, sdp->sd_jdesc->jd_blocks); |
380 | } | 380 | } |
381 | 381 | ||
382 | if (sdp->sd_lockstruct.ls_first) { | 382 | if (sdp->sd_lockstruct.ls_first) { |