Lines Matching defs:log

36 	struct xlog	*log)
40 tic = xlog_ticket_alloc(log, 0, 1, XFS_TRANSACTION, 0);
51 * After the first stage of log recovery is done, we know where the head and
52 * tail of the log are. We need this log initialisation done before we can
55 * Here we allocate a log ticket to track space usage during a CIL push. This
56 * ticket is passed to xlog_write() directly so that we don't slowly leak log
57 * space by failing to account for space used by log headers and additional
62 struct xlog *log)
64 log->l_cilp->xc_ctx->ticket = xlog_cil_ticket_alloc(log);
65 log->l_cilp->xc_ctx->sequence = 1;
78 * Allocate or pin log vector buffers for CIL insertion.
81 * modified items into the log during a push. The biggest problem with this is
93 * xc_ctx_lock, but because the log vector buffers are disposable, that opens
94 * up a TOCTOU race condition w.r.t. the CIL committing and removing the log
96 * log vector buffer within the xc_ctx_lock.
98 * Because the log vector buffer needs to be unchanged during the CIL push
101 * into the log. This means skipping preallocation of buffer space is
106 * log item is committed for the second time, and then to only use this buffer
107 * if necessary. The buffer can remain attached to the log item until such time
114 * This function builds a vector for the changes in each log item in the
115 * transaction. It then works out the length of the buffer needed for each log
116 * item, allocates them and attaches the vector to the log item in preparation
125 struct xlog *log,
183 * the buffer, only the log vector header and the iovec
219 * Prepare the log item for insertion into the CIL. Calculate the difference in
220 * log space and vectors it will consume, and if it is a new item pin it as
225 struct xlog *log,
256 /* attach new log vector to log item */
261 * CIL, store the sequence number on the log item so we can
266 lv->lv_item->li_seq = log->l_cilp->xc_ctx->sequence;
270 * Format log item into a flat buffers
273 * changes on the log item. This enables us to relog the item in memory and
277 * This function takes the prepared log vectors attached to each log item, and
278 * formats the changes into the log vector buffer. The buffer it uses is
283 * done lazily either by th enext modification or the freeing of the log item.
299 struct xlog *log,
307 /* Bail out if we didn't find a log item. */
325 * the shadow lv on the log item.
374 xfs_cil_prepare_item(log, lv, old_lv, diff_len, diff_iovecs);
379 * Insert the log items into the CIL and calculate the difference in space
381 * if the change requires additional log metadata. If it does, take that space
387 struct xlog *log,
390 struct xfs_cil *cil = log->l_cilp;
404 xlog_cil_insert_format_items(log, tp, &len, &diff_iovecs);
430 /* do we need space for more log record headers? */
431 iclog_space = log->l_iclog_size - log->l_iclog_hsize;
436 split_res *= log->l_iclog_hsize + sizeof(struct xlog_op_header);
447 * the log items. Shutdown is imminent...
450 xfs_warn(log->l_mp, "Transaction log reservation overrun:");
451 xfs_warn(log->l_mp,
452 " log items: %d bytes (iov hdrs: %d bytes)",
454 xfs_warn(log->l_mp, " split region headers: %d bytes",
456 xfs_warn(log->l_mp, " ctx ticket: %d bytes", ctx_res);
483 xfs_force_shutdown(log->l_mp, SHUTDOWN_LOG_IO_ERROR);
570 * Mark all items committed and clear busy extents. We free the log vector
571 * chains in a separate pass so that we unpin the log items as quickly as
583 * Wake any commit waiters before aborting the log items so we don't
584 * block async log pushers on callbacks. Async log pushers explicitly do
585 * not wait on log force completion because they may be holding locks
627 * Push the Committed Item List to the log.
635 * Hence we can allow log forces to run racily and not issue pushes for the
646 struct xlog *log = cil->xc_log;
661 new_ctx->ticket = xlog_cil_ticket_alloc(log);
727 * pull all the log vectors off the items in the CIL, and
752 * during log forces to extract the commit lsn of the sequence that
765 * that the commit records are correctly ordered in the log to ensure
766 * that we process items during log IO completion in the correct order.
769 * next (e.g. due to log forces), we do not want the checkpoint with
774 * in log recovery.
783 * against the current sequence in log forces without risking
792 * Build a checkpoint transaction header and write it to the log to
796 * The LSN we need to pass to the log items on transaction commit is
797 * the LSN reported by the first log vector write. If we use the commit
814 error = xlog_write(log, &lvhdr, tic, &ctx->start_lsn, NULL, 0, true);
819 * now that we've written the checkpoint into the log, strictly
830 if (XLOG_FORCED_SHUTDOWN(log)) {
852 error = xlog_commit_record(log, tic, &commit_iclog, &commit_lsn);
856 xfs_log_ticket_ungrant(log, tic);
889 xfs_log_ticket_ungrant(log, tic);
891 ASSERT(XLOG_FORCED_SHUTDOWN(log));
897 * the log. The limit really is that a checkpoint can't be more than half the
898 * log (the current checkpoint is not allowed to overwrite the previous
904 struct xlog *log) __releases(cil->xc_ctx_lock)
906 struct xfs_cil *cil = log->l_cilp;
918 if (cil->xc_ctx->space_used < XLOG_CIL_SPACE_LIMIT(log)) {
926 queue_work(log->l_mp->m_cil_workqueue, &cil->xc_push_work);
947 if (cil->xc_ctx->space_used >= XLOG_CIL_BLOCKING_SPACE_LIMIT(log) ||
949 trace_xfs_log_cil_wait(log, cil->xc_ctx->ticket);
950 ASSERT(cil->xc_ctx->space_used < log->l_logsize);
967 struct xlog *log,
970 struct xfs_cil *cil = log->l_cilp;
991 queue_work(log->l_mp->m_cil_workqueue, &cil->xc_push_work);
997 struct xlog *log)
999 struct xfs_cil *cil = log->l_cilp;
1024 struct xlog *log,
1029 struct xfs_cil *cil = log->l_cilp;
1037 xlog_cil_alloc_shadow_bufs(log, tp);
1042 xlog_cil_insert_items(log, tp);
1044 if (regrant && !XLOG_FORCED_SHUTDOWN(log))
1045 xfs_log_ticket_regrant(log, tp->t_ticket);
1047 xfs_log_ticket_ungrant(log, tp->t_ticket);
1056 * have to update state in the log items and unlock them before they go
1059 * the log items. This affects (at least) processing of stale buffers,
1072 xlog_cil_push_background(log);
1087 struct xlog *log,
1090 struct xfs_cil *cil = log->l_cilp;
1102 xlog_cil_push_now(log, sequence);
1117 if (XLOG_FORCED_SHUTDOWN(log))
1160 * We detected a shutdown in progress. We need to trigger the log force
1163 * NULLCOMMITLSN here as that has special meaning to log forces (i.e.
1172 * Check if the current log item was first committed in this sequence.
1173 * We can't rely on just the log item being in the CIL, we have to check
1190 * li_seq is written on the first commit of a log item to record the
1202 struct xlog *log)
1233 cil->xc_log = log;
1234 log->l_cilp = cil;
1240 struct xlog *log)
1242 if (log->l_cilp->xc_ctx) {
1243 if (log->l_cilp->xc_ctx->ticket)
1244 xfs_log_ticket_put(log->l_cilp->xc_ctx->ticket);
1245 kmem_free(log->l_cilp->xc_ctx);
1248 ASSERT(list_empty(&log->l_cilp->xc_cil));
1249 kmem_free(log->l_cilp);