mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Linux 5.19 compat: bdev_max_discard_sectors()
Linux 5.19 commit torvalds/linux@70200574cc removed the blk_queue_discard() helper function. The preferred interface is to now use the bdev_max_discard_sectors() function to check for discard support. Reviewed-by: Tony Hutter <hutter2@llnl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #13515
This commit is contained in:
@@ -494,6 +494,25 @@ blk_queue_discard_granularity(struct request_queue *q, unsigned int dg)
|
||||
q->limits.discard_granularity = dg;
|
||||
}
|
||||
|
||||
/*
|
||||
* 5.19 API,
|
||||
* bdev_max_discard_sectors()
|
||||
*
|
||||
* 2.6.32 API,
|
||||
* blk_queue_discard()
|
||||
*/
|
||||
static inline boolean_t
|
||||
bdev_discard_supported(struct block_device *bdev)
|
||||
{
|
||||
#if defined(HAVE_BDEV_MAX_DISCARD_SECTORS)
|
||||
return (!!bdev_max_discard_sectors(bdev));
|
||||
#elif defined(HAVE_BLK_QUEUE_DISCARD)
|
||||
return (!!blk_queue_discard(bdev_get_queue(bdev)));
|
||||
#else
|
||||
#error "Unsupported kernel"
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* 4.8 API,
|
||||
* blk_queue_secure_erase()
|
||||
|
||||
Reference in New Issue
Block a user