return reserved;
}
-- static unsigned int current_tail(struct gfs2_sbd *sdp)
- {
- struct gfs2_trans *tr;
- unsigned int tail;
-
- spin_lock(&sdp->sd_ail_lock);
-
- if (list_empty(&sdp->sd_ail1_list)) {
- tail = sdp->sd_log_head;
- } else {
- tr = list_last_entry(&sdp->sd_ail1_list, struct gfs2_trans,
- tr_list);
- tail = tr->tr_first;
- }
-
- spin_unlock(&sdp->sd_ail_lock);
-
- return tail;
- }
-
- static void log_pull_tail(struct gfs2_sbd *sdp, unsigned int new_tail)
++ static void log_pull_tail(struct gfs2_sbd *sdp)
{
- struct gfs2_trans *tr;
- unsigned int tail;
-
- spin_lock(&sdp->sd_ail_lock);
-
- if (list_empty(&sdp->sd_ail1_list)) {
- tail = sdp->sd_log_head;
- } else {
- tr = list_last_entry(&sdp->sd_ail1_list, struct gfs2_trans,
- tr_list);
- tail = tr->tr_first;
- }
-
- spin_unlock(&sdp->sd_ail_lock);
-
- return tail;
- }
-
- static void log_pull_tail(struct gfs2_sbd *sdp, unsigned int new_tail)
- {
-- unsigned int dist = log_distance(sdp, new_tail, sdp->sd_log_tail);
++ unsigned int new_tail = sdp->sd_log_flush_tail;
++ unsigned int dist;
++ if (new_tail == sdp->sd_log_tail)
++ return;
++ dist = log_distance(sdp, new_tail, sdp->sd_log_tail);
ail2_empty(sdp, new_tail);
--
-- atomic_add(dist, &sdp->sd_log_blks_free);
-- trace_gfs2_log_blocks(sdp, dist);
-- gfs2_assert_withdraw(sdp, atomic_read(&sdp->sd_log_blks_free) <=
-- sdp->sd_jdesc->jd_blocks);
--
++ gfs2_log_release(sdp, dist);
sdp->sd_log_tail = new_tail;
}
sb->s_blocksize - LH_V1_SIZE - 4);
lh->lh_crc = cpu_to_be32(crc);
-- gfs2_log_write(sdp, page, sb->s_blocksize, 0, dblock);
-- gfs2_log_submit_bio(&sdp->sd_log_bio, REQ_OP_WRITE | op_flags);
- out:
- log_flush_wait(sdp);
++ gfs2_log_write(sdp, jd, page, sb->s_blocksize, 0, dblock);
++ gfs2_log_submit_bio(&jd->jd_log_bio, REQ_OP_WRITE | op_flags);
- out:
- log_flush_wait(sdp);
}
/**
goto out_withdraw;
if (sdp->sd_log_head != sdp->sd_log_flush_head) {
-- log_flush_wait(sdp);
log_write_header(sdp, flags);
-- } else if (sdp->sd_log_tail != current_tail(sdp) && !sdp->sd_log_idle){
-- atomic_dec(&sdp->sd_log_blks_free); /* Adjust for unreserved buffer */
-- trace_gfs2_log_blocks(sdp, -1);
++ } else if (sdp->sd_log_tail != sdp->sd_log_flush_tail && !sdp->sd_log_idle) {
log_write_header(sdp, flags);
}
if (gfs2_withdrawn(sdp))
gfs2_log_flush(sdp, NULL, GFS2_LOG_HEAD_FLUSH_SHUTDOWN |
GFS2_LFC_MAKE_FS_RO);
-- wait_event(sdp->sd_reserving_log_wait,
-- atomic_read(&sdp->sd_reserving_log) == 0);
-- gfs2_assert_warn(sdp, atomic_read(&sdp->sd_log_blks_free) ==
-- sdp->sd_jdesc->jd_blocks);
++ wait_event_timeout(sdp->sd_log_waitq,
++ gfs2_log_is_empty(sdp),
++ HZ * 5);
++ gfs2_assert_warn(sdp, gfs2_log_is_empty(sdp));
} else {
-- wait_event_timeout(sdp->sd_reserving_log_wait,
-- atomic_read(&sdp->sd_reserving_log) == 0,
++ wait_event_timeout(sdp->sd_log_waitq,
++ gfs2_log_is_empty(sdp),
HZ * 5);
}
-- if (gfs2_holder_initialized(&freeze_gh))
-- gfs2_glock_dq_uninit(&freeze_gh);
--
gfs2_quota_cleanup(sdp);
if (!log_write_allowed)