xfs
[Top] [All Lists]

[PATCH 06/11] xfs: kill xfs_bdstrat_cb

To: xfs@xxxxxxxxxxx
Subject: [PATCH 06/11] xfs: kill xfs_bdstrat_cb
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Thu, 25 Sep 2014 22:34:16 +1000
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1411648461-29003-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1411648461-29003-1-git-send-email-david@xxxxxxxxxxxxx>
From: Dave Chinner <dchinner@xxxxxxxxxx>

Only has two callers, and is just a shutdown check and error handler
around xfs_buf_iorequest. However, the error handling is a mess of
read and write semantics, and both internal callers only call it for
writes. Hence kill the wrapper, and follow up with a patch to
sanitise the error handling.

Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
Reviewed-by: Christoph Hellwig <hch@xxxxxx>
---
 fs/xfs/xfs_buf.c | 48 +++++++++++++++++++++++++-----------------------
 1 file changed, 25 insertions(+), 23 deletions(-)

diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index a8f4a39..411111a 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1146,27 +1146,6 @@ xfs_bioerror_relse(
        return -EIO;
 }
 
-STATIC int
-xfs_bdstrat_cb(
-       struct xfs_buf  *bp)
-{
-       if (XFS_FORCED_SHUTDOWN(bp->b_target->bt_mount)) {
-               trace_xfs_bdstrat_shut(bp, _RET_IP_);
-               /*
-                * Metadata write that didn't get logged but
-                * written delayed anyway. These aren't associated
-                * with a transaction, and can be ignored.
-                */
-               if (!bp->b_iodone && !XFS_BUF_ISREAD(bp))
-                       return xfs_bioerror_relse(bp);
-               else
-                       return xfs_bioerror(bp);
-       }
-
-       xfs_buf_iorequest(bp);
-       return 0;
-}
-
 int
 xfs_bwrite(
        struct xfs_buf          *bp)
@@ -1178,7 +1157,20 @@ xfs_bwrite(
        bp->b_flags |= XBF_WRITE;
        bp->b_flags &= ~(XBF_ASYNC | XBF_READ | _XBF_DELWRI_Q | XBF_WRITE_FAIL);
 
-       xfs_bdstrat_cb(bp);
+       if (XFS_FORCED_SHUTDOWN(bp->b_target->bt_mount)) {
+               trace_xfs_bdstrat_shut(bp, _RET_IP_);
+
+               /*
+                * Metadata write that didn't get logged but written anyway.
+                * These aren't associated with a transaction, and can be
+                * ignored.
+                */
+               if (!bp->b_iodone)
+                       return xfs_bioerror_relse(bp);
+               return xfs_bioerror(bp);
+       }
+
+       xfs_buf_iorequest(bp);
 
        error = xfs_buf_iowait(bp);
        if (error) {
@@ -1861,7 +1853,17 @@ __xfs_buf_delwri_submit(
                        xfs_buf_hold(bp);
                else
                        list_del_init(&bp->b_list);
-               xfs_bdstrat_cb(bp);
+
+               if (XFS_FORCED_SHUTDOWN(bp->b_target->bt_mount)) {
+                       trace_xfs_bdstrat_shut(bp, _RET_IP_);
+
+                       if (!bp->b_iodone)
+                               xfs_bioerror_relse(bp);
+                       else
+                               xfs_bioerror(bp);
+                       continue;
+               }
+               xfs_buf_iorequest(bp);
        }
        blk_finish_plug(&plug);
 
-- 
2.0.0

<Prev in Thread] Current Thread [Next in Thread>