/* local debug functions */
#if defined(DEBUG) && !defined(XLOG_NOLOG)
STATIC void xlog_verify_dest_ptr(xlog_t *log, __psint_t ptr);
-#ifdef XFSDEBUG
-STATIC void xlog_verify_disk_cycle_no(xlog_t *log, xlog_in_core_t *iclog);
-#endif
STATIC void xlog_verify_grant_head(xlog_t *log, int equals);
STATIC void xlog_verify_iclog(xlog_t *log, xlog_in_core_t *iclog,
int count, boolean_t syncing);
xfs_lsn_t tail_lsn);
#else
#define xlog_verify_dest_ptr(a,b)
-#define xlog_verify_disk_cycle_no(a,b)
#define xlog_verify_grant_head(a,b)
#define xlog_verify_iclog(a,b,c,d)
#define xlog_verify_tail_lsn(a,b,c)
} /* xfs_log_force */
-
/*
- * This function will take a log sequence number and check to see if that
- * lsn has been flushed to disk. If it has, then the callback function is
- * called with the callback argument. If the relevant in-core log has not
- * been synced to disk, we add the callback to the callback list of the
- * in-core log.
+ * Attaches a new iclog I/O completion callback routine during
+ * transaction commit. If the log is in error state, a non-zero
+ * return code is handed back and the caller is responsible for
+ * executing the callback at an appropriate time.
*/
int
xfs_log_notify(xfs_mount_t *mp, /* mount of partition */
if (!xlog_debug && xlog_target == log->l_targ)
return 0;
#endif
- cb->cb_next = 0;
+ cb->cb_next = NULL;
spl = LOG_LOCK(log);
abortflg = (iclog->ic_state & XLOG_STATE_IOERROR);
if (!abortflg) {
ASSERT_ALWAYS((iclog->ic_state == XLOG_STATE_ACTIVE) ||
(iclog->ic_state == XLOG_STATE_WANT_SYNC));
- cb->cb_next = 0;
+ cb->cb_next = NULL;
*(iclog->ic_callback_tail) = cb;
iclog->ic_callback_tail = &(cb->cb_next);
}
LOG_UNLOCK(log, spl);
- if (abortflg) {
- cb->cb_func(cb->cb_arg, abortflg);
- }
- return 0;
+ return abortflg;
} /* xfs_log_notify */
int
if (readonly)
vfsp->vfs_flag |= VFS_RDONLY;
if (error) {
- cmn_err(CE_WARN, "XFS: log mount/recovery failed");
+ cmn_err(CE_WARN, "XFS: log mount/recovery failed: error %d", error);
xlog_unalloc_log(mp->m_log);
return error;
}
xlog_in_core_t *first_iclog;
#endif
xfs_log_iovec_t reg[1];
- xfs_log_ticket_t tic = 0;
+ xfs_log_ticket_t tic = NULL;
xfs_lsn_t lsn;
int error;
SPLDECL(s);
xlog_t *log = mp->m_log;
vfs_t *vfsp = XFS_MTOVFS(mp);
- if (vfsp->vfs_super->s_frozen || XFS_FORCED_SHUTDOWN(mp) ||
+ if (fs_frozen(vfsp) || XFS_FORCED_SHUTDOWN(mp) ||
(vfsp->vfs_flag & VFS_RDONLY))
return 0;
int error;
xfs_log_iovec_t reg[1];
- reg[0].i_addr = 0;
+ reg[0].i_addr = NULL;
reg[0].i_len = 0;
ASSERT_ALWAYS(iclog);
xlog_pack_data(log, iclog); /* put cycle number in every block */
/* real byte length */
- INT_SET(iclog->ic_header.h_len,
- ARCH_CONVERT,
- iclog->ic_offset + iclog->ic_roundoff);
+ if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) {
+ INT_SET(iclog->ic_header.h_len,
+ ARCH_CONVERT,
+ iclog->ic_offset + iclog->ic_roundoff);
+ } else {
+ INT_SET(iclog->ic_header.h_len, ARCH_CONVERT, iclog->ic_offset);
+ }
/* put ops count in correct order */
ops = iclog->ic_header.h_num_logops;
int copy_len; /* # bytes actually memcpy'ing */
int copy_off; /* # bytes from entry start */
int contwr; /* continued write of in-core log? */
- int firstwr = 0; /* first write of transaction */
int error;
int record_cnt = 0, data_cnt = 0;
logop_head->oh_flags = XLOG_START_TRANS;
INT_ZERO(logop_head->oh_res2, ARCH_CONVERT);
ticket->t_flags &= ~XLOG_TIC_INITED; /* clear bit */
- firstwr = 1; /* increment log ops below */
record_cnt++;
start_rec_copy = sizeof(xlog_op_header_t);
copy_len += start_rec_copy + sizeof(xlog_op_header_t);
record_cnt++;
data_cnt += contwr ? copy_len : 0;
- firstwr = 0;
if (partial_copy) { /* copied partial region */
/* already marked WANT_SYNC by xlog_state_get_iclog_space */
xlog_state_finish_copy(log, iclog, record_cnt, data_cnt);
if (iclog->ic_state == XLOG_STATE_DIRTY) {
iclog->ic_state = XLOG_STATE_ACTIVE;
iclog->ic_offset = 0;
- iclog->ic_callback = 0; /* don't need to free */
+ iclog->ic_callback = NULL; /* don't need to free */
/*
* If the number of ops in this iclog indicate it just
* contains the dummy transaction, we can
while (cb != 0) {
iclog->ic_callback_tail = &(iclog->ic_callback);
- iclog->ic_callback = 0;
+ iclog->ic_callback = NULL;
LOG_UNLOCK(log, s);
/* perform callbacks in the order given */
log->l_ticket_cnt++;
log->l_ticket_tcnt++;
}
- t_list->t_next = 0;
+ t_list->t_next = NULL;
log->l_tail = t_list;
LOG_UNLOCK(log, s);
} /* xlog_state_ticket_alloc */
/* no need to clear fields */
#else
/* When we debug, it is easier if tickets are cycled */
- ticket->t_next = 0;
+ ticket->t_next = NULL;
if (log->l_tail != 0) {
log->l_tail->t_next = ticket;
} else {
xlog_panic("xlog_verify_dest_ptr: invalid ptr");
} /* xlog_verify_dest_ptr */
-
-#ifdef XFSDEBUG
-/* check split LR write */
-STATIC void
-xlog_verify_disk_cycle_no(xlog_t *log,
- xlog_in_core_t *iclog)
-{
- xfs_buf_t *bp;
- uint cycle_no;
- xfs_caddr_t ptr;
- xfs_daddr_t i;
-
- if (BLOCK_LSN(iclog->ic_header.h_lsn, ARCH_CONVERT) < 10) {
- cycle_no = CYCLE_LSN(iclog->ic_header.h_lsn, ARCH_CONVERT);
- bp = xlog_get_bp(log, 1);
- ASSERT(bp);
- for (i = 0; i < BLOCK_LSN(iclog->ic_header.h_lsn, ARCH_CONVERT); i++) {
- xlog_bread(log, i, 1, bp);
- ptr = xlog_align(log, i, 1, bp);
- if (GET_CYCLE(ptr, ARCH_CONVERT) != cycle_no)
- xlog_warn("XFS: xlog_verify_disk_cycle_no: bad cycle no");
- }
- xlog_put_bp(bp);
- }
-} /* xlog_verify_disk_cycle_no */
-#endif
-
STATIC void
xlog_verify_grant_head(xlog_t *log, int equals)
{