Commit f58d0ea9 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent 6a7584b1
...@@ -1170,36 +1170,19 @@ xfs_buf_wait_unpin( ...@@ -1170,36 +1170,19 @@ xfs_buf_wait_unpin(
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
} }
/* static void
* Decide if we're going to retry the write after a failure, and prepare xfs_buf_ioerror_alert_ratelimited(
* the buffer for retrying the write.
*/
static bool
xfs_buf_ioerror_fail_without_retry(
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
struct xfs_mount *mp = bp->b_mount;
static unsigned long lasttime; static unsigned long lasttime;
static struct xfs_buftarg *lasttarg; 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 || if (bp->b_target != lasttarg ||
time_after(jiffies, (lasttime + 5*HZ))) { time_after(jiffies, (lasttime + 5*HZ))) {
lasttime = jiffies; lasttime = jiffies;
xfs_buf_ioerror_alert(bp, __this_address); xfs_buf_ioerror_alert(bp, __this_address);
} }
lasttarg = bp->b_target; lasttarg = bp->b_target;
/* synchronous writes will have callers process the error */
if (!(bp->b_flags & XBF_ASYNC))
return true;
return false;
} }
static bool static bool
...@@ -1280,7 +1263,19 @@ xfs_buf_ioend_disposition( ...@@ -1280,7 +1263,19 @@ xfs_buf_ioend_disposition(
if (likely(!bp->b_error)) if (likely(!bp->b_error))
return XBF_IOEND_FINISH; 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; goto out_stale;
trace_xfs_buf_iodone_async(bp, _RET_IP_); trace_xfs_buf_iodone_async(bp, _RET_IP_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment