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

Jinyoung CHOI
2023-05-03T10:01:03Z

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(-)

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;

--
2.34.1