]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: move b_li_list based retry handling to common code
authorChristoph Hellwig <hch@lst.de>
Mon, 30 Dec 2024 10:39:02 +0000 (10:39 +0000)
committerChristoph Hellwig <hch@lst.de>
Mon, 13 Jan 2025 04:17:37 +0000 (05:17 +0100)
The dquot and inode version are very similar, which is expected given the
overall b_li_list logic.  The differences are that the inode version also
clears the XFS_LI_FLUSHING which is defined in common but only ever set
by the inode item, and that the dquot version takes the ail_lock over
the list iteration.  While this seems sensible given that additions and
removals from b_li_list are protected by the ail_lock, log items are
only added before buffer submission, and are only removed when completing
the buffer, so nothing can change the list when retrying a buffer.

Signed-off-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_buf.c
fs/xfs/xfs_buf_item.h
fs/xfs/xfs_dquot.c
fs/xfs/xfs_inode_item.c

index 19f519df330733299cfa6aa790bd050d2067ce71..2a842c64e3180f251360e8563492982f44d239af 100644 (file)
@@ -1287,6 +1287,7 @@ xfs_buf_ioend_handle_error(
 {
        struct xfs_mount        *mp = bp->b_mount;
        struct xfs_error_cfg    *cfg;
+       struct xfs_log_item     *lip;
 
        /*
         * If we've already shutdown the journal because of I/O errors, there's
@@ -1334,12 +1335,11 @@ xfs_buf_ioend_handle_error(
        }
 
        /* Still considered a transient error. Caller will schedule retries. */
-       if (bp->b_flags & _XBF_INODES)
-               xfs_buf_inode_io_fail(bp);
-       else if (bp->b_flags & _XBF_DQUOTS)
-               xfs_buf_dquot_io_fail(bp);
-       else
-               ASSERT(list_empty(&bp->b_li_list));
+       list_for_each_entry(lip, &bp->b_li_list, li_bio_list) {
+               set_bit(XFS_LI_FAILED, &lip->li_flags);
+               clear_bit(XFS_LI_FLUSHING, &lip->li_flags);
+       }
+
        xfs_buf_ioerror(bp, 0);
        xfs_buf_relse(bp);
        return true;
index 4d8a6aece995d9a103b85c07fb5b1d0727f240e4..8cde85259a586d5049260f92727d72664bcad7a8 100644 (file)
@@ -54,17 +54,12 @@ bool        xfs_buf_item_put(struct xfs_buf_log_item *);
 void   xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint);
 bool   xfs_buf_item_dirty_format(struct xfs_buf_log_item *);
 void   xfs_buf_inode_iodone(struct xfs_buf *);
-void   xfs_buf_inode_io_fail(struct xfs_buf *bp);
 #ifdef CONFIG_XFS_QUOTA
 void   xfs_buf_dquot_iodone(struct xfs_buf *);
-void   xfs_buf_dquot_io_fail(struct xfs_buf *bp);
 #else
 static inline void xfs_buf_dquot_iodone(struct xfs_buf *bp)
 {
 }
-static inline void xfs_buf_dquot_io_fail(struct xfs_buf *bp)
-{
-}
 #endif /* CONFIG_XFS_QUOTA */
 void   xfs_buf_iodone(struct xfs_buf *);
 bool   xfs_buf_log_check_iovec(struct xfs_log_iovec *iovec);
index 84b69f686ba82e3224343d930bb931bb3d58cdc2..1082c5d980c85f40f2ada4e110a34aca8b3b1ca9 100644 (file)
@@ -1230,18 +1230,6 @@ xfs_buf_dquot_iodone(
        }
 }
 
-void
-xfs_buf_dquot_io_fail(
-       struct xfs_buf          *bp)
-{
-       struct xfs_log_item     *lip;
-
-       spin_lock(&bp->b_mount->m_ail->ail_lock);
-       list_for_each_entry(lip, &bp->b_li_list, li_bio_list)
-               set_bit(XFS_LI_FAILED, &lip->li_flags);
-       spin_unlock(&bp->b_mount->m_ail->ail_lock);
-}
-
 /* Check incore dquot for errors before we flush. */
 static xfs_failaddr_t
 xfs_qm_dqflush_check(
index 70283c6419fd30e63d81468c8a6c8b3ee410f1de..9b3dac5b2a3332e3def9b7ff9f108e0e1f23bb4a 100644 (file)
@@ -1039,18 +1039,6 @@ xfs_buf_inode_iodone(
                list_splice_tail(&flushed_inodes, &bp->b_li_list);
 }
 
-void
-xfs_buf_inode_io_fail(
-       struct xfs_buf          *bp)
-{
-       struct xfs_log_item     *lip;
-
-       list_for_each_entry(lip, &bp->b_li_list, li_bio_list) {
-               set_bit(XFS_LI_FAILED, &lip->li_flags);
-               clear_bit(XFS_LI_FLUSHING, &lip->li_flags);
-       }
-}
-
 /*
  * Clear the inode logging fields so no more flushes are attempted.  If we are
  * on a buffer list, it is now safe to remove it because the buffer is