Lines Matching refs:ailp

32 	struct xfs_ail		*ailp,  in xfs_ail_check()  argument
43 if (list_empty(&ailp->ail_head)) in xfs_ail_check()
51 if (&prev_lip->li_ail != &ailp->ail_head) in xfs_ail_check()
54 if (&next_lip->li_ail != &ailp->ail_head) in xfs_ail_check()
63 spin_unlock(&ailp->ail_lock); in xfs_ail_check()
67 spin_lock(&ailp->ail_lock); in xfs_ail_check()
79 struct xfs_ail *ailp) in xfs_ail_max() argument
81 if (list_empty(&ailp->ail_head)) in xfs_ail_max()
84 return list_entry(ailp->ail_head.prev, xfs_log_item_t, li_ail); in xfs_ail_max()
93 struct xfs_ail *ailp, in xfs_ail_next() argument
96 if (lip->li_ail.next == &ailp->ail_head) in xfs_ail_next()
112 struct xfs_ail *ailp) in xfs_ail_min_lsn() argument
117 spin_lock(&ailp->ail_lock); in xfs_ail_min_lsn()
118 lip = xfs_ail_min(ailp); in xfs_ail_min_lsn()
121 spin_unlock(&ailp->ail_lock); in xfs_ail_min_lsn()
131 struct xfs_ail *ailp) in xfs_ail_max_lsn() argument
136 spin_lock(&ailp->ail_lock); in xfs_ail_max_lsn()
137 lip = xfs_ail_max(ailp); in xfs_ail_max_lsn()
140 spin_unlock(&ailp->ail_lock); in xfs_ail_max_lsn()
154 struct xfs_ail *ailp, in xfs_trans_ail_cursor_init() argument
158 list_add_tail(&cur->list, &ailp->ail_cursors); in xfs_trans_ail_cursor_init()
167 struct xfs_ail *ailp, in xfs_trans_ail_cursor_next() argument
173 lip = xfs_ail_min(ailp); in xfs_trans_ail_cursor_next()
175 cur->item = xfs_ail_next(ailp, lip); in xfs_trans_ail_cursor_next()
201 struct xfs_ail *ailp, in xfs_trans_ail_cursor_clear() argument
206 list_for_each_entry(cur, &ailp->ail_cursors, list) { in xfs_trans_ail_cursor_clear()
221 struct xfs_ail *ailp, in xfs_trans_ail_cursor_first() argument
227 xfs_trans_ail_cursor_init(ailp, cur); in xfs_trans_ail_cursor_first()
230 lip = xfs_ail_min(ailp); in xfs_trans_ail_cursor_first()
234 list_for_each_entry(lip, &ailp->ail_head, li_ail) { in xfs_trans_ail_cursor_first()
242 cur->item = xfs_ail_next(ailp, lip); in xfs_trans_ail_cursor_first()
248 struct xfs_ail *ailp, in __xfs_trans_ail_cursor_last() argument
253 list_for_each_entry_reverse(lip, &ailp->ail_head, li_ail) { in __xfs_trans_ail_cursor_last()
268 struct xfs_ail *ailp, in xfs_trans_ail_cursor_last() argument
272 xfs_trans_ail_cursor_init(ailp, cur); in xfs_trans_ail_cursor_last()
273 cur->item = __xfs_trans_ail_cursor_last(ailp, lsn); in xfs_trans_ail_cursor_last()
285 struct xfs_ail *ailp, in xfs_ail_splice() argument
301 lip = __xfs_trans_ail_cursor_last(ailp, lsn); in xfs_ail_splice()
322 list_splice(list, &ailp->ail_head); in xfs_ail_splice()
330 struct xfs_ail *ailp, in xfs_ail_delete() argument
333 xfs_ail_check(ailp, lip); in xfs_ail_delete()
335 xfs_trans_ail_cursor_clear(ailp, lip); in xfs_ail_delete()
340 struct xfs_ail *ailp, in xfsaild_push_item() argument
347 if (XFS_TEST_ERROR(false, ailp->ail_mount, XFS_ERRTAG_LOG_ITEM_PIN)) in xfsaild_push_item()
350 return lip->li_ops->iop_push(lip, &ailp->ail_buf_list); in xfsaild_push_item()
355 struct xfs_ail *ailp) in xfsaild_push() argument
357 xfs_mount_t *mp = ailp->ail_mount; in xfsaild_push()
372 if (ailp->ail_log_flush && ailp->ail_last_pushed_lsn == 0 && in xfsaild_push()
373 (!list_empty_careful(&ailp->ail_buf_list) || in xfsaild_push()
374 xfs_ail_min_lsn(ailp))) { in xfsaild_push()
375 ailp->ail_log_flush = 0; in xfsaild_push()
381 spin_lock(&ailp->ail_lock); in xfsaild_push()
385 target = ailp->ail_target; in xfsaild_push()
386 ailp->ail_target_prev = target; in xfsaild_push()
388 lip = xfs_trans_ail_cursor_first(ailp, &cur, ailp->ail_last_pushed_lsn); in xfsaild_push()
395 spin_unlock(&ailp->ail_lock); in xfsaild_push()
410 lock_result = xfsaild_push_item(ailp, lip); in xfsaild_push()
416 ailp->ail_last_pushed_lsn = lsn; in xfsaild_push()
435 ailp->ail_last_pushed_lsn = lsn; in xfsaild_push()
443 ailp->ail_log_flush++; in xfsaild_push()
474 lip = xfs_trans_ail_cursor_next(ailp, &cur); in xfsaild_push()
480 spin_unlock(&ailp->ail_lock); in xfsaild_push()
482 if (xfs_buf_delwri_submit_nowait(&ailp->ail_buf_list)) in xfsaild_push()
483 ailp->ail_log_flush++; in xfsaild_push()
493 ailp->ail_last_pushed_lsn = 0; in xfsaild_push()
506 ailp->ail_last_pushed_lsn = 0; in xfsaild_push()
521 struct xfs_ail *ailp = data; in xfsaild() local
559 ASSERT(list_empty(&ailp->ail_buf_list) || in xfsaild()
560 XFS_FORCED_SHUTDOWN(ailp->ail_mount)); in xfsaild()
561 xfs_buf_delwri_cancel(&ailp->ail_buf_list); in xfsaild()
565 spin_lock(&ailp->ail_lock); in xfsaild()
577 if (!xfs_ail_min(ailp) && in xfsaild()
578 ailp->ail_target == ailp->ail_target_prev) { in xfsaild()
579 spin_unlock(&ailp->ail_lock); in xfsaild()
584 spin_unlock(&ailp->ail_lock); in xfsaild()
593 tout = xfsaild_push(ailp); in xfsaild()
616 struct xfs_ail *ailp, in xfs_ail_push() argument
621 lip = xfs_ail_min(ailp); in xfs_ail_push()
622 if (!lip || XFS_FORCED_SHUTDOWN(ailp->ail_mount) || in xfs_ail_push()
623 XFS_LSN_CMP(threshold_lsn, ailp->ail_target) <= 0) in xfs_ail_push()
631 xfs_trans_ail_copy_lsn(ailp, &ailp->ail_target, &threshold_lsn); in xfs_ail_push()
634 wake_up_process(ailp->ail_task); in xfs_ail_push()
642 struct xfs_ail *ailp) in xfs_ail_push_all() argument
644 xfs_lsn_t threshold_lsn = xfs_ail_max_lsn(ailp); in xfs_ail_push_all()
647 xfs_ail_push(ailp, threshold_lsn); in xfs_ail_push_all()
655 struct xfs_ail *ailp) in xfs_ail_push_all_sync() argument
660 spin_lock(&ailp->ail_lock); in xfs_ail_push_all_sync()
661 while ((lip = xfs_ail_max(ailp)) != NULL) { in xfs_ail_push_all_sync()
662 prepare_to_wait(&ailp->ail_empty, &wait, TASK_UNINTERRUPTIBLE); in xfs_ail_push_all_sync()
663 ailp->ail_target = lip->li_lsn; in xfs_ail_push_all_sync()
664 wake_up_process(ailp->ail_task); in xfs_ail_push_all_sync()
665 spin_unlock(&ailp->ail_lock); in xfs_ail_push_all_sync()
667 spin_lock(&ailp->ail_lock); in xfs_ail_push_all_sync()
669 spin_unlock(&ailp->ail_lock); in xfs_ail_push_all_sync()
671 finish_wait(&ailp->ail_empty, &wait); in xfs_ail_push_all_sync()
698 struct xfs_ail *ailp, in xfs_trans_ail_update_bulk() argument
702 xfs_lsn_t lsn) __releases(ailp->ail_lock) in xfs_trans_ail_update_bulk()
710 mlip = xfs_ail_min(ailp); in xfs_trans_ail_update_bulk()
720 xfs_ail_delete(ailp, lip); in xfs_trans_ail_update_bulk()
731 xfs_ail_splice(ailp, cur, &tmp, lsn); in xfs_trans_ail_update_bulk()
734 if (!XFS_FORCED_SHUTDOWN(ailp->ail_mount)) in xfs_trans_ail_update_bulk()
735 xlog_assign_tail_lsn_locked(ailp->ail_mount); in xfs_trans_ail_update_bulk()
736 spin_unlock(&ailp->ail_lock); in xfs_trans_ail_update_bulk()
738 xfs_log_space_wake(ailp->ail_mount); in xfs_trans_ail_update_bulk()
740 spin_unlock(&ailp->ail_lock); in xfs_trans_ail_update_bulk()
746 struct xfs_ail *ailp, in xfs_ail_delete_one() argument
749 struct xfs_log_item *mlip = xfs_ail_min(ailp); in xfs_ail_delete_one()
752 xfs_ail_delete(ailp, lip); in xfs_ail_delete_one()
783 struct xfs_ail *ailp, in xfs_trans_ail_delete() argument
785 int shutdown_type) __releases(ailp->ail_lock) in xfs_trans_ail_delete()
787 struct xfs_mount *mp = ailp->ail_mount; in xfs_trans_ail_delete()
791 spin_unlock(&ailp->ail_lock); in xfs_trans_ail_delete()
801 mlip_changed = xfs_ail_delete_one(ailp, lip); in xfs_trans_ail_delete()
805 if (list_empty(&ailp->ail_head)) in xfs_trans_ail_delete()
806 wake_up_all(&ailp->ail_empty); in xfs_trans_ail_delete()
809 spin_unlock(&ailp->ail_lock); in xfs_trans_ail_delete()
811 xfs_log_space_wake(ailp->ail_mount); in xfs_trans_ail_delete()
818 struct xfs_ail *ailp; in xfs_trans_ail_init() local
820 ailp = kmem_zalloc(sizeof(struct xfs_ail), KM_MAYFAIL); in xfs_trans_ail_init()
821 if (!ailp) in xfs_trans_ail_init()
824 ailp->ail_mount = mp; in xfs_trans_ail_init()
825 INIT_LIST_HEAD(&ailp->ail_head); in xfs_trans_ail_init()
826 INIT_LIST_HEAD(&ailp->ail_cursors); in xfs_trans_ail_init()
827 spin_lock_init(&ailp->ail_lock); in xfs_trans_ail_init()
828 INIT_LIST_HEAD(&ailp->ail_buf_list); in xfs_trans_ail_init()
829 init_waitqueue_head(&ailp->ail_empty); in xfs_trans_ail_init()
831 ailp->ail_task = kthread_run(xfsaild, ailp, "xfsaild/%s", in xfs_trans_ail_init()
832 ailp->ail_mount->m_fsname); in xfs_trans_ail_init()
833 if (IS_ERR(ailp->ail_task)) in xfs_trans_ail_init()
836 mp->m_ail = ailp; in xfs_trans_ail_init()
840 kmem_free(ailp); in xfs_trans_ail_init()
848 struct xfs_ail *ailp = mp->m_ail; in xfs_trans_ail_destroy() local
850 kthread_stop(ailp->ail_task); in xfs_trans_ail_destroy()
851 kmem_free(ailp); in xfs_trans_ail_destroy()