Lines Matching refs:log
35 struct xlog *log)
39 tic = xlog_ticket_alloc(log, 0, 1, 0);
53 struct xlog *log = cil->xc_log;
56 (XLOG_CIL_BLOCKING_SPACE_LIMIT(log) /
57 (log->l_iclog_size - log->l_iclog_hsize)));
61 * Check if the current log item was first committed in this sequence.
62 * We can't rely on just the log item being in the CIL, we have to check
78 * li_seq is written on the first commit of a log item to record the
194 * After the first stage of log recovery is done, we know where the head and
195 * tail of the log are. We need this log initialisation done before we can
198 * Here we allocate a log ticket to track space usage during a CIL push. This
199 * ticket is passed to xlog_write() directly so that we don't slowly leak log
200 * space by failing to account for space used by log headers and additional
205 struct xlog *log)
207 log->l_cilp->xc_ctx->ticket = xlog_cil_ticket_alloc(log);
208 log->l_cilp->xc_ctx->sequence = 1;
209 xlog_cil_set_iclog_hdr_count(log->l_cilp);
222 * Allocate or pin log vector buffers for CIL insertion.
225 * modified items into the log during a push. The biggest problem with this is
237 * xc_ctx_lock, but because the log vector buffers are disposable, that opens
238 * up a TOCTOU race condition w.r.t. the CIL committing and removing the log
240 * log vector buffer within the xc_ctx_lock.
242 * Because the log vector buffer needs to be unchanged during the CIL push
245 * into the log. This means skipping preallocation of buffer space is
250 * log item is committed for the second time, and then to only use this buffer
251 * if necessary. The buffer can remain attached to the log item until such time
258 * This function builds a vector for the changes in each log item in the
259 * transaction. It then works out the length of the buffer needed for each log
260 * item, allocates them and attaches the vector to the log item in preparation
269 struct xlog *log,
331 * the buffer, only the log vector header and the iovec
367 * Prepare the log item for insertion into the CIL. Calculate the difference in
368 * log space it will consume, and if it is a new item pin it as well.
372 struct xlog *log,
399 /* attach new log vector to log item */
404 * CIL, store the sequence number on the log item so we can
409 lv->lv_item->li_seq = log->l_cilp->xc_ctx->sequence;
413 * Format log item into a flat buffers
416 * changes on the log item. This enables us to relog the item in memory and
420 * This function takes the prepared log vectors attached to each log item, and
421 * formats the changes into the log vector buffer. The buffer it uses is
426 * done lazily either by th enext modification or the freeing of the log item.
442 struct xlog *log,
448 /* Bail out if we didn't find a log item. */
464 * the shadow lv on the log item.
472 xfs_cil_prepare_item(log, lip, lv, diff_len);
506 xfs_cil_prepare_item(log, lip, lv, diff_len);
517 struct xlog *log,
520 if (waitqueue_active(&log->l_cilp->xc_push_wait))
522 if (space_used >= XLOG_CIL_BLOCKING_SPACE_LIMIT(log))
528 * Insert the log items into the CIL and calculate the difference in space
530 * if the change requires additional log metadata. If it does, take that space
536 struct xlog *log,
540 struct xfs_cil *cil = log->l_cilp;
556 xlog_cil_insert_format_items(log, tp, &len);
609 xlog_cil_over_hard_limit(log, space_used)) {
610 split_res = log->l_iclog_hsize +
627 (XLOG_CIL_SPACE_LIMIT(log) / num_online_cpus())) {
636 if (space_used >= XLOG_CIL_SPACE_LIMIT(log))
666 * the log items. Shutdown is imminent...
670 xfs_warn(log->l_mp, "Transaction log reservation overrun:");
671 xfs_warn(log->l_mp,
672 " log items: %d bytes (iov hdrs: %d bytes)",
674 xfs_warn(log->l_mp, " split region headers: %d bytes",
676 xfs_warn(log->l_mp, " ctx ticket: %d bytes", ctx_res);
678 xlog_force_shutdown(log, SHUTDOWN_LOG_IO_ERROR);
705 * Take the checkpoint's log vector chain of items and insert the attached log
709 * The AIL tracks log items via the start record LSN of the checkpoint,
718 * The tail of the log cannot be moved to the LSN of commit N when all
720 * start record for N+1 is no longer in the active portion of the log
723 * Hence when all the log items in checkpoint N are written back, the
724 * tail of the log most now only move as far forwards as the start LSN
727 * If we are called with the aborted flag set, it is because a log write during
760 * items so that log space checks during insertion will reflect the
776 * log before we remove that space from the grant heads. This prevents a
779 * the AIL head update accounts in the log tail space.
784 /* unpin all the log items */
872 * Mark all items committed and clear busy extents. We free the log vector
873 * chains in a separate pass so that we unpin the log items as quickly as
885 * Wake any commit waiters before aborting the log items so we don't
886 * block async log pushers on callbacks. Async log pushers explicitly do
887 * not wait on log force completion because they may be holding locks
949 * The LSN we need to pass to the log items on transaction
950 * commit is the LSN reported by the first log vector write, not
960 * Make sure the metadata we are about to overwrite in the log
992 * location in the log.
1003 * Ensure that the order of log writes follows checkpoint sequence order. This
1004 * relies on the context LSN being zero until the log write has guaranteed the
1005 * LSN that the log write will start at via xlog_state_get_iclog_space().
1061 * Write out the log vector change now attached to the CIL context. This will
1063 * sequence order so that log recovery will always use in-order start LSNs when
1071 struct xlog *log = ctx->cil->xc_log;
1077 return xlog_write(log, ctx, &ctx->lv_chain, ctx->ticket, chain_len);
1082 * running log write. These commit records are strictly ordered in ascending CIL
1083 * sequence order so that log recovery will always replay the checkpoints in the
1090 struct xlog *log = ctx->cil->xc_log;
1109 if (xlog_is_shutdown(log))
1118 error = xlog_write(log, ctx, &lv_chain, ctx->ticket, reg.i_len);
1120 xlog_force_shutdown(log, SHUTDOWN_LOG_IO_ERROR);
1136 * log opheaders that indicate the start of a log transaction and wrap the
1137 * transaction header. We keep the start record in it's own log vector rather
1159 /* log iovec region pointer */
1164 /* log opheader */
1175 /* log iovec region pointer */
1191 * the list. This is important for operations like reflink where we log 4 order
1209 * Pull all the log vectors off the items in the CIL, and remove the items from
1213 * If a log item is marked with a whiteout, we do not need to write it to the
1240 /* we don't write ordered log vectors */
1266 * Push the Committed Item List to the log.
1274 * Hence we can allow log forces to run racily and not issue pushes for the
1293 struct xlog *log = cil->xc_log;
1306 new_ctx->ticket = xlog_cil_ticket_alloc(log);
1380 * that the commit records are correctly ordered in the log to ensure
1381 * that we process items during log IO completion in the correct order.
1384 * next (e.g. due to log forces), we do not want the checkpoint with
1389 * in log recovery.
1398 * against the current sequence in log forces without risking
1407 * Sort the log vector chain before we add the transaction headers.
1414 * Build a checkpoint transaction header and write it to the log to
1426 * xlog_cil_write_chain() as it should not be passed to log IO
1459 spin_lock(&log->l_icloglock);
1471 spin_lock(&log->l_icloglock);
1494 xlog_state_switch_iclogs(log, ctx->commit_iclog, 0);
1496 xlog_state_release_iclog(log, ctx->commit_iclog, ticket);
1500 spin_unlock(&log->l_icloglock);
1502 xfs_log_ticket_ungrant(log, ticket);
1514 ASSERT(xlog_is_shutdown(log));
1517 xfs_log_ticket_ungrant(log, ctx->ticket);
1522 spin_lock(&log->l_icloglock);
1524 xlog_state_release_iclog(log, ctx->commit_iclog, ticket);
1526 spin_unlock(&log->l_icloglock);
1527 xfs_log_ticket_ungrant(log, ticket);
1533 * the log. The limit really is that a checkpoint can't be more than half the
1534 * log (the current checkpoint is not allowed to overwrite the previous
1540 struct xlog *log)
1542 struct xfs_cil *cil = log->l_cilp;
1560 if (space_used < XLOG_CIL_SPACE_LIMIT(log) ||
1562 space_used < XLOG_CIL_BLOCKING_SPACE_LIMIT(log) &&
1592 if (xlog_cil_over_hard_limit(log, space_used)) {
1593 trace_xfs_log_cil_wait(log, cil->xc_ctx->ticket);
1594 ASSERT(space_used < log->l_logsize);
1616 * ACTIVE iclog. This then requires another full log force to push to disk,
1623 struct xlog *log,
1627 struct xfs_cil *cil = log->l_cilp;
1666 struct xlog *log)
1668 struct xfs_cil *cil = log->l_cilp;
1730 struct xlog *log,
1735 struct xfs_cil *cil = log->l_cilp;
1744 xlog_cil_alloc_shadow_bufs(log, tp);
1752 xlog_cil_insert_items(log, tp, released_space);
1754 if (regrant && !xlog_is_shutdown(log))
1755 xfs_log_ticket_regrant(log, tp->t_ticket);
1757 xfs_log_ticket_ungrant(log, tp->t_ticket);
1766 * have to update state in the log items and unlock them before they go
1769 * the log items. This affects (at least) processing of stale buffers,
1782 xlog_cil_push_background(log);
1788 * but otherwise is no different to a push done from a log force.
1792 struct xlog *log)
1794 xfs_csn_t seq = log->l_cilp->xc_current_sequence;
1796 trace_xfs_log_force(log->l_mp, seq, _RET_IP_);
1797 xlog_cil_push_now(log, seq, true);
1803 if (test_bit(XLOG_CIL_EMPTY, &log->l_cilp->xc_flags))
1804 xfs_log_force(log->l_mp, 0);
1819 struct xlog *log,
1822 struct xfs_cil *cil = log->l_cilp;
1830 trace_xfs_log_force(log->l_mp, sequence, _RET_IP_);
1838 xlog_cil_push_now(log, sequence, false);
1853 if (xlog_is_shutdown(log))
1862 XFS_STATS_INC(log->l_mp, xs_log_force_sleep);
1897 * We detected a shutdown in progress. We need to trigger the log force
1900 * NULLCOMMITLSN here as that has special meaning to log forces (i.e.
1913 struct xlog *log)
1925 * concurrency the log spinlocks will be exposed to.
1929 4, log->l_mp->m_super->s_id);
1933 cil->xc_log = log;
1950 log->l_cilp = cil;
1965 struct xlog *log)
1967 struct xfs_cil *cil = log->l_cilp;