“Cache flush bypassed!” from fio

fio is a effective tool to test IO-performance of a block device (also file system).

Today, my colleague tell me fio has report “Cache flush bypassed!” which means all IO have bypass the device cache. But I can’t agree because the cache of a RAID card usually could only be change by specific tool (such as MegaCLi), but not a test tool.

By review the code of fio:

and the implementation for blockdev_invalidate_cache() is:

Therefore, the “Cache flush bypassed!” is not mean all IO will bypass the buffer of device, but actually means: “fio can’t flush the cache of device, so let’s ignore it”.
If you want to disable the DRAM cache on the RAID card, the correct way is set cache policy of RAID card to “Write Through”: