diff options
author | Coleman Kane <[email protected]> | 2021-03-20 01:33:42 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-19 22:33:42 -0700 |
commit | ffd6978ef59cfe2773e984bf03de2f0b93b03f5c (patch) | |
tree | 85e0e546513abb4f65e6e30492dea2ecd2fca79c /module | |
parent | e2a8296131e94ad785f5564156ed2db1fdb2e080 (diff) |
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 <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Coleman Kane <[email protected]>
Closes #11765
Diffstat (limited to 'module')
-rw-r--r-- | module/os/linux/zfs/vdev_disk.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/module/os/linux/zfs/vdev_disk.c b/module/os/linux/zfs/vdev_disk.c index ff71ef4cd..c56fd3a6f 100644 --- a/module/os/linux/zfs/vdev_disk.c +++ b/module/os/linux/zfs/vdev_disk.c @@ -589,9 +589,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)); |