Lines Matching refs:cil

51 xlog_cil_set_iclog_hdr_count(struct xfs_cil *cil)
53 struct xlog *log = cil->xc_log;
55 atomic_set(&cil->xc_iclog_hdrs,
71 struct xfs_cil *cil,
74 if (test_bit(XLOG_CIL_EMPTY, &cil->xc_flags))
82 return lip->li_seq == READ_ONCE(cil->xc_current_sequence);
120 struct xfs_cil *cil,
127 cilpcp = per_cpu_ptr(cil->xc_pcp, cpu);
140 * We're in the middle of switching cil contexts. Reset the
156 struct xfs_cil *cil,
164 if (!test_and_clear_bit(XLOG_CIL_PCP_SPACE, &cil->xc_flags))
176 cilpcp = per_cpu_ptr(cil->xc_pcp, cpu);
188 struct xfs_cil *cil,
191 xlog_cil_set_iclog_hdr_count(cil);
192 set_bit(XLOG_CIL_EMPTY, &cil->xc_flags);
193 set_bit(XLOG_CIL_PCP_SPACE, &cil->xc_flags);
194 ctx->sequence = ++cil->xc_current_sequence;
195 ctx->cil = cil;
196 cil->xc_ctx = ctx;
555 struct xfs_cil *cil = log->l_cilp;
556 struct xfs_cil_ctx *ctx = cil->xc_ctx;
587 cilpcp = this_cpu_ptr(cil->xc_pcp);
600 if (test_bit(XLOG_CIL_EMPTY, &cil->xc_flags) &&
601 test_and_clear_bit(XLOG_CIL_EMPTY, &cil->xc_flags))
619 * The cil->xc_ctx_lock provides the serialisation necessary for safely
623 if (atomic_read(&cil->xc_iclog_hdrs) > 0 ||
631 atomic_sub(tp->t_ticket->t_iclog_hdrs, &cil->xc_iclog_hdrs);
639 if (!test_bit(XLOG_CIL_PCP_SPACE, &cil->xc_flags)) {
652 xlog_cil_insert_pcp_aggregate(cil, 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,
743 spin_lock(&ctx->cil->xc_push_lock);
745 spin_unlock(&ctx->cil->xc_push_lock);
783 struct xfs_cil *cil = ctx->cil;
788 spin_lock(&cil->xc_push_lock);
797 wake_up_all(&cil->xc_start_wait);
798 spin_unlock(&cil->xc_push_lock);
805 spin_lock(&cil->xc_log->l_icloglock);
807 spin_unlock(&cil->xc_log->l_icloglock);
826 spin_lock(&cil->xc_log->l_icloglock);
828 spin_unlock(&cil->xc_log->l_icloglock);
835 spin_lock(&cil->xc_push_lock);
838 wake_up_all(&cil->xc_commit_wait);
839 spin_unlock(&cil->xc_push_lock);
855 struct xfs_cil *cil,
862 spin_lock(&cil->xc_push_lock);
863 list_for_each_entry(ctx, &cil->xc_committing, committing) {
869 if (xlog_is_shutdown(cil->xc_log)) {
870 spin_unlock(&cil->xc_push_lock);
885 xlog_wait(&cil->xc_start_wait, &cil->xc_push_lock);
891 xlog_wait(&cil->xc_commit_wait, &cil->xc_push_lock);
897 spin_unlock(&cil->xc_push_lock);
912 struct xlog *log = ctx->cil->xc_log;
915 error = xlog_cil_order_write(ctx->cil, ctx->sequence, _START_RECORD);
931 struct xlog *log = ctx->cil->xc_log;
953 error = xlog_cil_order_write(ctx->cil, ctx->sequence, _COMMIT_RECORD);
1126 struct xfs_cil *cil = ctx->cil;
1127 struct xlog *log = cil->xc_log;
1142 down_write(&cil->xc_ctx_lock);
1144 spin_lock(&cil->xc_push_lock);
1145 push_seq = cil->xc_push_seq;
1147 push_commit_stable = cil->xc_push_commit_stable;
1148 cil->xc_push_commit_stable = false;
1158 if (waitqueue_active(&cil->xc_push_wait))
1159 wake_up_all(&cil->xc_push_wait);
1161 xlog_cil_push_pcp_aggregate(cil, ctx);
1168 if (test_bit(XLOG_CIL_EMPTY, &cil->xc_flags)) {
1169 cil->xc_push_seq = 0;
1170 spin_unlock(&cil->xc_push_lock);
1177 spin_unlock(&cil->xc_push_lock);
1205 list_add(&ctx->committing, &cil->xc_committing);
1206 spin_unlock(&cil->xc_push_lock);
1229 * xfs_log_force_seq requires us to mirror the new sequence into the cil
1235 spin_lock(&cil->xc_push_lock);
1236 xlog_cil_ctx_switch(cil, new_ctx);
1237 spin_unlock(&cil->xc_push_lock);
1238 up_write(&cil->xc_ctx_lock);
1340 up_write(&cil->xc_ctx_lock);
1370 struct xlog *log) __releases(cil->xc_ctx_lock)
1372 struct xfs_cil *cil = log->l_cilp;
1373 int space_used = atomic_read(&cil->xc_ctx->space_used);
1376 * The cil won't be empty because we are called while holding the
1379 ASSERT(!test_bit(XLOG_CIL_EMPTY, &cil->xc_flags));
1391 (cil->xc_push_seq == cil->xc_current_sequence &&
1393 !waitqueue_active(&cil->xc_push_wait))) {
1394 up_read(&cil->xc_ctx_lock);
1398 spin_lock(&cil->xc_push_lock);
1399 if (cil->xc_push_seq < cil->xc_current_sequence) {
1400 cil->xc_push_seq = cil->xc_current_sequence;
1401 queue_work(cil->xc_push_wq, &cil->xc_ctx->push_work);
1410 up_read(&cil->xc_ctx_lock);
1423 trace_xfs_log_cil_wait(log, cil->xc_ctx->ticket);
1425 xlog_wait(&cil->xc_push_wait, &cil->xc_push_lock);
1429 spin_unlock(&cil->xc_push_lock);
1457 struct xfs_cil *cil = log->l_cilp;
1459 if (!cil)
1462 ASSERT(push_seq && push_seq <= cil->xc_current_sequence);
1466 flush_workqueue(cil->xc_push_wq);
1468 spin_lock(&cil->xc_push_lock);
1477 cil->xc_push_commit_stable = async;
1483 if (test_bit(XLOG_CIL_EMPTY, &cil->xc_flags) ||
1484 push_seq <= cil->xc_push_seq) {
1485 spin_unlock(&cil->xc_push_lock);
1489 cil->xc_push_seq = push_seq;
1490 queue_work(cil->xc_push_wq, &cil->xc_ctx->push_work);
1491 spin_unlock(&cil->xc_push_lock);
1498 struct xfs_cil *cil = log->l_cilp;
1501 spin_lock(&cil->xc_push_lock);
1502 if (test_bit(XLOG_CIL_EMPTY, &cil->xc_flags))
1504 spin_unlock(&cil->xc_push_lock);
1520 struct xfs_cil *cil,
1531 if (!ilip || !xlog_item_in_current_chkpt(cil, ilip))
1565 struct xfs_cil *cil = log->l_cilp;
1577 down_read(&cil->xc_ctx_lock);
1580 released_space = xlog_cil_process_intents(cil, tp);
1606 lip->li_ops->iop_committing(lip, cil->xc_ctx->sequence);
1609 *commit_seq = cil->xc_ctx->sequence;
1611 /* xlog_cil_push_background() releases cil->xc_ctx_lock */
1652 struct xfs_cil *cil = log->l_cilp;
1656 ASSERT(sequence <= cil->xc_current_sequence);
1659 sequence = cil->xc_current_sequence;
1676 spin_lock(&cil->xc_push_lock);
1677 list_for_each_entry(ctx, &cil->xc_committing, committing) {
1693 xlog_wait(&cil->xc_commit_wait, &cil->xc_push_lock);
1717 if (sequence == cil->xc_current_sequence &&
1718 !test_bit(XLOG_CIL_EMPTY, &cil->xc_flags)) {
1719 spin_unlock(&cil->xc_push_lock);
1723 spin_unlock(&cil->xc_push_lock);
1734 spin_unlock(&cil->xc_push_lock);
1745 struct xfs_cil *cil;
1750 cil = kmem_zalloc(sizeof(*cil), KM_MAYFAIL);
1751 if (!cil)
1757 cil->xc_push_wq = alloc_workqueue("xfs-cil/%s",
1760 if (!cil->xc_push_wq)
1763 cil->xc_log = log;
1764 cil->xc_pcp = alloc_percpu(struct xlog_cil_pcp);
1765 if (!cil->xc_pcp)
1769 cilpcp = per_cpu_ptr(cil->xc_pcp, cpu);
1774 INIT_LIST_HEAD(&cil->xc_committing);
1775 spin_lock_init(&cil->xc_push_lock);
1776 init_waitqueue_head(&cil->xc_push_wait);
1777 init_rwsem(&cil->xc_ctx_lock);
1778 init_waitqueue_head(&cil->xc_start_wait);
1779 init_waitqueue_head(&cil->xc_commit_wait);
1780 log->l_cilp = cil;
1783 xlog_cil_ctx_switch(cil, ctx);
1787 destroy_workqueue(cil->xc_push_wq);
1789 kmem_free(cil);
1797 struct xfs_cil *cil = log->l_cilp;
1799 if (cil->xc_ctx) {
1800 if (cil->xc_ctx->ticket)
1801 xfs_log_ticket_put(cil->xc_ctx->ticket);
1802 kmem_free(cil->xc_ctx);
1805 ASSERT(test_bit(XLOG_CIL_EMPTY, &cil->xc_flags));
1806 free_percpu(cil->xc_pcp);
1807 destroy_workqueue(cil->xc_push_wq);
1808 kmem_free(cil);