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>
This commit is contained in:
committed by
Jens Axboe
parent
94d4bffdda
commit
5f7136db82
@@ -341,8 +341,8 @@ static void do_region(int op, int op_flags, unsigned region,
|
||||
num_bvecs = 1;
|
||||
break;
|
||||
default:
|
||||
num_bvecs = min_t(int, BIO_MAX_PAGES,
|
||||
dm_sector_div_up(remaining, (PAGE_SIZE >> SECTOR_SHIFT)));
|
||||
num_bvecs = bio_max_segs(dm_sector_div_up(remaining,
|
||||
(PAGE_SIZE >> SECTOR_SHIFT)));
|
||||
}
|
||||
|
||||
bio = bio_alloc_bioset(GFP_NOIO, num_bvecs, &io->client->bios);
|
||||
|
||||
Reference in New Issue
Block a user