我想知道一个特定的块设备是否声称需要缓存刷新。
来自xfs常见问题 (重点雷):
是否应该使用具有持久写缓存的存储启用障碍?许多硬件攻击都有一个持久的写缓存,在电源故障、接口重置、系统崩溃等情况下都会被保存下来。这类硬件应该向操作系统报告不需要刷新,在这种情况下,即使没有“无障碍”选项,也不会发出障碍。引用xfs列表中Christoph Hellwig的话,如果设备不需要缓存刷新,则不应该报告需要刷新,在这种情况下,无屏障将是noop。或者换个说法:如果没有障碍,跳过它是不安全的。在具有适当报告写缓存行为的硬件的现代内核上,不需要在挂载时更改屏障选项。
我知道我的设备不需要缓存刷新,但我想检查它是否正确地向内核报告了这一点。
如何才能确定特定的块设备是否报告需要缓存刷新?我在/sys上找到了这个:
root@diamond:/# cat /sys/block/sdb/device/scsi_disk/0\:0\:1\:0/cache_type
write through但我不知道在这种情况下这意味着什么。
版本:
发布于 2016-07-07 21:22:56
是的,文件/sys/block/xxx/queue/ cache _type文件的内容是如何判断设备是否需要缓存刷新的。来自Linux内核源代码中的文档/块/队列-sysfs.txt:
write_cache (RW)
----------------
When read, this file will display whether the device has write back
caching enabled or not. It will return "write back" for
the former case, and "write through" for the latter. Writing to this
file can change the kernels view of the device, but it doesn't alter
the device state. This means that it might not be safe to toggle the
setting from "write back" to "write through", since that will also
eliminate cache flushes issued by the kernel.https://unix.stackexchange.com/questions/294522
复制相似问题