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.
Description
When opening the device, check its "has a write cache" flag, and set the vdev_nowritecache from it. On older kernels, we just assume a write cache to start, as we always have.
How Has This Been Tested?
Full test suite run against 6.1.76 passed, not that it really exercises any of this. Some by-hand testing with loop devices changing /sys/block/loopX/queue/write_cache seems to show vdev_nowritecache being initialised properly. I'd apprecate a test from someone with actual devices with no write cache.
Types of changes
[ ] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[x] Performance enhancement (non-breaking change which improves efficiency)
[ ] Code cleanup (non-breaking change which makes code smaller or more readable)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
[ ] Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
[ ] Documentation (a change to man pages or other documentation)
Motivation and Context
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.
Description
When opening the device, check its "has a write cache" flag, and set the
vdev_nowritecache
from it. On older kernels, we just assume a write cache to start, as we always have.How Has This Been Tested?
Full test suite run against 6.1.76 passed, not that it really exercises any of this. Some by-hand testing with loop devices changing
/sys/block/loopX/queue/write_cache
seems to showvdev_nowritecache
being initialised properly. I'd apprecate a test from someone with actual devices with no write cache.Types of changes
Checklist:
Signed-off-by
.