Re: [PATCH 08/24] xfs: fold xfs_istale_done into xfs_iflush_done

Christoph Hellwig
2020-05-23T09:12:55Z

On Fri, May 22, 2020 at 01:50:13PM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> Having different io completion callbacks for different inode states
> makes things complex. We can detect if the inode is stale via the
> XFS_ISTALE flag in IO completion, so we don't need a special
> callback just for this.
>
> This means inodes only have a single iodone callback, and inode IO
> completion is entirely buffer centric at this point. Hence we no
> longer need to use a log item callback at all as we can just call
> xfs_iflush_done() directly from the buffer completions and walk the
> buffer log item list to complete the all inodes under IO.

I find the subject a bit confuing. Yes, this merges xfs_istale_done into
xfs_iflush_done, but that ѕeems to be a side effect of the other
changes.

The main change is that the inode I/O completion is run directly
instead of through b_iodone and li_cb. Maybe pick a subject that
better reflects this?

Otherwise this looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

One minor nitpick below:

> -static void
> -xfs_buf_run_callbacks(
> +static inline bool
> +xfs_buf_had_callback_errors(
> struct xfs_buf *bp)
> {
>
> @@ -1152,7 +1155,7 @@ xfs_buf_run_callbacks(
> * appropriate action.
> */
> if (bp->b_error && xfs_buf_iodone_callback_error(bp))
> - return;
> + return true;
>
> /*
> * Successful IO or permanent error. Either way, we can clear the
> @@ -1161,7 +1164,16 @@ xfs_buf_run_callbacks(
> bp->b_last_error = 0;
> bp->b_retries = 0;
> bp->b_first_retry_time = 0;
> + return false;
> +}
>
> +static void
> +xfs_buf_run_callbacks(
> + struct xfs_buf *bp)
> +{
> +
> + if (xfs_buf_had_callback_errors(bp))
> + return;
> xfs_buf_do_callbacks(bp);
> bp->b_log_item = NULL;
> }

Maybe its worth splitting this refactoring into a separate prep patch?