From: Coly Li <colyli@suse.de>
To: Christoph Hellwig <hch@lst.de>
Cc: axboe@kernel.dk, linux-bcache@vger.kernel.org,
linux-block@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] bcache: Revert "bcache: use bvec_virt"
Date: Thu, 4 Nov 2021 00:11:45 +0800 [thread overview]
Message-ID: <1d1180e0-32bc-e571-3252-ce496508d2b5@suse.de> (raw)
In-Reply-To: <20211103154644.GA30686@lst.de>
On 11/3/21 11:46 PM, Christoph Hellwig wrote:
> On Wed, Nov 03, 2021 at 11:10:41PM +0800, Coly Li wrote:
>> diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
>> index 93b67b8d31c3..88c573eeb598 100644
>> --- a/drivers/md/bcache/btree.c
>> +++ b/drivers/md/bcache/btree.c
>> @@ -378,7 +378,7 @@ static void do_btree_node_write(struct btree *b)
>> struct bvec_iter_all iter_all;
>>
>> bio_for_each_segment_all(bv, b->bio, iter_all) {
>> - memcpy(bvec_virt(bv), addr, PAGE_SIZE);
>> + memcpy(page_address(bv->bv_page), addr, PAGE_SIZE);
> How could there be an offset? bch_bio_alloc_pages allocates a
> fresh page for each vec, and bio_for_each_segment_all iterates page
> by page. IFF there is an offset there is proble in the surrounding
> code as bch_bio_alloc_pages assumes that it is called on a freshly
> allocate and initialized bio.
Yes, the offset is modified in bch_bio_alloc_pages(). Normally the
bcache defined block size is 4KB so the issue was not triggered
frequently. I found it during testing my nvdimm enabling code for
bcache, where I happen to make the bcache defined block size to non-4KB.
The offset is from the previous written bkey set, which the minimized
unit size is 1 bcache-defined-block-size.
Coly Li
next prev parent reply other threads:[~2021-11-03 16:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-03 15:10 [PATCH] bcache: Revert "bcache: use bvec_virt" Coly Li
2021-11-03 15:46 ` Christoph Hellwig
2021-11-03 16:11 ` Coly Li [this message]
2021-11-03 16:19 ` Christoph Hellwig
2021-11-04 4:25 ` Coly Li
2021-11-04 20:23 ` Christoph Hellwig
2021-11-06 13:36 ` Coly Li
2021-11-08 8:16 ` Coly Li
2021-11-09 8:03 ` Christoph Hellwig
2021-11-08 13:23 ` Jens Axboe
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=1d1180e0-32bc-e571-3252-ce496508d2b5@suse.de \
--to=colyli@suse.de \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=stable@vger.kernel.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