Lines Matching refs:ctx

101 	struct xfs_cil_ctx	*ctx;
103 ctx = kmem_zalloc(sizeof(*ctx), KM_NOFS);
104 INIT_LIST_HEAD(&ctx->committing);
105 INIT_LIST_HEAD(&ctx->busy_extents.extent_list);
106 INIT_LIST_HEAD(&ctx->log_items);
107 INIT_LIST_HEAD(&ctx->lv_chain);
108 INIT_WORK(&ctx->push_work, xlog_cil_push_work);
109 return ctx;
121 struct xfs_cil_ctx *ctx)
126 for_each_cpu(cpu, &ctx->cil_pcpmask) {
129 ctx->ticket->t_curr_res += cilpcp->space_reserved;
134 &ctx->busy_extents.extent_list);
137 list_splice_init(&cilpcp->log_items, &ctx->log_items);
157 struct xfs_cil_ctx *ctx)
173 for_each_cpu(cpu, &ctx->cil_pcpmask) {
183 atomic_add(count, &ctx->space_used);
189 struct xfs_cil_ctx *ctx)
194 ctx->sequence = ++cil->xc_current_sequence;
195 ctx->cil = cil;
196 cil->xc_ctx = ctx;
556 struct xfs_cil_ctx *ctx = cil->xc_ctx;
590 if (!cpumask_test_cpu(cpu_nr, &ctx->cil_pcpmask))
591 cpumask_test_and_set_cpu(cpu_nr, &ctx->cil_pcpmask);
602 ctx_res = ctx->ticket->t_unit_res;
622 space_used = atomic_read(&ctx->space_used) + cilpcp->space_used + len;
640 atomic_add(len, &ctx->space_used);
644 &ctx->space_used);
652 xlog_cil_insert_pcp_aggregate(cil, ctx);
666 order = atomic_inc_return(&ctx->order_id);
691 xfs_warn(log->l_mp, " ctx ticket: %d bytes", ctx_res);
717 struct xfs_cil_ctx *ctx)
719 struct xfs_mount *mp = ctx->cil->xc_log->l_mp;
720 bool abort = xlog_is_shutdown(ctx->cil->xc_log);
730 spin_lock(&ctx->cil->xc_push_lock);
731 wake_up_all(&ctx->cil->xc_start_wait);
732 wake_up_all(&ctx->cil->xc_commit_wait);
733 spin_unlock(&ctx->cil->xc_push_lock);
736 xfs_trans_committed_bulk(ctx->cil->xc_log->l_ailp, &ctx->lv_chain,
737 ctx->start_lsn, abort);
739 xfs_extent_busy_sort(&ctx->busy_extents.extent_list);
740 xfs_extent_busy_clear(mp, &ctx->busy_extents.extent_list,
743 spin_lock(&ctx->cil->xc_push_lock);
744 list_del(&ctx->committing);
745 spin_unlock(&ctx->cil->xc_push_lock);
747 xlog_cil_free_logvec(&ctx->lv_chain);
749 if (!list_empty(&ctx->busy_extents.extent_list)) {
750 ctx->busy_extents.mount = mp;
751 ctx->busy_extents.owner = ctx;
752 xfs_discard_extents(mp, &ctx->busy_extents);
756 kmem_free(ctx);
763 struct xfs_cil_ctx *ctx;
765 while ((ctx = list_first_entry_or_null(list,
767 list_del(&ctx->iclog_entry);
768 xlog_cil_committed(ctx);
780 struct xfs_cil_ctx *ctx,
783 struct xfs_cil *cil = ctx->cil;
786 ASSERT(!ctx->commit_lsn);
787 if (!ctx->start_lsn) {
796 ctx->start_lsn = lsn;
827 list_add_tail(&ctx->iclog_entry, &iclog->ic_callbacks);
836 ctx->commit_iclog = iclog;
837 ctx->commit_lsn = lsn;
859 struct xfs_cil_ctx *ctx;
863 list_for_each_entry(ctx, &cil->xc_committing, committing) {
878 if (ctx->sequence >= sequence)
884 if (!ctx->start_lsn) {
890 if (!ctx->commit_lsn) {
909 struct xfs_cil_ctx *ctx,
912 struct xlog *log = ctx->cil->xc_log;
915 error = xlog_cil_order_write(ctx->cil, ctx->sequence, _START_RECORD);
918 return xlog_write(log, ctx, &ctx->lv_chain, ctx->ticket, chain_len);
929 struct xfs_cil_ctx *ctx)
931 struct xlog *log = ctx->cil->xc_log;
934 .oh_tid = cpu_to_be32(ctx->ticket->t_tid),
953 error = xlog_cil_order_write(ctx->cil, ctx->sequence, _COMMIT_RECORD);
958 ctx->ticket->t_curr_res -= reg.i_len;
959 error = xlog_write(log, ctx, &lv_chain, ctx->ticket, reg.i_len);
985 struct xfs_cil_ctx *ctx,
990 struct xlog_ticket *tic = ctx->ticket;
1060 struct xfs_cil_ctx *ctx,
1065 while (!list_empty(&ctx->log_items)) {
1069 item = list_first_entry(&ctx->log_items,
1085 list_add_tail(&lv->lv_list, &ctx->lv_chain);
1124 struct xfs_cil_ctx *ctx =
1126 struct xfs_cil *cil = ctx->cil;
1146 ASSERT(push_seq <= ctx->sequence);
1154 * to the new context. The ctx->xc_push_lock provides the serialisation
1161 xlog_cil_push_pcp_aggregate(cil, ctx);
1176 if (push_seq < ctx->sequence) {
1205 list_add(&ctx->committing, &cil->xc_committing);
1208 xlog_cil_build_lv_chain(ctx, &whiteouts, &num_iovecs, &num_bytes);
1245 list_sort(NULL, &ctx->lv_chain, xlog_cil_order_cmp);
1254 xlog_cil_build_trans_hdr(ctx, &thdr, &lvhdr, num_iovecs);
1256 list_add(&lvhdr.lv_list, &ctx->lv_chain);
1263 error = xlog_cil_write_chain(ctx, num_bytes);
1268 error = xlog_cil_write_commit_record(ctx);
1273 * Grab the ticket from the ctx so we can ungrant it after releasing the
1274 * commit_iclog. The ctx may be freed by the time we return from
1276 * callback run) so we can't reference the ctx after the call to
1279 ticket = ctx->ticket;
1294 if (ctx->start_lsn != ctx->commit_lsn) {
1297 plsn = be64_to_cpu(ctx->commit_iclog->ic_prev->ic_header.h_lsn);
1298 if (plsn && XFS_LSN_CMP(plsn, ctx->commit_lsn) < 0) {
1304 xlog_wait_on_iclog(ctx->commit_iclog->ic_prev);
1312 ctx->commit_iclog->ic_flags |= XLOG_ICL_NEED_FLUSH;
1325 ctx->commit_iclog->ic_flags |= XLOG_ICL_NEED_FUA;
1327 ctx->commit_iclog->ic_state == XLOG_STATE_ACTIVE)
1328 xlog_state_switch_iclogs(log, ctx->commit_iclog, 0);
1329 ticket = ctx->ticket;
1330 xlog_state_release_iclog(log, ctx->commit_iclog, ticket);
1332 /* Not safe to reference ctx now! */
1348 if (!ctx->commit_iclog) {
1349 xfs_log_ticket_ungrant(log, ctx->ticket);
1350 xlog_cil_committed(ctx);
1354 ticket = ctx->ticket;
1355 xlog_state_release_iclog(log, ctx->commit_iclog, ticket);
1356 /* Not safe to reference ctx now! */
1419 * The ctx->xc_push_lock provides the serialisation necessary for safely
1653 struct xfs_cil_ctx *ctx;
1677 list_for_each_entry(ctx, &cil->xc_committing, committing) {
1685 if (ctx->sequence > sequence)
1687 if (!ctx->commit_lsn) {
1696 if (ctx->sequence != sequence)
1699 commit_lsn = ctx->commit_lsn;
1746 struct xfs_cil_ctx *ctx;
1782 ctx = xlog_cil_ctx_alloc();
1783 xlog_cil_ctx_switch(cil, ctx);