diff mbox series

[01/15] block: bio: rename page_is_mergeable to bio_page_is_mergeable and make non-static

Message ID 20230503100049epcms2p2c830ebb7b50beaa2663abd0cd274293c@epcms2p2 (mailing list archive)
State New, archived
Headers show
Series Change the integrity configuration method in block | expand

Commit Message

Jinyoung Choi May 3, 2023, 10 a.m. UTC
page_is_meargeable() can be used to merge the page to the bio_vec of
bio's integrity payload. For this, the static was removed.

There is a page_is_mergeable() in F2FS filesystem, so the name was changed
to bio_page_is_mergeable.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Martin K. Petersen <martin.petersen@oracle.com>

Signed-off-by: Jinyoung Choi <j-young.choi@samsung.com>
---
 block/bio.c         | 8 ++++----
 include/linux/bio.h | 3 +++
 2 files changed, 7 insertions(+), 4 deletions(-)

Comments

Christoph Hellwig May 3, 2023, 3:52 p.m. UTC | #1
> +bool bio_page_is_mergeable(const struct bio_vec *bv, struct page *page,
> +			   unsigned int len, unsigned int off,
> +			   bool *same_page)

No bio involved here, just a bvec.  But I don't really see the need
to rename it, just declare it in block/blk.h where f2fs has no chance
of ever seeing it.
Jinyoung Choi May 4, 2023, 6:24 a.m. UTC | #2
>> +bool bio_page_is_mergeable(const struct bio_vec *bv, struct page *page,
>> +                           unsigned int len, unsigned int off,
>> +                           bool *same_page)
>
>No bio involved here, just a bvec.  But I don't really see the need
>to rename it, just declare it in block/blk.h where f2fs has no chance
>of ever seeing it.

Oh. You are right.
I will declare where you mentioned without changing the name.
It's better.

Best Regards,
Jinyoung
diff mbox series

Patch

diff --git a/block/bio.c b/block/bio.c
index fd11614bba4d..3e5ab59502e2 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -903,9 +903,9 @@  static inline bool bio_full(struct bio *bio, unsigned len)
 	return false;
 }
 
-static inline bool page_is_mergeable(const struct bio_vec *bv,
-		struct page *page, unsigned int len, unsigned int off,
-		bool *same_page)
+bool bio_page_is_mergeable(const struct bio_vec *bv, struct page *page,
+			   unsigned int len, unsigned int off,
+			   bool *same_page)
 {
 	size_t bv_end = bv->bv_offset + bv->bv_len;
 	phys_addr_t vec_end_addr = page_to_phys(bv->bv_page) + bv_end - 1;
@@ -951,7 +951,7 @@  static bool __bio_try_merge_page(struct bio *bio, struct page *page,
 	if (bio->bi_vcnt > 0) {
 		struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1];
 
-		if (page_is_mergeable(bv, page, len, off, same_page)) {
+		if (bio_page_is_mergeable(bv, page, len, off, same_page)) {
 			if (bio->bi_iter.bi_size > UINT_MAX - len) {
 				*same_page = false;
 				return false;
diff --git a/include/linux/bio.h b/include/linux/bio.h
index d766be7152e1..b53a595b519a 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -418,6 +418,9 @@  struct bio *bio_alloc_clone(struct block_device *bdev, struct bio *bio_src,
 		gfp_t gfp, struct bio_set *bs);
 int bio_init_clone(struct block_device *bdev, struct bio *bio,
 		struct bio *bio_src, gfp_t gfp);
+bool bio_page_is_mergeable(const struct bio_vec *bv, struct page *page,
+			   unsigned int len, unsigned int off,
+			   bool *same_page);
 
 extern struct bio_set fs_bio_set;