From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Josef Bacik <josef@toxicpanda.com>, Qu Wenruo <wqu@suse.com>,
linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 2/2] btrfs: pass disk_bytenr directly for check_data_csum()
Date: Wed, 11 Nov 2020 08:05:03 +0800 [thread overview]
Message-ID: <03ee7def-b743-249c-bbf0-3db350b1bd2e@gmx.com> (raw)
In-Reply-To: <19a1507a-2a9e-805d-3b0d-66609f07decb@toxicpanda.com>
[-- Attachment #1.1: Type: text/plain, Size: 2127 bytes --]
On 2020/11/10 下午11:30, Josef Bacik wrote:
> On 11/9/20 9:09 PM, Qu Wenruo wrote:
>> Parameter @icsum for check_data_csum() is a little hard to understand.
>> So is the @phy_offset for btrfs_verify_data_csum().
>>
>> Both parameters are calculated values for csum lookup.
>>
>> Instead of some calculated value, just pass @disk_bytenr and let the
>> final and only user, check_data_csum(), to calculate whatever it needs.
>>
>> Signed-off-by: Qu Wenruo <wqu@suse.com>
>> ---
>> fs/btrfs/extent_io.c | 14 ++++++++------
>> fs/btrfs/inode.c | 26 +++++++++++++++++---------
>> 2 files changed, 25 insertions(+), 15 deletions(-)
>>
>> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
>> index bd5a22bfee68..f8b5d3d4e5b0 100644
>> --- a/fs/btrfs/extent_io.c
>> +++ b/fs/btrfs/extent_io.c
>> @@ -2878,7 +2878,7 @@ static void end_bio_extent_readpage(struct bio
>> *bio)
>> struct btrfs_io_bio *io_bio = btrfs_io_bio(bio);
>> struct extent_io_tree *tree, *failure_tree;
>> struct processed_extent processed = { 0 };
>> - u64 offset = 0;
>> + u64 disk_bytenr = (bio->bi_iter.bi_sector << 9);
>
> This doesn't work, bi_sector can be remapped based on the underlying
> device, and thus can be different between submit and endio. To
> illustrate this point, make 2 partitions on a single device, mkfs the
> second partition, and then run xfstests with this patch applied, all
> sorts of fun will happen.
Then it still doesn't matter.
The important thing is, we only use that "disk_bytenr" to calculate the
offset against the beginning of the bio.
Thus the result is the same.
Although the new naming would be a little confusing then, it's not
really disk_bytenr used by btrfs.
In that case, if we want (and I believe we want) real disk_bytenr,
btrfs_io_bio would be the correct location to add this member.
>
> In fact we should probably add such a test to xfstests to catch anybody
> relying on bi_sector to stay the same. Thanks,
Thankfully, not for this patch.
Thanks,
Qu
>
> Josef
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2020-11-11 0:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-10 2:09 [PATCH v2 0/2] btrfs: paramater refactors for data and metadata endio call backs Qu Wenruo
2020-11-10 2:09 ` [PATCH v2 1/2] btrfs: remove the phy_offset parameter for btrfs_validate_metadata_buffer() Qu Wenruo
2020-11-10 2:09 ` [PATCH v2 2/2] btrfs: pass disk_bytenr directly for check_data_csum() Qu Wenruo
2020-11-10 15:30 ` Josef Bacik
2020-11-11 0:05 ` Qu Wenruo [this message]
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=03ee7def-b743-249c-bbf0-3db350b1bd2e@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=josef@toxicpanda.com \
--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;
as well as URLs for NNTP newsgroup(s).