/* Callbacks could take time, so they are done outside the scope of the global state machine log lock.  */
STATIC void xlog_state_done_syncing(xlog_in_core_t *iclog, int)
/* Callbacks could take time, so they are done outside the scope of the global state machine log lock.  */
STATIC void xlog_state_done_syncing(xlog_in_core_t *iclog, int)
{
	xlog_t		   *log = iclog->ic_log;
	spin_lock(&log->l_icloglock);
	ASSERT(iclog->ic_state == XLOG_STATE_SYNCING ||
	       iclog->ic_state == XLOG_STATE_IOERROR);
	ASSERT(atomic_read(&iclog->ic_refcnt) == 0);
	ASSERT(iclog->ic_bwritecnt == 1 || iclog->ic_bwritecnt == 2);
	if (iclog->ic_state != XLOG_STATE_IOERROR) {
		if (--iclog->ic_bwritecnt == 1) {
			spin_unlock(&log->l_icloglock);
			return;
		}
		iclog->ic_state = XLOG_STATE_DONE_SYNC;
	}
	sv_broadcast(&iclog->ic_write_wait);
	spin_unlock(&log->l_icloglock);
	xlog_state_do_callback(log, aborted, iclog);
}