aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorColeman Kane <[email protected]>2021-03-20 01:33:42 -0400
committerTony Hutter <[email protected]>2021-06-23 13:22:15 -0700
commit5722dce473caf620ecaa3f16b4f3634102709bbb (patch)
treeabdcbf1559e2983b78c13b1e91523647d4372f38 /module
parent91d5ac85c0a26f1294099584c21e23284ca38d21 (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 (cherry picked from commit ffd6978ef59cfe2773e984bf03de2f0b93b03f5c) Signed-off-by: Jonathon Fernyhough <[email protected]>
Diffstat (limited to 'module')
-rw-r--r--module/os/linux/zfs/vdev_disk.c5
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 08c333134..aaaf41059 100644
--- a/module/os/linux/zfs/vdev_disk.c
+++ b/module/os/linux/zfs/vdev_disk.c
@@ -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));