summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_buf.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-09-01 19:55:44 +0200
committerDarrick J. Wong <darrick.wong@oracle.com>2020-09-16 05:52:38 +0200
commitf58d0ea956113f537e43517eccfa33878a30cc4e (patch)
tree25f39d47f0cdaf39b78101495346330e9b374574 /fs/xfs/xfs_buf.c
parentxfs: fold xfs_buf_ioend_finish into xfs_ioend (diff)
downloadlinux-f58d0ea956113f537e43517eccfa33878a30cc4e.tar.xz
linux-f58d0ea956113f537e43517eccfa33878a30cc4e.zip
xfs: refactor xfs_buf_ioerror_fail_without_retry
xfs_buf_ioerror_fail_without_retry is a somewhat weird function in that it has two trivial checks that decide the return value, while the rest implements a ratelimited warning. Just lift the two checks into the caller, and give the remainder a suitable name. 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>
Diffstat (limited to 'fs/xfs/xfs_buf.c')
-rw-r--r--fs/xfs/xfs_buf.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 19a49969431b..4e1adbb02737 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1170,36 +1170,19 @@ xfs_buf_wait_unpin(
set_current_state(TASK_RUNNING);
}
-/*
- * Decide if we're going to retry the write after a failure, and prepare
- * the buffer for retrying the write.
- */
-static bool
-xfs_buf_ioerror_fail_without_retry(
+static void
+xfs_buf_ioerror_alert_ratelimited(
struct xfs_buf *bp)
{
- struct xfs_mount *mp = bp->b_mount;
static unsigned long lasttime;
static struct xfs_buftarg *lasttarg;
- /*
- * If we've already decided to shutdown the filesystem because of
- * I/O errors, there's no point in giving this a retry.
- */
- if (XFS_FORCED_SHUTDOWN(mp))
- return true;
-
if (bp->b_target != lasttarg ||
time_after(jiffies, (lasttime + 5*HZ))) {
lasttime = jiffies;
xfs_buf_ioerror_alert(bp, __this_address);
}
lasttarg = bp->b_target;
-
- /* synchronous writes will have callers process the error */
- if (!(bp->b_flags & XBF_ASYNC))
- return true;
- return false;
}
static bool
@@ -1280,7 +1263,19 @@ xfs_buf_ioend_disposition(
if (likely(!bp->b_error))
return XBF_IOEND_FINISH;
- if (xfs_buf_ioerror_fail_without_retry(bp))
+ /*
+ * If we've already decided to shutdown the filesystem because of I/O
+ * errors, there's no point in giving this a retry.
+ */
+ if (XFS_FORCED_SHUTDOWN(mp))
+ goto out_stale;
+
+ xfs_buf_ioerror_alert_ratelimited(bp);
+
+ /*
+ * Synchronous writes will have callers process the error.
+ */
+ if (!(bp->b_flags & XBF_ASYNC))
goto out_stale;
trace_xfs_buf_iodone_async(bp, _RET_IP_);