linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: fix mismerge in bvec_advance
@ 2019-05-07  6:53 Christoph Hellwig
  2019-05-07 14:39 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2019-05-07  6:53 UTC (permalink / raw)
  To: axboe; +Cc: ming.lei, linux-block

When Jens merged my commit to only allow contiguous page structs in a
bio_vec with Ming's 5.1 fix to ensue the bvec length didn't overflow
we failed to keep the removal of the expensive nth_page calls.  This
commits adds them back as intended.

Fixes: 5c61ee2cd586 ("Merge tag 'v5.1-rc6' into for-5.2/block")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/bvec.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index 545a480528e0..a032f01e928c 100644
--- a/include/linux/bvec.h
+++ b/include/linux/bvec.h
@@ -133,11 +133,6 @@ static inline struct bio_vec *bvec_init_iter_all(struct bvec_iter_all *iter_all)
 	return &iter_all->bv;
 }
 
-static inline struct page *bvec_nth_page(struct page *page, int idx)
-{
-	return idx == 0 ? page : nth_page(page, idx);
-}
-
 static inline void bvec_advance(const struct bio_vec *bvec,
 				struct bvec_iter_all *iter_all)
 {
@@ -147,8 +142,7 @@ static inline void bvec_advance(const struct bio_vec *bvec,
 		bv->bv_page++;
 		bv->bv_offset = 0;
 	} else {
-		bv->bv_page = bvec_nth_page(bvec->bv_page, bvec->bv_offset /
-					    PAGE_SIZE);
+		bv->bv_page = bvec->bv_page + (bvec->bv_offset >> PAGE_SHIFT);
 		bv->bv_offset = bvec->bv_offset & ~PAGE_MASK;
 	}
 	bv->bv_len = min_t(unsigned int, PAGE_SIZE - bv->bv_offset,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] block: fix mismerge in bvec_advance
  2019-05-07  6:53 [PATCH] block: fix mismerge in bvec_advance Christoph Hellwig
@ 2019-05-07 14:39 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2019-05-07 14:39 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: ming.lei, linux-block

On 5/7/19 12:53 AM, Christoph Hellwig wrote:
> When Jens merged my commit to only allow contiguous page structs in a
> bio_vec with Ming's 5.1 fix to ensue the bvec length didn't overflow
> we failed to keep the removal of the expensive nth_page calls.  This
> commits adds them back as intended.

Thanks applied, that's my mistake.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-07 14:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-07  6:53 [PATCH] block: fix mismerge in bvec_advance Christoph Hellwig
2019-05-07 14:39 ` 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).