Lines Matching full:log

35 	struct xlog	*log)  in xlog_cil_ticket_alloc()  argument
39 tic = xlog_ticket_alloc(log, 0, 1, 0); in xlog_cil_ticket_alloc()
53 struct xlog *log = cil->xc_log; in xlog_cil_set_iclog_hdr_count() local
56 (XLOG_CIL_BLOCKING_SPACE_LIMIT(log) / in xlog_cil_set_iclog_hdr_count()
57 (log->l_iclog_size - log->l_iclog_hsize))); in xlog_cil_set_iclog_hdr_count()
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 in xlog_item_in_current_chkpt()
197 * After the first stage of log recovery is done, we know where the head and
198 * tail of the log are. We need this log initialisation done before we can
201 * Here we allocate a log ticket to track space usage during a CIL push. This
202 * ticket is passed to xlog_write() directly so that we don't slowly leak log
203 * space by failing to account for space used by log headers and additional
208 struct xlog *log) in xlog_cil_init_post_recovery() argument
210 log->l_cilp->xc_ctx->ticket = xlog_cil_ticket_alloc(log); in xlog_cil_init_post_recovery()
211 log->l_cilp->xc_ctx->sequence = 1; in xlog_cil_init_post_recovery()
212 xlog_cil_set_iclog_hdr_count(log->l_cilp); in xlog_cil_init_post_recovery()
225 * Allocate or pin log vector buffers for CIL insertion.
228 * modified items into the log during a push. The biggest problem with this is
240 * xc_ctx_lock, but because the log vector buffers are disposable, that opens
241 * up a TOCTOU race condition w.r.t. the CIL committing and removing the log
243 * log vector buffer within the xc_ctx_lock.
245 * Because the log vector buffer needs to be unchanged during the CIL push
248 * into the log. This means skipping preallocation of buffer space is
253 * log item is committed for the second time, and then to only use this buffer
254 * if necessary. The buffer can remain attached to the log item until such time
261 * This function builds a vector for the changes in each log item in the
262 * transaction. It then works out the length of the buffer needed for each log
263 * item, allocates them and attaches the vector to the log item in preparation
272 struct xlog *log, in xlog_cil_alloc_shadow_bufs() argument
336 * the buffer, only the log vector header and the iovec in xlog_cil_alloc_shadow_bufs()
372 * Prepare the log item for insertion into the CIL. Calculate the difference in
373 * log space it will consume, and if it is a new item pin it as well.
377 struct xlog *log, in xfs_cil_prepare_item() argument
404 /* attach new log vector to log item */ in xfs_cil_prepare_item()
409 * CIL, store the sequence number on the log item so we can in xfs_cil_prepare_item()
414 lv->lv_item->li_seq = log->l_cilp->xc_ctx->sequence; in xfs_cil_prepare_item()
418 * Format log item into a flat buffers
421 * changes on the log item. This enables us to relog the item in memory and
425 * This function takes the prepared log vectors attached to each log item, and
426 * formats the changes into the log vector buffer. The buffer it uses is
431 * done lazily either by th enext modification or the freeing of the log item.
447 struct xlog *log, in xlog_cil_insert_format_items() argument
453 /* Bail out if we didn't find a log item. */ in xlog_cil_insert_format_items()
471 * the shadow lv on the log item. in xlog_cil_insert_format_items()
518 xfs_cil_prepare_item(log, lv, old_lv, diff_len); in xlog_cil_insert_format_items()
529 struct xlog *log, in xlog_cil_over_hard_limit() argument
532 if (waitqueue_active(&log->l_cilp->xc_push_wait)) in xlog_cil_over_hard_limit()
534 if (space_used >= XLOG_CIL_BLOCKING_SPACE_LIMIT(log)) in xlog_cil_over_hard_limit()
540 * Insert the log items into the CIL and calculate the difference in space
542 * if the change requires additional log metadata. If it does, take that space
548 struct xlog *log, in xlog_cil_insert_items() argument
552 struct xfs_cil *cil = log->l_cilp; in xlog_cil_insert_items()
568 xlog_cil_insert_format_items(log, tp, &len); in xlog_cil_insert_items()
621 xlog_cil_over_hard_limit(log, space_used)) { in xlog_cil_insert_items()
622 split_res = log->l_iclog_hsize + in xlog_cil_insert_items()
639 (XLOG_CIL_SPACE_LIMIT(log) / num_online_cpus())) { in xlog_cil_insert_items()
648 if (space_used >= XLOG_CIL_SPACE_LIMIT(log)) in xlog_cil_insert_items()
678 * the log items. Shutdown is imminent... in xlog_cil_insert_items()
682 xfs_warn(log->l_mp, "Transaction log reservation overrun:"); in xlog_cil_insert_items()
683 xfs_warn(log->l_mp, in xlog_cil_insert_items()
684 " log items: %d bytes (iov hdrs: %d bytes)", in xlog_cil_insert_items()
686 xfs_warn(log->l_mp, " split region headers: %d bytes", in xlog_cil_insert_items()
688 xfs_warn(log->l_mp, " ctx ticket: %d bytes", ctx_res); in xlog_cil_insert_items()
690 xlog_force_shutdown(log, SHUTDOWN_LOG_IO_ERROR); in xlog_cil_insert_items()
717 * Take the checkpoint's log vector chain of items and insert the attached log
721 * The AIL tracks log items via the start record LSN of the checkpoint,
730 * The tail of the log cannot be moved to the LSN of commit N when all
732 * start record for N+1 is no longer in the active portion of the log
735 * Hence when all the log items in checkpoint N are written back, the
736 * tail of the log most now only move as far forwards as the start LSN
739 * If we are called with the aborted flag set, it is because a log write during
772 * items so that log space checks during insertion will reflect the in xlog_cil_ail_insert()
788 * log before we remove that space from the grant heads. This prevents a in xlog_cil_ail_insert()
791 * the AIL head update accounts in the log tail space. in xlog_cil_ail_insert()
796 /* unpin all the log items */ in xlog_cil_ail_insert()
882 * Mark all items committed and clear busy extents. We free the log vector
883 * chains in a separate pass so that we unpin the log items as quickly as
895 * Wake any commit waiters before aborting the log items so we don't in xlog_cil_committed()
896 * block async log pushers on callbacks. Async log pushers explicitly do in xlog_cil_committed()
897 * not wait on log force completion because they may be holding locks in xlog_cil_committed()
960 * The LSN we need to pass to the log items on transaction in xlog_cil_set_ctx_write_state()
961 * commit is the LSN reported by the first log vector write, not in xlog_cil_set_ctx_write_state()
971 * Make sure the metadata we are about to overwrite in the log in xlog_cil_set_ctx_write_state()
1003 * location in the log. in xlog_cil_set_ctx_write_state()
1014 * Ensure that the order of log writes follows checkpoint sequence order. This
1015 * relies on the context LSN being zero until the log write has guaranteed the
1016 * LSN that the log write will start at via xlog_state_get_iclog_space().
1072 * Write out the log vector change now attached to the CIL context. This will
1074 * sequence order so that log recovery will always use in-order start LSNs when
1082 struct xlog *log = ctx->cil->xc_log; in xlog_cil_write_chain() local
1088 return xlog_write(log, ctx, &ctx->lv_chain, ctx->ticket, chain_len); in xlog_cil_write_chain()
1093 * running log write. These commit records are strictly ordered in ascending CIL
1094 * sequence order so that log recovery will always replay the checkpoints in the
1101 struct xlog *log = ctx->cil->xc_log; in xlog_cil_write_commit_record() local
1120 if (xlog_is_shutdown(log)) in xlog_cil_write_commit_record()
1129 error = xlog_write(log, ctx, &lv_chain, ctx->ticket, reg.i_len); in xlog_cil_write_commit_record()
1131 xlog_force_shutdown(log, SHUTDOWN_LOG_IO_ERROR); in xlog_cil_write_commit_record()
1147 * log opheaders that indicate the start of a log transaction and wrap the
1148 * transaction header. We keep the start record in it's own log vector rather
1165 /* Log start record */ in xlog_cil_build_trans_hdr()
1170 /* log iovec region pointer */ in xlog_cil_build_trans_hdr()
1175 /* log opheader */ in xlog_cil_build_trans_hdr()
1186 /* log iovec region pointer */ in xlog_cil_build_trans_hdr()
1202 * the list. This is important for operations like reflink where we log 4 order
1220 * Pull all the log vectors off the items in the CIL, and remove the items from
1224 * If a log item is marked with a whiteout, we do not need to write it to the
1251 /* we don't write ordered log vectors */ in xlog_cil_build_lv_chain()
1277 * Push the Committed Item List to the log.
1285 * Hence we can allow log forces to run racily and not issue pushes for the
1304 struct xlog *log = cil->xc_log; in xlog_cil_push_work() local
1317 new_ctx->ticket = xlog_cil_ticket_alloc(log); in xlog_cil_push_work()
1391 * that the commit records are correctly ordered in the log to ensure in xlog_cil_push_work()
1392 * that we process items during log IO completion in the correct order. in xlog_cil_push_work()
1395 * next (e.g. due to log forces), we do not want the checkpoint with in xlog_cil_push_work()
1400 * in log recovery. in xlog_cil_push_work()
1409 * against the current sequence in log forces without risking in xlog_cil_push_work()
1418 * Sort the log vector chain before we add the transaction headers. in xlog_cil_push_work()
1425 * Build a checkpoint transaction header and write it to the log to in xlog_cil_push_work()
1437 * xlog_cil_write_chain() as it should not be passed to log IO in xlog_cil_push_work()
1470 spin_lock(&log->l_icloglock); in xlog_cil_push_work()
1482 spin_lock(&log->l_icloglock); in xlog_cil_push_work()
1505 xlog_state_switch_iclogs(log, ctx->commit_iclog, 0); in xlog_cil_push_work()
1507 xlog_state_release_iclog(log, ctx->commit_iclog, ticket); in xlog_cil_push_work()
1511 spin_unlock(&log->l_icloglock); in xlog_cil_push_work()
1513 xfs_log_ticket_ungrant(log, ticket); in xlog_cil_push_work()
1525 ASSERT(xlog_is_shutdown(log)); in xlog_cil_push_work()
1528 xfs_log_ticket_ungrant(log, ctx->ticket); in xlog_cil_push_work()
1533 spin_lock(&log->l_icloglock); in xlog_cil_push_work()
1535 xlog_state_release_iclog(log, ctx->commit_iclog, ticket); in xlog_cil_push_work()
1537 spin_unlock(&log->l_icloglock); in xlog_cil_push_work()
1538 xfs_log_ticket_ungrant(log, ticket); in xlog_cil_push_work()
1544 * the log. The limit really is that a checkpoint can't be more than half the
1545 * log (the current checkpoint is not allowed to overwrite the previous
1551 struct xlog *log) in xlog_cil_push_background() argument
1553 struct xfs_cil *cil = log->l_cilp; in xlog_cil_push_background()
1571 if (space_used < XLOG_CIL_SPACE_LIMIT(log) || in xlog_cil_push_background()
1573 space_used < XLOG_CIL_BLOCKING_SPACE_LIMIT(log) && in xlog_cil_push_background()
1603 if (xlog_cil_over_hard_limit(log, space_used)) { in xlog_cil_push_background()
1604 trace_xfs_log_cil_wait(log, cil->xc_ctx->ticket); in xlog_cil_push_background()
1605 ASSERT(space_used < log->l_logsize); in xlog_cil_push_background()
1627 * ACTIVE iclog. This then requires another full log force to push to disk,
1634 struct xlog *log, in xlog_cil_push_now() argument
1638 struct xfs_cil *cil = log->l_cilp; in xlog_cil_push_now()
1677 struct xlog *log) in xlog_cil_empty() argument
1679 struct xfs_cil *cil = log->l_cilp; in xlog_cil_empty()
1741 struct xlog *log, in xlog_cil_commit() argument
1746 struct xfs_cil *cil = log->l_cilp; in xlog_cil_commit()
1755 xlog_cil_alloc_shadow_bufs(log, tp); in xlog_cil_commit()
1763 xlog_cil_insert_items(log, tp, released_space); in xlog_cil_commit()
1765 if (regrant && !xlog_is_shutdown(log)) in xlog_cil_commit()
1766 xfs_log_ticket_regrant(log, tp->t_ticket); in xlog_cil_commit()
1768 xfs_log_ticket_ungrant(log, tp->t_ticket); in xlog_cil_commit()
1777 * have to update state in the log items and unlock them before they go in xlog_cil_commit()
1780 * the log items. This affects (at least) processing of stale buffers, in xlog_cil_commit()
1793 xlog_cil_push_background(log); in xlog_cil_commit()
1799 * but otherwise is no different to a push done from a log force.
1803 struct xlog *log) in xlog_cil_flush() argument
1805 xfs_csn_t seq = log->l_cilp->xc_current_sequence; in xlog_cil_flush()
1807 trace_xfs_log_force(log->l_mp, seq, _RET_IP_); in xlog_cil_flush()
1808 xlog_cil_push_now(log, seq, true); in xlog_cil_flush()
1814 if (test_bit(XLOG_CIL_EMPTY, &log->l_cilp->xc_flags)) in xlog_cil_flush()
1815 xfs_log_force(log->l_mp, 0); in xlog_cil_flush()
1830 struct xlog *log, in xlog_cil_force_seq() argument
1833 struct xfs_cil *cil = log->l_cilp; in xlog_cil_force_seq()
1841 trace_xfs_log_force(log->l_mp, sequence, _RET_IP_); in xlog_cil_force_seq()
1849 xlog_cil_push_now(log, sequence, false); in xlog_cil_force_seq()
1864 if (xlog_is_shutdown(log)) in xlog_cil_force_seq()
1873 XFS_STATS_INC(log->l_mp, xs_log_force_sleep); in xlog_cil_force_seq()
1908 * We detected a shutdown in progress. We need to trigger the log force in xlog_cil_force_seq()
1911 * NULLCOMMITLSN here as that has special meaning to log forces (i.e. in xlog_cil_force_seq()
1924 struct xlog *log) in xlog_cil_init() argument
1936 * concurrency the log spinlocks will be exposed to. in xlog_cil_init()
1940 4, log->l_mp->m_super->s_id); in xlog_cil_init()
1944 cil->xc_log = log; in xlog_cil_init()
1961 log->l_cilp = cil; in xlog_cil_init()
1976 struct xlog *log) in xlog_cil_destroy() argument
1978 struct xfs_cil *cil = log->l_cilp; in xlog_cil_destroy()