* [PATCH] block: take destination bvec offsets into account in bio_copy_data_iter
@ 2022-05-24 14:39 Christoph Hellwig
2022-05-28 2:36 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2022-05-24 14:39 UTC (permalink / raw)
To: axboe; +Cc: linux-block
Appartly bcache can copy into bios that do not just contain fresh
pages but can have offsets into the bio_vecs. Restore support for tht
in bio_copy_data_iter.
Fixes: 8b679a070c53 ("block: rewrite bio_copy_data_iter to use bvec_kmap_local and memcpy_to_bvec")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/bio.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/block/bio.c b/block/bio.c
index a3893d80dccc9..8a1b3d650a7f7 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1366,10 +1366,12 @@ void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter,
struct bio_vec src_bv = bio_iter_iovec(src, *src_iter);
struct bio_vec dst_bv = bio_iter_iovec(dst, *dst_iter);
unsigned int bytes = min(src_bv.bv_len, dst_bv.bv_len);
- void *src_buf;
+ void *src_buf = bvec_kmap_local(&src_bv);
+ void *dst_buf = bvec_kmap_local(&dst_bv);
- src_buf = bvec_kmap_local(&src_bv);
- memcpy_to_bvec(&dst_bv, src_buf);
+ memcpy(dst_buf, src_buf, bytes);
+
+ kunmap_local(dst_buf);
kunmap_local(src_buf);
bio_advance_iter_single(src, src_iter, bytes);
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] block: take destination bvec offsets into account in bio_copy_data_iter
2022-05-24 14:39 [PATCH] block: take destination bvec offsets into account in bio_copy_data_iter Christoph Hellwig
@ 2022-05-28 2:36 ` Jens Axboe
2022-05-28 4:52 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2022-05-28 2:36 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-block
On 5/24/22 8:39 AM, Christoph Hellwig wrote:
> Appartly bcache can copy into bios that do not just contain fresh
> pages but can have offsets into the bio_vecs. Restore support for tht
> in bio_copy_data_iter.
>
> Fixes: 8b679a070c53 ("block: rewrite bio_copy_data_iter to use bvec_kmap_local and memcpy_to_bvec")
Applied, but where is this sha from? The upstream one is f8b679a070c5.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] block: take destination bvec offsets into account in bio_copy_data_iter
2022-05-28 2:36 ` Jens Axboe
@ 2022-05-28 4:52 ` Christoph Hellwig
2022-05-28 12:24 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2022-05-28 4:52 UTC (permalink / raw)
To: Jens Axboe; +Cc: Christoph Hellwig, linux-block
On Fri, May 27, 2022 at 08:36:47PM -0600, Jens Axboe wrote:
> On 5/24/22 8:39 AM, Christoph Hellwig wrote:
> > Appartly bcache can copy into bios that do not just contain fresh
> > pages but can have offsets into the bio_vecs. Restore support for tht
> > in bio_copy_data_iter.
> >
> > Fixes: 8b679a070c53 ("block: rewrite bio_copy_data_iter to use bvec_kmap_local and memcpy_to_bvec")
>
> Applied, but where is this sha from? The upstream one is f8b679a070c5.
Apparently from my copy and pasting discarding the initial f of that..
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] block: take destination bvec offsets into account in bio_copy_data_iter
2022-05-28 4:52 ` Christoph Hellwig
@ 2022-05-28 12:24 ` Jens Axboe
0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2022-05-28 12:24 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-block
On 5/27/22 10:52 PM, Christoph Hellwig wrote:
> On Fri, May 27, 2022 at 08:36:47PM -0600, Jens Axboe wrote:
>> On 5/24/22 8:39 AM, Christoph Hellwig wrote:
>>> Appartly bcache can copy into bios that do not just contain fresh
>>> pages but can have offsets into the bio_vecs. Restore support for tht
>>> in bio_copy_data_iter.
>>>
>>> Fixes: 8b679a070c53 ("block: rewrite bio_copy_data_iter to use bvec_kmap_local and memcpy_to_bvec")
>>
>> Applied, but where is this sha from? The upstream one is f8b679a070c5.
>
> Apparently from my copy and pasting discarding the initial f of that..
Heh, my tired eyes missed that, makes sense. Anyway, I did correct it
when applying.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-28 12:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-24 14:39 [PATCH] block: take destination bvec offsets into account in bio_copy_data_iter Christoph Hellwig
2022-05-28 2:36 ` Jens Axboe
2022-05-28 4:52 ` Christoph Hellwig
2022-05-28 12:24 ` Jens Axboe
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).