Skip to content

Commit

Permalink
linux/zvol_os.c: Fix max_discard_sectors limit for 6.8+ kernel
Browse files Browse the repository at this point in the history
In the 6.8+ kernel, the zvol block device is allocated with qlimits
passed during initialization. However, the zvol driver does not set
`max_hw_discard_sectors`, which is required for properly initializing
`max_discard_sectors`. As a result, the `zvol_misc_trim` test fails on
the 6.8+ kernel when invoking the `blkdiscard` command. To maintain
compatibility, the `blk_queue_max_discard_sectors` function is now used
to set the discard sectors limits.

Signed-off-by: Ameer Hamza <[email protected]>
  • Loading branch information
ixhamza committed Aug 20, 2024
1 parent 816d2b2 commit 930f77a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions module/os/linux/zfs/zvol_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,8 @@ zvol_alloc_non_blk_mq(struct zvol_state_os *zso, zvol_queue_limits_t *limits)
zso->zvo_queue = zso->zvo_disk->queue;

#ifndef HAVE_BLKDEV_QUEUE_LIMITS_FEATURES
blk_queue_max_discard_sectors(zso->zvo_queue,
limits->zql_max_discard_sectors);
blk_queue_set_write_cache(zso->zvo_queue, B_TRUE);
#endif

Expand Down

0 comments on commit 930f77a

Please sign in to comment.