]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
xfs: combine xfs_trans_ail_[remove|delete]()
authorBrian Foster <bfoster@redhat.com>
Wed, 6 May 2020 20:27:04 +0000 (13:27 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 7 May 2020 15:27:48 +0000 (08:27 -0700)
Now that the functions and callers of
xfs_trans_ail_[remove|delete]() have been fixed up appropriately,
the only difference between the two is the shutdown behavior. There
are only a few callers of the _remove() variant, so make the
shutdown conditional on the parameter and combine the two functions.

Suggested-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Allison Collins <allison.henderson@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_buf_item.c
fs/xfs/xfs_dquot.c
fs/xfs/xfs_dquot_item.c
fs/xfs/xfs_inode_item.c
fs/xfs/xfs_trans_ail.c
fs/xfs/xfs_trans_priv.h

index 47c547aca1f15f5e92238eadd70ea2fecf0852a0..9e75e8d6042ec2f7d9492dbb1a0cda9a969efe1e 100644 (file)
@@ -558,7 +558,7 @@ xfs_buf_item_put(
         * state.
         */
        if (aborted)
-               xfs_trans_ail_remove(lip);
+               xfs_trans_ail_delete(lip, 0);
        xfs_buf_item_relse(bip->bli_buf);
        return true;
 }
index 497a9dbef1c9fe5559b1179035e1301e0beb4779..52e0f7245afc5ea03dc0c975f4987821265e9bef 100644 (file)
@@ -1162,7 +1162,7 @@ xfs_qm_dqflush(
 
 out_abort:
        dqp->dq_flags &= ~XFS_DQ_DIRTY;
-       xfs_trans_ail_remove(lip);
+       xfs_trans_ail_delete(lip, 0);
        xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
 out_unlock:
        xfs_dqfunlock(dqp);
index 8bd46810d5dbbac64f41948dd3cab0072639797f..349c92d26570c6d31e777c19a1faa6b98edd5c8b 100644 (file)
@@ -343,7 +343,7 @@ xfs_qm_qoff_logitem_relse(
        ASSERT(test_bit(XFS_LI_IN_AIL, &lip->li_flags) ||
               test_bit(XFS_LI_ABORTED, &lip->li_flags) ||
               XFS_FORCED_SHUTDOWN(lip->li_mountp));
-       xfs_trans_ail_remove(lip);
+       xfs_trans_ail_delete(lip, 0);
        kmem_free(lip->li_lv_shadow);
        kmem_free(qoff);
 }
index 73a37b18ab3e8f44b5e72ad22daef68cf498651b..664163be577818d47ff75dd4edb3054ebb34f9a9 100644 (file)
@@ -768,7 +768,7 @@ xfs_iflush_abort(
        struct xfs_inode_log_item *iip = ip->i_itemp;
 
        if (iip) {
-               xfs_trans_ail_remove(&iip->ili_item);
+               xfs_trans_ail_delete(&iip->ili_item, 0);
                iip->ili_logged = 0;
                /*
                 * Clear the ili_last_fields bits now that we know that the
index cfba691664c7f64d5ba17640938809e2cb362b0c..bf09d4b4df589fcb45d30a13b9c8023b29651576 100644 (file)
@@ -841,27 +841,6 @@ xfs_ail_delete_one(
        return 0;
 }
 
-/**
- * Remove a log items from the AIL
- *
- * @xfs_trans_ail_delete_bulk takes an array of log items that all need to
- * removed from the AIL. The caller is already holding the AIL lock, and done
- * all the checks necessary to ensure the items passed in via @log_items are
- * ready for deletion. This includes checking that the items are in the AIL.
- *
- * For each log item to be removed, unlink it  from the AIL, clear the IN_AIL
- * flag from the item and reset the item's lsn to 0. If we remove the first
- * item in the AIL, update the log tail to match the new minimum LSN in the
- * AIL.
- *
- * This function will not drop the AIL lock until all items are removed from
- * the AIL to minimise the amount of lock traffic on the AIL. This does not
- * greatly increase the AIL hold time, but does significantly reduce the amount
- * of traffic on the lock, especially during IO completion.
- *
- * This function must be called with the AIL lock held.  The lock is dropped
- * before returning.
- */
 void
 xfs_trans_ail_delete(
        struct xfs_log_item     *lip,
@@ -874,7 +853,7 @@ xfs_trans_ail_delete(
        spin_lock(&ailp->ail_lock);
        if (!test_bit(XFS_LI_IN_AIL, &lip->li_flags)) {
                spin_unlock(&ailp->ail_lock);
-               if (!XFS_FORCED_SHUTDOWN(mp)) {
+               if (shutdown_type && !XFS_FORCED_SHUTDOWN(mp)) {
                        xfs_alert_tag(mp, XFS_PTAG_AILDELETE,
        "%s: attempting to delete a log item that is not in the AIL",
                                        __func__);
@@ -883,6 +862,7 @@ xfs_trans_ail_delete(
                return;
        }
 
+       /* xfs_ail_update_finish() drops the AIL lock */
        tail_lsn = xfs_ail_delete_one(ailp, lip);
        xfs_ail_update_finish(ailp, tail_lsn);
 }
index ab0a82e908256ac6f52f4a0a09039b1cdc819d66..cc046d9557ae73b456ec5c7d7fdce53332ebf3f4 100644 (file)
@@ -96,23 +96,6 @@ void xfs_ail_update_finish(struct xfs_ail *ailp, xfs_lsn_t old_lsn)
                        __releases(ailp->ail_lock);
 void xfs_trans_ail_delete(struct xfs_log_item *lip, int shutdown_type);
 
-static inline void
-xfs_trans_ail_remove(
-       struct xfs_log_item     *lip)
-{
-       struct xfs_ail          *ailp = lip->li_ailp;
-       xfs_lsn_t               tail_lsn;
-
-       spin_lock(&ailp->ail_lock);
-       /* xfs_ail_update_finish() drops the AIL lock */
-       if (test_bit(XFS_LI_IN_AIL, &lip->li_flags)) {
-               tail_lsn = xfs_ail_delete_one(ailp, lip);
-               xfs_ail_update_finish(ailp, tail_lsn);
-       } else {
-               spin_unlock(&ailp->ail_lock);
-       }
-}
-
 void                   xfs_ail_push(struct xfs_ail *, xfs_lsn_t);
 void                   xfs_ail_push_all(struct xfs_ail *);
 void                   xfs_ail_push_all_sync(struct xfs_ail *);