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:
Matthew Wilcox (Oracle)
2021-01-29 04:38:57 +00:00
committed by Jens Axboe
parent 94d4bffdda
commit 5f7136db82
20 changed files with 44 additions and 52 deletions

View File

@@ -304,9 +304,7 @@ alloc_new:
goto out;
}
args->bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9),
min_t(int, args->nr_pages,
BIO_MAX_PAGES),
gfp);
bio_max_segs(args->nr_pages), gfp);
if (args->bio == NULL)
goto confused;
}