xlog_ticket_t *tic;
xlog_t *log = mp->m_log;
int need_bytes, free_bytes, cycle, bytes;
- SPLDECL(s);
if (XLOG_FORCED_SHUTDOWN(log))
return;
spin_unlock(&log->l_icloglock);
}
- s = GRANT_LOCK(log);
+ spin_lock(&log->l_grant_lock);
/* Also an invalid lsn. 1 implies that we aren't passing in a valid
* tail_lsn.
tic = tic->t_next;
} while (tic != log->l_reserve_headq);
}
- GRANT_UNLOCK(log, s);
+ spin_unlock(&log->l_grant_lock);
} /* xfs_log_move_tail */
/*
xlog_assign_tail_lsn(xfs_mount_t *mp)
{
xfs_lsn_t tail_lsn;
- SPLDECL(s);
xlog_t *log = mp->m_log;
tail_lsn = xfs_trans_tail_ail(mp);
- s = GRANT_LOCK(log);
+ spin_lock(&log->l_grant_lock);
if (tail_lsn != 0) {
log->l_tail_lsn = tail_lsn;
} else {
tail_lsn = log->l_tail_lsn = log->l_last_sync_lsn;
}
- GRANT_UNLOCK(log, s);
+ spin_unlock(&log->l_grant_lock);
return tail_lsn;
} /* xlog_assign_tail_lsn */
int threshold_block; /* block in lsn we'd like to be at */
int threshold_cycle; /* lsn cycle we'd like to be at */
int free_threshold;
- SPLDECL(s);
ASSERT(BTOBB(need_bytes) < log->l_logBBsize);
- s = GRANT_LOCK(log);
+ spin_lock(&log->l_grant_lock);
free_bytes = xlog_space_left(log,
log->l_grant_reserve_cycle,
log->l_grant_reserve_bytes);
if (XFS_LSN_CMP(threshold_lsn, log->l_last_sync_lsn) > 0)
threshold_lsn = log->l_last_sync_lsn;
}
- GRANT_UNLOCK(log, s);
+ spin_unlock(&log->l_grant_lock);
/*
* Get the transaction layer to kick the dirty buffers out to
int roundoff; /* roundoff to BB or stripe */
int split = 0; /* split write into two regions */
int error;
- SPLDECL(s);
int v2 = XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb);
XFS_STATS_INC(xs_log_writes);
roundoff < BBTOB(1)));
/* move grant heads by roundoff in sync */
- s = GRANT_LOCK(log);
+ spin_lock(&log->l_grant_lock);
xlog_grant_add_space(log, roundoff);
- GRANT_UNLOCK(log, s);
+ spin_unlock(&log->l_grant_lock);
/* put cycle number in every block */
xlog_pack_data(log, iclog, roundoff);
int funcdidcallbacks; /* flag: function did callbacks */
int repeats; /* for issuing console warnings if
* looping too many times */
- SPLDECL(s);
spin_lock(&log->l_icloglock);
first_iclog = iclog = log->l_iclog;
spin_unlock(&log->l_icloglock);
/* l_last_sync_lsn field protected by
- * GRANT_LOCK. Don't worry about iclog's lsn.
+ * l_grant_lock. Don't worry about iclog's lsn.
* No one else can be here except us.
*/
- s = GRANT_LOCK(log);
+ spin_lock(&log->l_grant_lock);
ASSERT(XFS_LSN_CMP(
log->l_last_sync_lsn,
INT_GET(iclog->ic_header.h_lsn, ARCH_CONVERT)
)<=0);
log->l_last_sync_lsn = INT_GET(iclog->ic_header.h_lsn, ARCH_CONVERT);
- GRANT_UNLOCK(log, s);
+ spin_unlock(&log->l_grant_lock);
/*
* Keep processing entries in the callback list
{
int free_bytes;
int need_bytes;
- SPLDECL(s);
#ifdef DEBUG
xfs_lsn_t tail_lsn;
#endif
#endif
/* Is there space or do we need to sleep? */
- s = GRANT_LOCK(log);
+ spin_lock(&log->l_grant_lock);
xlog_trace_loggrant(log, tic, "xlog_grant_log_space: enter");
/* something is already sleeping; insert new transaction at end */
*/
xlog_trace_loggrant(log, tic,
"xlog_grant_log_space: wake 1");
- s = GRANT_LOCK(log);
+ spin_lock(&log->l_grant_lock);
}
if (tic->t_flags & XFS_LOG_PERM_RESERV)
need_bytes = tic->t_unit_res*tic->t_ocnt;
sv_wait(&tic->t_sema, PINOD|PLTWAIT, &log->l_grant_lock, s);
if (XLOG_FORCED_SHUTDOWN(log)) {
- s = GRANT_LOCK(log);
+ spin_lock(&log->l_grant_lock);
goto error_return;
}
xlog_trace_loggrant(log, tic,
"xlog_grant_log_space: wake 2");
xlog_grant_push_ail(log->l_mp, need_bytes);
- s = GRANT_LOCK(log);
+ spin_lock(&log->l_grant_lock);
goto redo;
} else if (tic->t_flags & XLOG_TIC_IN_Q)
xlog_del_ticketq(&log->l_reserve_headq, tic);
#endif
xlog_trace_loggrant(log, tic, "xlog_grant_log_space: exit");
xlog_verify_grant_head(log, 1);
- GRANT_UNLOCK(log, s);
+ spin_unlock(&log->l_grant_lock);
return 0;
error_return:
*/
tic->t_curr_res = 0;
tic->t_cnt = 0; /* ungrant will give back unit_res * t_cnt. */
- GRANT_UNLOCK(log, s);
+ spin_unlock(&log->l_grant_lock);
return XFS_ERROR(EIO);
} /* xlog_grant_log_space */
xlog_regrant_write_log_space(xlog_t *log,
xlog_ticket_t *tic)
{
- SPLDECL(s);
int free_bytes, need_bytes;
xlog_ticket_t *ntic;
#ifdef DEBUG
panic("regrant Recovery problem");
#endif
- s = GRANT_LOCK(log);
+ spin_lock(&log->l_grant_lock);
xlog_trace_loggrant(log, tic, "xlog_regrant_write_log_space: enter");
if (XLOG_FORCED_SHUTDOWN(log))
/* If we're shutting down, this tic is already
* off the queue */
if (XLOG_FORCED_SHUTDOWN(log)) {
- s = GRANT_LOCK(log);
+ spin_lock(&log->l_grant_lock);
goto error_return;
}
xlog_trace_loggrant(log, tic,
"xlog_regrant_write_log_space: wake 1");
xlog_grant_push_ail(log->l_mp, tic->t_unit_res);
- s = GRANT_LOCK(log);
+ spin_lock(&log->l_grant_lock);
}
}
/* If we're shutting down, this tic is already off the queue */
if (XLOG_FORCED_SHUTDOWN(log)) {
- s = GRANT_LOCK(log);
+ spin_lock(&log->l_grant_lock);
goto error_return;
}
xlog_trace_loggrant(log, tic,
"xlog_regrant_write_log_space: wake 2");
xlog_grant_push_ail(log->l_mp, need_bytes);
- s = GRANT_LOCK(log);
+ spin_lock(&log->l_grant_lock);
goto redo;
} else if (tic->t_flags & XLOG_TIC_IN_Q)
xlog_del_ticketq(&log->l_write_headq, tic);
xlog_trace_loggrant(log, tic, "xlog_regrant_write_log_space: exit");
xlog_verify_grant_head(log, 1);
- GRANT_UNLOCK(log, s);
+ spin_unlock(&log->l_grant_lock);
return 0;
*/
tic->t_curr_res = 0;
tic->t_cnt = 0; /* ungrant will give back unit_res * t_cnt. */
- GRANT_UNLOCK(log, s);
+ spin_unlock(&log->l_grant_lock);
return XFS_ERROR(EIO);
} /* xlog_regrant_write_log_space */
xlog_regrant_reserve_log_space(xlog_t *log,
xlog_ticket_t *ticket)
{
- SPLDECL(s);
-
xlog_trace_loggrant(log, ticket,
"xlog_regrant_reserve_log_space: enter");
if (ticket->t_cnt > 0)
ticket->t_cnt--;
- s = GRANT_LOCK(log);
+ spin_lock(&log->l_grant_lock);
xlog_grant_sub_space(log, ticket->t_curr_res);
ticket->t_curr_res = ticket->t_unit_res;
xlog_tic_reset_res(ticket);
/* just return if we still have some of the pre-reserved space */
if (ticket->t_cnt > 0) {
- GRANT_UNLOCK(log, s);
+ spin_unlock(&log->l_grant_lock);
return;
}
xlog_trace_loggrant(log, ticket,
"xlog_regrant_reserve_log_space: exit");
xlog_verify_grant_head(log, 0);
- GRANT_UNLOCK(log, s);
+ spin_unlock(&log->l_grant_lock);
ticket->t_curr_res = ticket->t_unit_res;
xlog_tic_reset_res(ticket);
} /* xlog_regrant_reserve_log_space */
xlog_ungrant_log_space(xlog_t *log,
xlog_ticket_t *ticket)
{
- SPLDECL(s);
-
if (ticket->t_cnt > 0)
ticket->t_cnt--;
- s = GRANT_LOCK(log);
+ spin_lock(&log->l_grant_lock);
xlog_trace_loggrant(log, ticket, "xlog_ungrant_log_space: enter");
xlog_grant_sub_space(log, ticket->t_curr_res);
xlog_trace_loggrant(log, ticket, "xlog_ungrant_log_space: exit");
xlog_verify_grant_head(log, 1);
- GRANT_UNLOCK(log, s);
+ spin_unlock(&log->l_grant_lock);
xfs_log_move_tail(log->l_mp, 1);
} /* xlog_ungrant_log_space */
xlog_t *log;
int retval;
int dummy;
- SPLDECL(s);
log = mp->m_log;
* before we mark the filesystem SHUTDOWN and wake
* everybody up to tell the bad news.
*/
- s = GRANT_LOCK(log);
+ spin_lock(&log->l_grant_lock);
spin_lock(&log->l_icloglock);
mp->m_flags |= XFS_MOUNT_FS_SHUTDOWN;
XFS_BUF_DONE(mp->m_sb_bp);
tic = tic->t_next;
} while (tic != log->l_write_headq);
}
- GRANT_UNLOCK(log, s);
+ spin_unlock(&log->l_grant_lock);
if (! (log->l_iclog->ic_state & XLOG_STATE_IOERROR)) {
ASSERT(!logerror);