summaryrefslogtreecommitdiffstats
path: root/fs/erofs/data.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2021-01-29 04:38:57 +0000
committerJens Axboe <axboe@kernel.dk>2021-02-26 15:49:51 -0700
commit5f7136db82996089cdfb2939c7664b29e9da141d (patch)
treef6fb9ac2dafb2ca03002f6c86bc0fb1062fadcfa /fs/erofs/data.c
parent94d4bffdda21baa2c749bc229c41811a7559dd15 (diff)
downloadlinux-5f7136db82996089cdfb2939c7664b29e9da141d.tar.gz
linux-5f7136db82996089cdfb2939c7664b29e9da141d.tar.bz2
linux-5f7136db82996089cdfb2939c7664b29e9da141d.zip
block: Add bio_max_segs
It's often inconvenient to use BIO_MAX_PAGES due to min() requiring the sign to be the same. Introduce bio_max_segs() and change BIO_MAX_PAGES to be unsigned to make it easier for the users. Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/erofs/data.c')
-rw-r--r--fs/erofs/data.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/erofs/data.c b/fs/erofs/data.c
index ea4f693bee22..f88851c5c250 100644
--- a/fs/erofs/data.c
+++ b/fs/erofs/data.c
@@ -215,10 +215,8 @@ submit_bio_retry:
/* max # of continuous pages */
if (nblocks > DIV_ROUND_UP(map.m_plen, PAGE_SIZE))
nblocks = DIV_ROUND_UP(map.m_plen, PAGE_SIZE);
- if (nblocks > BIO_MAX_PAGES)
- nblocks = BIO_MAX_PAGES;
- bio = bio_alloc(GFP_NOIO, nblocks);
+ bio = bio_alloc(GFP_NOIO, bio_max_segs(nblocks));
bio->bi_end_io = erofs_readendio;
bio_set_dev(bio, sb->s_bdev);