mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Linux 5.12 update: bio_max_segs() replaces BIO_MAX_PAGES
The BIO_MAX_PAGES macro is being retired in favor of a bio_max_segs()
function that implements the typical MIN(x,y) logic used throughout the
kernel for bounding the allocation, and also the new implementation is
intended to be signed-safe (which the former was not).
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Coleman Kane <ckane@colemankane.org>
Closes #11765
(cherry picked from commit ffd6978ef5)
Signed-off-by: Jonathon Fernyhough <jonathon@m2x.dev>
This commit is contained in:
committed by
Tony Hutter
parent
91d5ac85c0
commit
5722dce473
@@ -593,9 +593,14 @@ retry:
|
||||
}
|
||||
|
||||
/* bio_alloc() with __GFP_WAIT never returns NULL */
|
||||
#ifdef HAVE_BIO_MAX_SEGS
|
||||
dr->dr_bio[i] = bio_alloc(GFP_NOIO, bio_max_segs(
|
||||
abd_nr_pages_off(zio->io_abd, bio_size, abd_offset)));
|
||||
#else
|
||||
dr->dr_bio[i] = bio_alloc(GFP_NOIO,
|
||||
MIN(abd_nr_pages_off(zio->io_abd, bio_size, abd_offset),
|
||||
BIO_MAX_PAGES));
|
||||
#endif
|
||||
if (unlikely(dr->dr_bio[i] == NULL)) {
|
||||
vdev_disk_dio_free(dr);
|
||||
return (SET_ERROR(ENOMEM));
|
||||
|
||||
Reference in New Issue
Block a user