public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Nikolay Borisov <nborisov@suse.com>
Cc: linux-xfs@vger.kernel.org, darrick.wong@oracle.com
Subject: Re: [PATCH 1/3] xfs: Use __xfs_buf_submit everywhere
Date: Tue, 13 Aug 2019 07:55:44 -0400	[thread overview]
Message-ID: <20190813115544.GA37069@bfoster> (raw)
In-Reply-To: <20190813090306.31278-2-nborisov@suse.com>

On Tue, Aug 13, 2019 at 12:03:04PM +0300, Nikolay Borisov wrote:
> Currently xfs_buf_submit is used as a tiny wrapper to __xfs_buf_submit.
> It only checks whether XFB_ASYNC flag is set and sets the second
> parameter to __xfs_buf_submit accordingly. It's possible to remove the
> level of indirection since in all contexts where xfs_buf_submit is
> called we already know if XBF_ASYNC is set or not.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---

Random nit: the use of upper case in the first word of the commit log
subject line kind of stands out to me. I know there are other instances
of this (I think I noticed one the other day), but my presumption was
that it was random/accidental where your patches seem to do it
intentionally. Do we have a common practice here? Do we care? I prefer
consistency of using lower case for normal text, but it's really just a
nit.

>  fs/xfs/xfs_buf.c         | 8 +++++---
>  fs/xfs/xfs_buf_item.c    | 2 +-
>  fs/xfs/xfs_log_recover.c | 2 +-
>  3 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index ca0849043f54..a75d05e49a98 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -751,13 +751,15 @@ _xfs_buf_read(
>  	xfs_buf_t		*bp,
>  	xfs_buf_flags_t		flags)
>  {
> +	bool wait = bp->b_flags & XBF_ASYNC ? false : true;
> +

This doesn't look quite right. Just below we clear several flags from
->b_flags then potentially reapply based on the flags parameter. Hence,
I think ->b_flags above may not reflect ->b_flags by the time we call
__xfs_buf_submit().

Brian

>  	ASSERT(!(flags & XBF_WRITE));
>  	ASSERT(bp->b_maps[0].bm_bn != XFS_BUF_DADDR_NULL);
>  
>  	bp->b_flags &= ~(XBF_WRITE | XBF_ASYNC | XBF_READ_AHEAD);
>  	bp->b_flags |= flags & (XBF_READ | XBF_ASYNC | XBF_READ_AHEAD);
>  
> -	return xfs_buf_submit(bp);
> +	return __xfs_buf_submit(bp, wait);
>  }
>  
>  /*
> @@ -883,7 +885,7 @@ xfs_buf_read_uncached(
>  	bp->b_flags |= XBF_READ;
>  	bp->b_ops = ops;
>  
> -	xfs_buf_submit(bp);
> +	__xfs_buf_submit(bp, true);
>  	if (bp->b_error) {
>  		int	error = bp->b_error;
>  		xfs_buf_relse(bp);
> @@ -1214,7 +1216,7 @@ xfs_bwrite(
>  	bp->b_flags &= ~(XBF_ASYNC | XBF_READ | _XBF_DELWRI_Q |
>  			 XBF_WRITE_FAIL | XBF_DONE);
>  
> -	error = xfs_buf_submit(bp);
> +	error = __xfs_buf_submit(bp, true);
>  	if (error)
>  		xfs_force_shutdown(bp->b_mount, SHUTDOWN_META_IO_ERROR);
>  	return error;
> diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
> index 7dcaec54a20b..fef08980dd21 100644
> --- a/fs/xfs/xfs_buf_item.c
> +++ b/fs/xfs/xfs_buf_item.c
> @@ -1123,7 +1123,7 @@ xfs_buf_iodone_callback_error(
>  			bp->b_first_retry_time = jiffies;
>  
>  		xfs_buf_ioerror(bp, 0);
> -		xfs_buf_submit(bp);
> +		__xfs_buf_submit(bp, false);
>  		return true;
>  	}
>  
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index 13d1d3e95b88..64e315f80147 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -5610,7 +5610,7 @@ xlog_do_recover(
>  	bp->b_flags |= XBF_READ;
>  	bp->b_ops = &xfs_sb_buf_ops;
>  
> -	error = xfs_buf_submit(bp);
> +	error = __xfs_buf_submit(bp, true);
>  	if (error) {
>  		if (!XFS_FORCED_SHUTDOWN(mp)) {
>  			xfs_buf_ioerror_alert(bp, __func__);
> -- 
> 2.17.1
> 

  reply	other threads:[~2019-08-13 11:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-13  9:03 [PATCH 0/3] Minor cleanups Nikolay Borisov
2019-08-13  9:03 ` [PATCH 1/3] xfs: Use __xfs_buf_submit everywhere Nikolay Borisov
2019-08-13 11:55   ` Brian Foster [this message]
2019-08-13 12:06     ` Nikolay Borisov
2019-08-13 12:15       ` Nikolay Borisov
2019-08-13  9:03 ` [PATCH 2/3] xfs: Rename __xfs_buf_submit to xfs_buf_submit Nikolay Borisov
2019-08-13 11:56   ` Brian Foster
2019-08-14 10:14     ` Dave Chinner
2019-08-13  9:03 ` [PATCH 3/3] xfs: Opencode and remove DEFINE_SINGLE_BUF_MAP Nikolay Borisov
2019-08-13 11:57   ` Brian Foster
2019-08-14 10:23   ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190813115544.GA37069@bfoster \
    --to=bfoster@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox