aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/log.c')
-rw-r--r--fs/gfs2/log.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 91645259e135..161ab6f2058e 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -757,7 +757,7 @@ void __gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
757static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr) 757static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
758{ 758{
759 unsigned int reserved; 759 unsigned int reserved;
760 unsigned int old; 760 unsigned int unused;
761 761
762 gfs2_log_lock(sdp); 762 gfs2_log_lock(sdp);
763 763
@@ -769,14 +769,11 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
769 sdp->sd_log_commited_revoke += tr->tr_num_revoke - tr->tr_num_revoke_rm; 769 sdp->sd_log_commited_revoke += tr->tr_num_revoke - tr->tr_num_revoke_rm;
770 gfs2_assert_withdraw(sdp, ((int)sdp->sd_log_commited_revoke) >= 0); 770 gfs2_assert_withdraw(sdp, ((int)sdp->sd_log_commited_revoke) >= 0);
771 reserved = calc_reserved(sdp); 771 reserved = calc_reserved(sdp);
772 old = atomic_read(&sdp->sd_log_blks_free); 772 unused = sdp->sd_log_blks_reserved - reserved + tr->tr_reserved;
773 atomic_add(tr->tr_reserved - (reserved - sdp->sd_log_blks_reserved), 773 gfs2_assert_withdraw(sdp, unused >= 0);
774 &sdp->sd_log_blks_free); 774 atomic_add(unused, &sdp->sd_log_blks_free);
775
776 gfs2_assert_withdraw(sdp, atomic_read(&sdp->sd_log_blks_free) >= old);
777 gfs2_assert_withdraw(sdp, atomic_read(&sdp->sd_log_blks_free) <= 775 gfs2_assert_withdraw(sdp, atomic_read(&sdp->sd_log_blks_free) <=
778 sdp->sd_jdesc->jd_blocks); 776 sdp->sd_jdesc->jd_blocks);
779
780 sdp->sd_log_blks_reserved = reserved; 777 sdp->sd_log_blks_reserved = reserved;
781 778
782 gfs2_log_unlock(sdp); 779 gfs2_log_unlock(sdp);