linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH 2/2] iomap: simplify iomap_add_to_ioend
Date: Thu, 22 Jul 2021 12:35:35 -0700	[thread overview]
Message-ID: <20210722193535.GN559212@magnolia> (raw)
In-Reply-To: <20210722054256.932965-3-hch@lst.de>

On Thu, Jul 22, 2021 at 07:42:56AM +0200, Christoph Hellwig wrote:
> Now that the outstanding writes are counted in bytes, there is no need
> to use the low-level __bio_try_merge_page API, we can switch back to
> always using bio_add_page and simply iomap_add_to_ioend again.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Pretty straightforward.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/iomap/buffered-io.c | 17 +++++------------
>  1 file changed, 5 insertions(+), 12 deletions(-)
> 
> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
> index 7898c1c47370e6..d31e0d3b50c683 100644
> --- a/fs/iomap/buffered-io.c
> +++ b/fs/iomap/buffered-io.c
> @@ -1252,7 +1252,6 @@ iomap_add_to_ioend(struct inode *inode, loff_t offset, struct page *page,
>  	sector_t sector = iomap_sector(&wpc->iomap, offset);
>  	unsigned len = i_blocksize(inode);
>  	unsigned poff = offset & (PAGE_SIZE - 1);
> -	bool merged, same_page = false;
>  
>  	if (!wpc->ioend || !iomap_can_add_to_ioend(wpc, offset, sector)) {
>  		if (wpc->ioend)
> @@ -1260,19 +1259,13 @@ iomap_add_to_ioend(struct inode *inode, loff_t offset, struct page *page,
>  		wpc->ioend = iomap_alloc_ioend(inode, wpc, offset, sector, wbc);
>  	}
>  
> -	merged = __bio_try_merge_page(wpc->ioend->io_bio, page, len, poff,
> -			&same_page);
> -	if (iop)
> -		atomic_add(len, &iop->write_bytes_pending);
> -
> -	if (!merged) {
> -		if (bio_full(wpc->ioend->io_bio, len)) {
> -			wpc->ioend->io_bio =
> -				iomap_chain_bio(wpc->ioend->io_bio);
> -		}
> -		bio_add_page(wpc->ioend->io_bio, page, len, poff);
> +	if (bio_add_page(wpc->ioend->io_bio, page, len, poff) != len) {
> +		wpc->ioend->io_bio = iomap_chain_bio(wpc->ioend->io_bio);
> +		__bio_add_page(wpc->ioend->io_bio, page, len, poff);
>  	}
>  
> +	if (iop)
> +		atomic_add(len, &iop->write_bytes_pending);
>  	wpc->ioend->io_size += len;
>  	wbc_account_cgroup_owner(wbc, page, len);
>  }
> -- 
> 2.30.2
> 

  reply	other threads:[~2021-07-22 19:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22  5:42 cleanup the bio handling in iomap v2 Christoph Hellwig
2021-07-22  5:42 ` [PATCH 1/2] iomap: simplify iomap_readpage_actor Christoph Hellwig
2021-07-22 19:34   ` Darrick J. Wong
2021-07-22  5:42 ` [PATCH 2/2] iomap: simplify iomap_add_to_ioend Christoph Hellwig
2021-07-22 19:35   ` Darrick J. Wong [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-07-20  8:43 [PATCH 1/2] iomap: simplify iomap_readpage_actor Christoph Hellwig
2021-07-20  8:43 ` [PATCH 2/2] iomap: simplify iomap_add_to_ioend Christoph Hellwig
2021-07-20 12:10   ` Matthew Wilcox
2021-07-20 12:16     ` Christoph Hellwig

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=20210722193535.GN559212@magnolia \
    --to=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=willy@infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).