diff mbox series

[6/8] block: downgrade a bio_full call in bio_add_page

Message ID 20230512133901.1053543-7-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/8] block: tidy up the bio full checks in bio_add_hw_page | expand

Commit Message

Christoph Hellwig May 12, 2023, 1:38 p.m. UTC
bio_add_page already checks that there is space in bi_size a little
earlier.  So after we failed to add to an existing segment, just check
that there is another one available instead of duplicating the bi_size
check.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/bio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jinyoung Choi May 19, 2023, 6:18 a.m. UTC | #1
Looks good to me,

Reviewed-by: Jinyoung Choi <j-young.choi@samsung.com>
diff mbox series

Patch

diff --git a/block/bio.c b/block/bio.c
index 93e6bca3c2239f..89b1475de0c370 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1126,7 +1126,7 @@  int bio_add_page(struct bio *bio, struct page *page,
 	    __bio_try_merge_page(bio, page, len, offset, &same_page))
 		return len;
 
-	if (bio_full(bio, len))
+	if (bio->bi_vcnt >= bio->bi_max_vecs)
 		return 0;
 	__bio_add_page(bio, page, len, offset);
 	return len;