]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
xfs: refactor xfs_buf_ioend
authorChristoph Hellwig <hch@lst.de>
Tue, 1 Sep 2020 17:55:20 +0000 (10:55 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 16 Sep 2020 03:52:38 +0000 (20:52 -0700)
Move the log recovery I/O completion handling entirely into the log
recovery code, and re-arrange the normal I/O completion handler flow
to prepare to lifting more logic into common code in the next commits.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_buf.c
fs/xfs/xfs_log_recover.c

index 03dd12a83b82a157785b82ac5c01b0dfbd02c8b7..6447cf051e08c9e10220b0941287048a33f89d53 100644 (file)
@@ -1197,33 +1197,26 @@ xfs_buf_ioend(
                if (!bp->b_error)
                        bp->b_flags |= XBF_DONE;
                xfs_buf_ioend_finish(bp);
-               return;
-       }
-
-       if (!bp->b_error) {
-               bp->b_flags &= ~XBF_WRITE_FAIL;
-               bp->b_flags |= XBF_DONE;
-       }
-
-       /*
-        * If this is a log recovery buffer, we aren't doing transactional IO
-        * yet so we need to let it handle IO completions.
-        */
-       if (bp->b_flags & _XBF_LOGRECOVERY) {
+       } else if (bp->b_flags & _XBF_LOGRECOVERY) {
+               /*
+                * If this is a log recovery buffer, we aren't doing
+                * transactional I/O yet so we need to let the log recovery code
+                * handle I/O completions:
+                */
                xlog_recover_iodone(bp);
-               return;
-       }
-
-       if (bp->b_flags & _XBF_INODES) {
-               xfs_buf_inode_iodone(bp);
-               return;
-       }
+       } else {
+               if (!bp->b_error) {
+                       bp->b_flags &= ~XBF_WRITE_FAIL;
+                       bp->b_flags |= XBF_DONE;
+               }
 
-       if (bp->b_flags & _XBF_DQUOTS) {
-               xfs_buf_dquot_iodone(bp);
-               return;
+               if (bp->b_flags & _XBF_INODES)
+                       xfs_buf_inode_iodone(bp);
+               else if (bp->b_flags & _XBF_DQUOTS)
+                       xfs_buf_dquot_iodone(bp);
+               else
+                       xfs_buf_iodone(bp);
        }
-       xfs_buf_iodone(bp);
 }
 
 static void
index 45dca18a95204746bb43bb0a7c5e2c38d1e9c3f7..5b2e5067ab444ed63139aa98dbbff62e796529c3 100644 (file)
@@ -269,15 +269,15 @@ void
 xlog_recover_iodone(
        struct xfs_buf  *bp)
 {
-       if (bp->b_error) {
+       if (!bp->b_error) {
+               bp->b_flags |= XBF_DONE;
+       } else if (!XFS_FORCED_SHUTDOWN(bp->b_mount)) {
                /*
-                * We're not going to bother about retrying
-                * this during recovery. One strike!
+                * We're not going to bother about retrying this during
+                * recovery. One strike!
                 */
-               if (!XFS_FORCED_SHUTDOWN(bp->b_mount)) {
-                       xfs_buf_ioerror_alert(bp, __this_address);
-                       xfs_force_shutdown(bp->b_mount, SHUTDOWN_META_IO_ERROR);
-               }
+               xfs_buf_ioerror_alert(bp, __this_address);
+               xfs_force_shutdown(bp->b_mount, SHUTDOWN_META_IO_ERROR);
        }
 
        /*