From: Christoph Hellwig <hch@lst.de>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org,
Zygo Blaxell <ce3g8jdj@umail.furryterror.org>,
Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] btrfs: don't merge pages into bio if their page offset is not continuous
Date: Sat, 13 Aug 2022 09:39:09 +0200 [thread overview]
Message-ID: <20220813073909.GA11586@lst.de> (raw)
In-Reply-To: <8641e5e791942d86de0a1b3ee120570441616fdc.1660375698.git.wqu@suse.com>
> + if (bio_ctrl->compress_type != BTRFS_COMPRESS_NONE) {
> contig = bio->bi_iter.bi_sector == sector;
> - else
> - contig = bio_end_sector(bio) == sector;
> + } else {
I don't tink we can lose the bio_end_sector check here.
Also if you touch this, invrting the check so that it is
if (bio_ctrl->compress_type == BTRFS_COMPRESS_NONE) {
/* main version here */
} else {
/* compressed special case */
}
might make it a bit readable.
> + struct bio_vec *bvec;
> +
> + /* Empty bio, we can always add page into it. */
> + if (bio->bi_iter.bi_size == 0) {
This is also true for the compressed case, isn't it?
So maybe:
if (bio->bi_iter.bi_size == 0) {
contig = true;
} else if (bio_ctrl->compress_type == BTRFS_COMPRESS_NONE) {
struct bio_vec *bvec = bio_last_bvec_all(bio);
/*
* The contig check requires the following conditions to be met:
* 1) The pages are belonging to the same inode
* 2) The range has adjacent logical bytenr
* 3) The range has adjacent file offset (NEW)
* This is required for the usage of btrfs_bio->file_offset.
*/
contig = bio_end_sector(bio) == sector &&
page_offset(bvec->bv_page) + bvec->bv_offset +
bvec->bv_len == page_offset(page) + pg_offset);
} else {
contig = bio->bi_iter.bi_sector == sector;
}
(we don't need the mapping check, as all the submit_extent_page
always loops over the same mapping)
next prev parent reply other threads:[~2022-08-13 7:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-13 7:28 [PATCH] btrfs: don't merge pages into bio if their page offset is not continuous Qu Wenruo
2022-08-13 7:39 ` Christoph Hellwig [this message]
2022-08-13 7:43 ` Qu Wenruo
2022-08-13 7:46 ` 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=20220813073909.GA11586@lst.de \
--to=hch@lst.de \
--cc=ce3g8jdj@umail.furryterror.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@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