Re: [PATCH 04/24] xfs: mark dquot buffers in cache

Amir Goldstein
2020-05-22T07:46:38Z

On Fri, May 22, 2020 at 6:51 AM Dave Chinner <david@fromorbit.com> wrote:
>
> dquot buffers always have write IO callbacks, so by marking them
> directly we can avoid needing to attach ->b_iodone functions to
> them. This avoids an indirect call, and makes future modifications
> much simpler.
>
> This is largely a rearrangement of the code at this point - no IO
> completion functionality changes at this point, just how the
> code is run is modified.
>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/xfs_buf.c | 12 +++++++++++-
> fs/xfs/xfs_buf.h | 2 ++
> fs/xfs/xfs_buf_item.c | 10 ++++++++++
> fs/xfs/xfs_buf_item.h | 1 +
> fs/xfs/xfs_dquot.c | 1 +
> fs/xfs/xfs_trans_buf.c | 1 +
> 6 files changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index 6105b97028d6a..77d40eb4a11db 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -1204,17 +1204,27 @@ xfs_buf_ioend(
> bp->b_flags |= XBF_DONE;
> }
>
> + if (read)
> + goto out_finish;
> +
> /* inodes always have a callback on write */
> - if (!read && (bp->b_flags & _XBF_INODES)) {
> + if (bp->b_flags & _XBF_INODES) {
> xfs_buf_inode_iodone(bp);
> return;
> }
>
> + /* dquots always have a callback on write */
> + if (bp->b_flags & _XBF_DQUOTS) {
> + xfs_buf_dquot_iodone(bp);
> + return;
> + }
> +

As commented on another patch, this would look better as
a switch statement.

For not changing logic by rearranging code:

Reviewed-by: Amir Goldstein <amir73il@gmail.com>

Thanks,
Amir.