40 xfs_log_item_t *prev_lip;
42 if (list_empty(&ailp->
xa_ail))
48 ASSERT((lip->li_flags & XFS_LI_IN_AIL) != 0);
49 prev_lip =
list_entry(lip->li_ail.prev, xfs_log_item_t, li_ail);
50 if (&prev_lip->li_ail != &ailp->
xa_ail)
51 ASSERT(XFS_LSN_CMP(prev_lip->li_lsn, lip->li_lsn) <= 0);
53 prev_lip =
list_entry(lip->li_ail.next, xfs_log_item_t, li_ail);
54 if (&prev_lip->li_ail != &ailp->
xa_ail)
55 ASSERT(XFS_LSN_CMP(prev_lip->li_lsn, lip->li_lsn) >= 0);
58 #ifdef XFS_TRANS_DEBUG
66 if (&prev_lip->li_ail != &ailp->
xa_ail)
67 ASSERT(XFS_LSN_CMP(prev_lip->li_lsn, lip->li_lsn) <= 0);
68 ASSERT((lip->li_flags & XFS_LI_IN_AIL) != 0);
74 #define xfs_ail_check(a,l)
85 if (list_empty(&ailp->
xa_ail))
95 static xfs_log_item_t *
99 if (list_empty(&ailp->
xa_ail))
109 static xfs_log_item_t *
114 if (lip->li_ail.next == &ailp->
xa_ail)
155 lip = xfs_ail_max(ailp);
183 struct xfs_log_item *
188 struct xfs_log_item *lip = cur->
item;
190 if ((__psint_t)lip & 1)
193 cur->
item = xfs_ail_next(ailp, lip);
207 list_del_init(&cur->
list);
221 struct xfs_log_item *lip)
226 if (cur->
item == lip)
227 cur->
item = (
struct xfs_log_item *)
228 ((__psint_t)cur->
item | 1);
254 if (XFS_LSN_CMP(lip->li_lsn, lsn) >= 0)
261 cur->
item = xfs_ail_next(ailp, lip);
265 static struct xfs_log_item *
266 __xfs_trans_ail_cursor_last(
273 if (XFS_LSN_CMP(lip->li_lsn, lsn) <= 0)
285 struct xfs_log_item *
292 cur->
item = __xfs_trans_ail_cursor_last(ailp, lsn);
309 struct xfs_log_item *
lip;
311 ASSERT(!list_empty(list));
319 if (!lip || (__psint_t) lip & 1)
320 lip = __xfs_trans_ail_cursor_last(ailp, lsn);
339 list_splice(list, &lip->li_ail);
341 list_splice(list, &ailp->
xa_ail);
406 while ((XFS_LSN_CMP(lip->li_lsn, target) <= 0)) {
415 switch (lock_result) {
416 case XFS_ITEM_SUCCESS:
418 trace_xfs_ail_push(lip);
423 case XFS_ITEM_FLUSHING:
436 trace_xfs_ail_flushing(lip);
442 case XFS_ITEM_PINNED:
444 trace_xfs_ail_pinned(lip);
449 case XFS_ITEM_LOCKED:
451 trace_xfs_ail_locked(lip);
489 if (!count || XFS_LSN_CMP(lsn, target) >= 0) {
498 }
else if (((stuck + flushing) * 100) / count > 90) {
531 if (tout && tout <= 20)
564 tout = xfsaild_push(ailp);
592 if (!lip || XFS_FORCED_SHUTDOWN(ailp->
xa_mount) ||
593 XFS_LSN_CMP(threshold_lsn, ailp->
xa_target) <= 0)
601 xfs_trans_ail_copy_lsn(ailp, &ailp->
xa_target, &threshold_lsn);
614 xfs_lsn_t threshold_lsn = xfs_ail_max_lsn(ailp);
627 struct xfs_log_item *
lip;
631 while ((lip = xfs_ail_max(ailp)) !=
NULL) {
670 struct xfs_log_item **log_items,
674 xfs_log_item_t *mlip;
675 int mlip_changed = 0;
682 for (i = 0; i < nr_items; i++) {
683 struct xfs_log_item *lip = log_items[
i];
684 if (lip->li_flags & XFS_LI_IN_AIL) {
686 if (XFS_LSN_CMP(lsn, lip->li_lsn) <= 0)
689 xfs_ail_delete(ailp, lip);
693 lip->li_flags |= XFS_LI_IN_AIL;
696 list_add(&lip->li_ail, &
tmp);
699 if (!list_empty(&
tmp))
700 xfs_ail_splice(ailp, cur, &
tmp, lsn);
703 if (!XFS_FORCED_SHUTDOWN(ailp->
xa_mount))
737 struct xfs_log_item **log_items,
741 xfs_log_item_t *mlip;
742 int mlip_changed = 0;
747 for (i = 0; i < nr_items; i++) {
748 struct xfs_log_item *lip = log_items[
i];
749 if (!(lip->li_flags & XFS_LI_IN_AIL)) {
750 struct xfs_mount *mp = ailp->
xa_mount;
753 if (!XFS_FORCED_SHUTDOWN(mp)) {
755 "%s: attempting to delete a log item that is not in the AIL",
757 xfs_force_shutdown(mp, shutdown_type);
762 xfs_ail_delete(ailp, lip);
763 lip->li_flags &= ~XFS_LI_IN_AIL;
770 if (!XFS_FORCED_SHUTDOWN(ailp->
xa_mount))
772 if (list_empty(&ailp->
xa_ail))
793 INIT_LIST_HEAD(&ailp->
xa_ail);
816 struct xfs_ail *ailp = mp->m_ail;