diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_trans_ail.c | 65 | ||||
-rw-r--r-- | fs/xfs/xfs_trans_priv.h | 18 |
2 files changed, 11 insertions, 72 deletions
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c index 8481a5a6d6c2..c5bbbc45db91 100644 --- a/fs/xfs/xfs_trans_ail.c +++ b/fs/xfs/xfs_trans_ail.c | |||
@@ -523,70 +523,6 @@ xfs_trans_ail_update_bulk( | |||
523 | } | 523 | } |
524 | 524 | ||
525 | /* | 525 | /* |
526 | * Delete the given item from the AIL. It must already be in | ||
527 | * the AIL. | ||
528 | * | ||
529 | * Wakeup anyone with an lsn less than item's lsn. If the item | ||
530 | * we delete in the AIL is the minimum one, update the tail lsn in the | ||
531 | * log manager. | ||
532 | * | ||
533 | * Clear the IN_AIL flag from the item, reset its lsn to 0, and | ||
534 | * bump the AIL's generation count to indicate that the tree | ||
535 | * has changed. | ||
536 | * | ||
537 | * This function must be called with the AIL lock held. The lock | ||
538 | * is dropped before returning. | ||
539 | */ | ||
540 | void | ||
541 | xfs_trans_ail_delete( | ||
542 | struct xfs_ail *ailp, | ||
543 | xfs_log_item_t *lip) __releases(ailp->xa_lock) | ||
544 | { | ||
545 | xfs_log_item_t *mlip; | ||
546 | xfs_lsn_t tail_lsn; | ||
547 | |||
548 | if (lip->li_flags & XFS_LI_IN_AIL) { | ||
549 | mlip = xfs_ail_min(ailp); | ||
550 | xfs_ail_delete(ailp, lip); | ||
551 | |||
552 | |||
553 | lip->li_flags &= ~XFS_LI_IN_AIL; | ||
554 | lip->li_lsn = 0; | ||
555 | |||
556 | if (mlip == lip) { | ||
557 | mlip = xfs_ail_min(ailp); | ||
558 | /* | ||
559 | * It is not safe to access mlip after the AIL lock | ||
560 | * is dropped, so we must get a copy of li_lsn | ||
561 | * before we do so. This is especially important | ||
562 | * on 32-bit platforms where accessing and updating | ||
563 | * 64-bit values like li_lsn is not atomic. | ||
564 | */ | ||
565 | tail_lsn = mlip ? mlip->li_lsn : 0; | ||
566 | spin_unlock(&ailp->xa_lock); | ||
567 | xfs_log_move_tail(ailp->xa_mount, tail_lsn); | ||
568 | } else { | ||
569 | spin_unlock(&ailp->xa_lock); | ||
570 | } | ||
571 | } | ||
572 | else { | ||
573 | /* | ||
574 | * If the file system is not being shutdown, we are in | ||
575 | * serious trouble if we get to this stage. | ||
576 | */ | ||
577 | struct xfs_mount *mp = ailp->xa_mount; | ||
578 | |||
579 | spin_unlock(&ailp->xa_lock); | ||
580 | if (!XFS_FORCED_SHUTDOWN(mp)) { | ||
581 | xfs_cmn_err(XFS_PTAG_AILDELETE, CE_ALERT, mp, | ||
582 | "%s: attempting to delete a log item that is not in the AIL", | ||
583 | __func__); | ||
584 | xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); | ||
585 | } | ||
586 | } | ||
587 | } | ||
588 | |||
589 | /* | ||
590 | * xfs_trans_ail_delete_bulk - remove multiple log items from the AIL | 526 | * xfs_trans_ail_delete_bulk - remove multiple log items from the AIL |
591 | * | 527 | * |
592 | * @xfs_trans_ail_delete_bulk takes an array of log items that all need to | 528 | * @xfs_trans_ail_delete_bulk takes an array of log items that all need to |
@@ -660,7 +596,6 @@ xfs_trans_ail_delete_bulk( | |||
660 | xfs_log_move_tail(ailp->xa_mount, tail_lsn); | 596 | xfs_log_move_tail(ailp->xa_mount, tail_lsn); |
661 | } | 597 | } |
662 | 598 | ||
663 | |||
664 | /* | 599 | /* |
665 | * The active item list (AIL) is a doubly linked list of log | 600 | * The active item list (AIL) is a doubly linked list of log |
666 | * items sorted by ascending lsn. The base of the list is | 601 | * items sorted by ascending lsn. The base of the list is |
diff --git a/fs/xfs/xfs_trans_priv.h b/fs/xfs/xfs_trans_priv.h index f46920589ca5..35162c238fa3 100644 --- a/fs/xfs/xfs_trans_priv.h +++ b/fs/xfs/xfs_trans_priv.h | |||
@@ -87,13 +87,17 @@ xfs_trans_ail_update( | |||
87 | xfs_trans_ail_update_bulk(ailp, &lip, 1, lsn); | 87 | xfs_trans_ail_update_bulk(ailp, &lip, 1, lsn); |
88 | } | 88 | } |
89 | 89 | ||
90 | void xfs_trans_ail_delete(struct xfs_ail *ailp, | 90 | void xfs_trans_ail_delete_bulk(struct xfs_ail *ailp, |
91 | struct xfs_log_item *lip) | 91 | struct xfs_log_item **log_items, int nr_items) |
92 | __releases(ailp->xa_lock); | 92 | __releases(ailp->xa_lock); |
93 | void xfs_trans_ail_delete_bulk(struct xfs_ail *ailp, | 93 | static inline void |
94 | struct xfs_log_item **log_items, | 94 | xfs_trans_ail_delete( |
95 | int nr_items) | 95 | struct xfs_ail *ailp, |
96 | __releases(ailp->xa_lock); | 96 | xfs_log_item_t *lip) __releases(ailp->xa_lock) |
97 | { | ||
98 | xfs_trans_ail_delete_bulk(ailp, &lip, 1); | ||
99 | } | ||
100 | |||
97 | void xfs_trans_ail_push(struct xfs_ail *, xfs_lsn_t); | 101 | void xfs_trans_ail_push(struct xfs_ail *, xfs_lsn_t); |
98 | void xfs_trans_unlocked_item(struct xfs_ail *, | 102 | void xfs_trans_unlocked_item(struct xfs_ail *, |
99 | xfs_log_item_t *); | 103 | xfs_log_item_t *); |