I want to know if a particular block device claims to requires cache flushes.
From the xfs faq (emphasis mine):
Q. Should barriers be enabled with storage which has a persistent write cache?
Many hardware RAIDs have a persistent write cache which is preserved across power failure, interface resets, system crashes, etc. The same may be true of some SSD devices. This sort of hardware should report to the operating system that no flushes are required, and in that case barriers will not be issued, even without the "nobarrier" option. Quoting Christoph Hellwig on the xfs list,
If the device does not need cache flushes it should not report requiring flushes, in which case nobarrier will be a noop. Or to phrase it differently: If nobarrier makes a difference skipping it is not safe.
On modern kernels with hardware which properly reports write cache behavior, there is no need to change barrier options at mount time.
I know that my device does not need cache flushes, but I want to check that it is properly reporting that to the kernel.
How can I find out whether a particular block device reports that it needs cache flushes? I found this in /sys:
root@diamond:/# cat /sys/block/sdb/device/scsi_disk/0\:0\:1\:0/cache_type
write through
But I don't know what that means in this context.
Versions:
- Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2 (2016-04-08) x86_64 GNU/Linux