xfs: fold __xlog_state_release_iclog into xlog_state_release_iclog
Fold __xlog_state_release_iclog into its only caller to prepare make an upcoming fix easier. Signed-off-by: Dave Chinner <dchinner@redhat.com> [hch: split from a larger patch] Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
This commit is contained in:
Родитель
b5d721eaae
Коммит
9d39206440
|
@ -487,29 +487,6 @@ out_error:
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
|
||||||
__xlog_state_release_iclog(
|
|
||||||
struct xlog *log,
|
|
||||||
struct xlog_in_core *iclog)
|
|
||||||
{
|
|
||||||
lockdep_assert_held(&log->l_icloglock);
|
|
||||||
|
|
||||||
if (iclog->ic_state == XLOG_STATE_WANT_SYNC) {
|
|
||||||
/* update tail before writing to iclog */
|
|
||||||
xfs_lsn_t tail_lsn = xlog_assign_tail_lsn(log->l_mp);
|
|
||||||
|
|
||||||
iclog->ic_state = XLOG_STATE_SYNCING;
|
|
||||||
iclog->ic_header.h_tail_lsn = cpu_to_be64(tail_lsn);
|
|
||||||
xlog_verify_tail_lsn(log, iclog, tail_lsn);
|
|
||||||
/* cycle incremented when incrementing curr_block */
|
|
||||||
trace_xlog_iclog_syncing(iclog, _RET_IP_);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT(iclog->ic_state == XLOG_STATE_ACTIVE);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Flush iclog to disk if this is the last reference to the given iclog and the
|
* Flush iclog to disk if this is the last reference to the given iclog and the
|
||||||
* it is in the WANT_SYNC state.
|
* it is in the WANT_SYNC state.
|
||||||
|
@ -519,19 +496,31 @@ xlog_state_release_iclog(
|
||||||
struct xlog *log,
|
struct xlog *log,
|
||||||
struct xlog_in_core *iclog)
|
struct xlog_in_core *iclog)
|
||||||
{
|
{
|
||||||
|
xfs_lsn_t tail_lsn;
|
||||||
lockdep_assert_held(&log->l_icloglock);
|
lockdep_assert_held(&log->l_icloglock);
|
||||||
|
|
||||||
trace_xlog_iclog_release(iclog, _RET_IP_);
|
trace_xlog_iclog_release(iclog, _RET_IP_);
|
||||||
if (iclog->ic_state == XLOG_STATE_IOERROR)
|
if (iclog->ic_state == XLOG_STATE_IOERROR)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
if (atomic_dec_and_test(&iclog->ic_refcnt) &&
|
if (!atomic_dec_and_test(&iclog->ic_refcnt))
|
||||||
__xlog_state_release_iclog(log, iclog)) {
|
return 0;
|
||||||
spin_unlock(&log->l_icloglock);
|
|
||||||
xlog_sync(log, iclog);
|
if (iclog->ic_state != XLOG_STATE_WANT_SYNC) {
|
||||||
spin_lock(&log->l_icloglock);
|
ASSERT(iclog->ic_state == XLOG_STATE_ACTIVE);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* update tail before writing to iclog */
|
||||||
|
tail_lsn = xlog_assign_tail_lsn(log->l_mp);
|
||||||
|
iclog->ic_state = XLOG_STATE_SYNCING;
|
||||||
|
iclog->ic_header.h_tail_lsn = cpu_to_be64(tail_lsn);
|
||||||
|
xlog_verify_tail_lsn(log, iclog, tail_lsn);
|
||||||
|
trace_xlog_iclog_syncing(iclog, _RET_IP_);
|
||||||
|
|
||||||
|
spin_unlock(&log->l_icloglock);
|
||||||
|
xlog_sync(log, iclog);
|
||||||
|
spin_lock(&log->l_icloglock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче