mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
vdev_disk: disable flushes if device does not support it
If the underlying device doesn't have a write-back cache, the kernel will just return a successful response. This doesn't hurt anything, but it's extra work on the IO taskqs that are unnecessary. So, detect this when we open the device for the first time. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes #16148
This commit is contained in:
@@ -429,8 +429,11 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,
|
||||
/* Determine the logical block size */
|
||||
int logical_block_size = bdev_logical_block_size(bdev);
|
||||
|
||||
/* Clear the nowritecache bit, causes vdev_reopen() to try again. */
|
||||
v->vdev_nowritecache = B_FALSE;
|
||||
/*
|
||||
* If the device has a write cache, clear the nowritecache flag,
|
||||
* so that we start issuing flush requests again.
|
||||
*/
|
||||
v->vdev_nowritecache = !zfs_bdev_has_write_cache(bdev);
|
||||
|
||||
/* Set when device reports it supports TRIM. */
|
||||
v->vdev_has_trim = bdev_discard_supported(bdev);
|
||||
|
||||
Reference in New Issue
Block a user