Lines Matching defs: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);
1133 struct xfs_cil *cil = ctx->cil;
1134 struct xlog *log = cil->xc_log;
1149 down_write(&cil->xc_ctx_lock);
1151 spin_lock(&cil->xc_push_lock);
1152 push_seq = cil->xc_push_seq;
1154 push_commit_stable = cil->xc_push_commit_stable;
1155 cil->xc_push_commit_stable = false;
1165 if (waitqueue_active(&cil->xc_push_wait))
1166 wake_up_all(&cil->xc_push_wait);
1168 xlog_cil_push_pcp_aggregate(cil, ctx);
1175 if (test_bit(XLOG_CIL_EMPTY, &cil->xc_flags)) {
1176 cil->xc_push_seq = 0;
1177 spin_unlock(&cil->xc_push_lock);
1184 spin_unlock(&cil->xc_push_lock);
1212 list_add(&ctx->committing, &cil->xc_committing);
1213 spin_unlock(&cil->xc_push_lock);
1236 * xfs_log_force_seq requires us to mirror the new sequence into the cil
1242 spin_lock(&cil->xc_push_lock);
1243 xlog_cil_ctx_switch(cil, new_ctx);
1244 spin_unlock(&cil->xc_push_lock);
1245 up_write(&cil->xc_ctx_lock);
1348 up_write(&cil->xc_ctx_lock);
1381 struct xlog *log) __releases(cil->xc_ctx_lock)
1383 struct xfs_cil *cil = log->l_cilp;
1384 int space_used = atomic_read(&cil->xc_ctx->space_used);
1387 * The cil won't be empty because we are called while holding the
1390 ASSERT(!test_bit(XLOG_CIL_EMPTY, &cil->xc_flags));
1402 (cil->xc_push_seq == cil->xc_current_sequence &&
1404 !waitqueue_active(&cil->xc_push_wait))) {
1405 up_read(&cil->xc_ctx_lock);
1409 spin_lock(&cil->xc_push_lock);
1410 if (cil->xc_push_seq < cil->xc_current_sequence) {
1411 cil->xc_push_seq = cil->xc_current_sequence;
1412 queue_work(cil->xc_push_wq, &cil->xc_ctx->push_work);
1421 up_read(&cil->xc_ctx_lock);
1434 trace_xfs_log_cil_wait(log, cil->xc_ctx->ticket);
1436 xlog_wait(&cil->xc_push_wait, &cil->xc_push_lock);
1440 spin_unlock(&cil->xc_push_lock);
1468 struct xfs_cil *cil = log->l_cilp;
1470 if (!cil)
1473 ASSERT(push_seq && push_seq <= cil->xc_current_sequence);
1477 flush_workqueue(cil->xc_push_wq);
1479 spin_lock(&cil->xc_push_lock);
1488 cil->xc_push_commit_stable = async;
1494 if (test_bit(XLOG_CIL_EMPTY, &cil->xc_flags) ||
1495 push_seq <= cil->xc_push_seq) {
1496 spin_unlock(&cil->xc_push_lock);
1500 cil->xc_push_seq = push_seq;
1501 queue_work(cil->xc_push_wq, &cil->xc_ctx->push_work);
1502 spin_unlock(&cil->xc_push_lock);
1509 struct xfs_cil *cil = log->l_cilp;
1512 spin_lock(&cil->xc_push_lock);
1513 if (test_bit(XLOG_CIL_EMPTY, &cil->xc_flags))
1515 spin_unlock(&cil->xc_push_lock);
1531 struct xfs_cil *cil,
1542 if (!ilip || !xlog_item_in_current_chkpt(cil, ilip))
1576 struct xfs_cil *cil = log->l_cilp;
1588 down_read(&cil->xc_ctx_lock);
1591 released_space = xlog_cil_process_intents(cil, tp);
1617 lip->li_ops->iop_committing(lip, cil->xc_ctx->sequence);
1620 *commit_seq = cil->xc_ctx->sequence;
1622 /* xlog_cil_push_background() releases cil->xc_ctx_lock */
1663 struct xfs_cil *cil = log->l_cilp;
1667 ASSERT(sequence <= cil->xc_current_sequence);
1670 sequence = cil->xc_current_sequence;
1687 spin_lock(&cil->xc_push_lock);
1688 list_for_each_entry(ctx, &cil->xc_committing, committing) {
1704 xlog_wait(&cil->xc_commit_wait, &cil->xc_push_lock);
1728 if (sequence == cil->xc_current_sequence &&
1729 !test_bit(XLOG_CIL_EMPTY, &cil->xc_flags)) {
1730 spin_unlock(&cil->xc_push_lock);
1734 spin_unlock(&cil->xc_push_lock);
1745 spin_unlock(&cil->xc_push_lock);
1756 struct xfs_cil *cil;
1761 cil = kzalloc(sizeof(*cil), GFP_KERNEL | __GFP_RETRY_MAYFAIL);
1762 if (!cil)
1768 cil->xc_push_wq = alloc_workqueue("xfs-cil/%s",
1771 if (!cil->xc_push_wq)
1774 cil->xc_log = log;
1775 cil->xc_pcp = alloc_percpu(struct xlog_cil_pcp);
1776 if (!cil->xc_pcp)
1780 cilpcp = per_cpu_ptr(cil->xc_pcp, cpu);
1785 INIT_LIST_HEAD(&cil->xc_committing);
1786 spin_lock_init(&cil->xc_push_lock);
1787 init_waitqueue_head(&cil->xc_push_wait);
1788 init_rwsem(&cil->xc_ctx_lock);
1789 init_waitqueue_head(&cil->xc_start_wait);
1790 init_waitqueue_head(&cil->xc_commit_wait);
1791 log->l_cilp = cil;
1794 xlog_cil_ctx_switch(cil, ctx);
1798 destroy_workqueue(cil->xc_push_wq);
1800 kfree(cil);
1808 struct xfs_cil *cil = log->l_cilp;
1810 if (cil->xc_ctx) {
1811 if (cil->xc_ctx->ticket)
1812 xfs_log_ticket_put(cil->xc_ctx->ticket);
1813 kfree(cil->xc_ctx);
1816 ASSERT(test_bit(XLOG_CIL_EMPTY, &cil->xc_flags));
1817 free_percpu(cil->xc_pcp);
1818 destroy_workqueue(cil->xc_push_wq);
1819 kfree(cil);