linux/zvol_os.c: Fix max_discard_sectors limit for 6.8+ kernel
commit8e6a9aabb1e4038b1893d5eba5ebc2318988bd9c
authorAmeer Hamza <ahamza@ixsystems.com>
Mon, 19 Aug 2024 20:30:57 +0000 (20 01:30 +0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 21 Aug 2024 00:14:44 +0000 (20 17:14 -0700)
tree4ec5132b1f044fdcbaa2fe192c38c81e869c95ac
parent816d2b2bfc2591b951f32aeb7c00e14e27ee624c
linux/zvol_os.c: Fix max_discard_sectors limit for 6.8+ kernel

In kernels 6.8 and later, the zvol block device is allocated with
qlimits passed during initialization. However, the zvol driver does not
set `max_hw_discard_sectors`, which is necessary to properly
initialize `max_discard_sectors`. This causes the `zvol_misc_trim` test
to fail on 6.8+ kernels when invoking the `blkdiscard` command. Setting
`max_hw_discard_sectors` in the `HAVE_BLK_ALLOC_DISK_2ARG` case resolve
the issue.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Rob Norris <robn@despairlabs.com>
Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
Closes #16462
module/os/linux/zfs/zvol_os.c