Lines Matching full:log
36 struct xlog *log) in xlog_cil_ticket_alloc() argument
40 tic = xlog_ticket_alloc(log, 0, 1, XFS_TRANSACTION, 0); in xlog_cil_ticket_alloc()
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) in xlog_cil_init_post_recovery() argument
64 log->l_cilp->xc_ctx->ticket = xlog_cil_ticket_alloc(log); in xlog_cil_init_post_recovery()
65 log->l_cilp->xc_ctx->sequence = 1; in xlog_cil_init_post_recovery()
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, in xlog_cil_alloc_shadow_bufs() argument
183 * the buffer, only the log vector header and the iovec in xlog_cil_alloc_shadow_bufs()
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, in xfs_cil_prepare_item() argument
256 /* attach new log vector to log item */ in xfs_cil_prepare_item()
261 * CIL, store the sequence number on the log item so we can in xfs_cil_prepare_item()
266 lv->lv_item->li_seq = log->l_cilp->xc_ctx->sequence; in xfs_cil_prepare_item()
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, in xlog_cil_insert_format_items() argument
307 /* Bail out if we didn't find a log item. */ in xlog_cil_insert_format_items()
325 * the shadow lv on the log item. in xlog_cil_insert_format_items()
374 xfs_cil_prepare_item(log, lv, old_lv, diff_len, diff_iovecs); in xlog_cil_insert_format_items()
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, in xlog_cil_insert_items() argument
390 struct xfs_cil *cil = log->l_cilp; in xlog_cil_insert_items()
404 xlog_cil_insert_format_items(log, tp, &len, &diff_iovecs); in xlog_cil_insert_items()
430 /* do we need space for more log record headers? */ in xlog_cil_insert_items()
431 iclog_space = log->l_iclog_size - log->l_iclog_hsize; in xlog_cil_insert_items()
436 split_res *= log->l_iclog_hsize + sizeof(struct xlog_op_header); in xlog_cil_insert_items()
447 * the log items. Shutdown is imminent... in xlog_cil_insert_items()
450 xfs_warn(log->l_mp, "Transaction log reservation overrun:"); in xlog_cil_insert_items()
451 xfs_warn(log->l_mp, in xlog_cil_insert_items()
452 " log items: %d bytes (iov hdrs: %d bytes)", in xlog_cil_insert_items()
454 xfs_warn(log->l_mp, " split region headers: %d bytes", in xlog_cil_insert_items()
456 xfs_warn(log->l_mp, " ctx ticket: %d bytes", ctx_res); in xlog_cil_insert_items()
483 xfs_force_shutdown(log->l_mp, SHUTDOWN_LOG_IO_ERROR); in xlog_cil_insert_items()
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 in xlog_cil_committed()
584 * block async log pushers on callbacks. Async log pushers explicitly do in xlog_cil_committed()
585 * not wait on log force completion because they may be holding locks in xlog_cil_committed()
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; in xlog_cil_push_work() local
661 new_ctx->ticket = xlog_cil_ticket_alloc(log); in xlog_cil_push_work()
727 * pull all the log vectors off the items in the CIL, and in xlog_cil_push_work()
752 * during log forces to extract the commit lsn of the sequence that in xlog_cil_push_work()
765 * that the commit records are correctly ordered in the log to ensure in xlog_cil_push_work()
766 * that we process items during log IO completion in the correct order. in xlog_cil_push_work()
769 * next (e.g. due to log forces), we do not want the checkpoint with in xlog_cil_push_work()
774 * in log recovery. in xlog_cil_push_work()
783 * against the current sequence in log forces without risking in xlog_cil_push_work()
792 * Build a checkpoint transaction header and write it to the log to in xlog_cil_push_work()
796 * The LSN we need to pass to the log items on transaction commit is in xlog_cil_push_work()
797 * the LSN reported by the first log vector write. If we use the commit in xlog_cil_push_work()
814 error = xlog_write(log, &lvhdr, tic, &ctx->start_lsn, NULL, 0, true); in xlog_cil_push_work()
819 * now that we've written the checkpoint into the log, strictly in xlog_cil_push_work()
830 if (XLOG_FORCED_SHUTDOWN(log)) { in xlog_cil_push_work()
852 error = xlog_commit_record(log, tic, &commit_iclog, &commit_lsn); in xlog_cil_push_work()
856 xfs_log_ticket_ungrant(log, tic); in xlog_cil_push_work()
889 xfs_log_ticket_ungrant(log, tic); in xlog_cil_push_work()
891 ASSERT(XLOG_FORCED_SHUTDOWN(log)); in xlog_cil_push_work()
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) in xlog_cil_push_background() argument
906 struct xfs_cil *cil = log->l_cilp; in xlog_cil_push_background()
918 if (cil->xc_ctx->space_used < XLOG_CIL_SPACE_LIMIT(log)) { in xlog_cil_push_background()
926 queue_work(log->l_mp->m_cil_workqueue, &cil->xc_push_work); in xlog_cil_push_background()
947 if (cil->xc_ctx->space_used >= XLOG_CIL_BLOCKING_SPACE_LIMIT(log) || in xlog_cil_push_background()
949 trace_xfs_log_cil_wait(log, cil->xc_ctx->ticket); in xlog_cil_push_background()
950 ASSERT(cil->xc_ctx->space_used < log->l_logsize); in xlog_cil_push_background()
967 struct xlog *log, in xlog_cil_push_now() argument
970 struct xfs_cil *cil = log->l_cilp; in xlog_cil_push_now()
991 queue_work(log->l_mp->m_cil_workqueue, &cil->xc_push_work); in xlog_cil_push_now()
997 struct xlog *log) in xlog_cil_empty() argument
999 struct xfs_cil *cil = log->l_cilp; in xlog_cil_empty()
1024 struct xlog *log, in xlog_cil_commit() argument
1029 struct xfs_cil *cil = log->l_cilp; in xlog_cil_commit()
1037 xlog_cil_alloc_shadow_bufs(log, tp); in xlog_cil_commit()
1042 xlog_cil_insert_items(log, tp); in xlog_cil_commit()
1044 if (regrant && !XLOG_FORCED_SHUTDOWN(log)) in xlog_cil_commit()
1045 xfs_log_ticket_regrant(log, tp->t_ticket); in xlog_cil_commit()
1047 xfs_log_ticket_ungrant(log, tp->t_ticket); in xlog_cil_commit()
1056 * have to update state in the log items and unlock them before they go in xlog_cil_commit()
1059 * the log items. This affects (at least) processing of stale buffers, in xlog_cil_commit()
1072 xlog_cil_push_background(log); in xlog_cil_commit()
1087 struct xlog *log, in xlog_cil_force_seq() argument
1090 struct xfs_cil *cil = log->l_cilp; in xlog_cil_force_seq()
1102 xlog_cil_push_now(log, sequence); in xlog_cil_force_seq()
1117 if (XLOG_FORCED_SHUTDOWN(log)) in xlog_cil_force_seq()
1160 * We detected a shutdown in progress. We need to trigger the log force in xlog_cil_force_seq()
1163 * NULLCOMMITLSN here as that has special meaning to log forces (i.e. in xlog_cil_force_seq()
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 in xfs_log_item_in_current_chkpt()
1202 struct xlog *log) in xlog_cil_init() argument
1233 cil->xc_log = log; in xlog_cil_init()
1234 log->l_cilp = cil; in xlog_cil_init()
1240 struct xlog *log) in xlog_cil_destroy() argument
1242 if (log->l_cilp->xc_ctx) { in xlog_cil_destroy()
1243 if (log->l_cilp->xc_ctx->ticket) in xlog_cil_destroy()
1244 xfs_log_ticket_put(log->l_cilp->xc_ctx->ticket); in xlog_cil_destroy()
1245 kmem_free(log->l_cilp->xc_ctx); in xlog_cil_destroy()
1248 ASSERT(list_empty(&log->l_cilp->xc_cil)); in xlog_cil_destroy()
1249 kmem_free(log->l_cilp); in xlog_cil_destroy()