What is the difference between O_DIRECT and DAX with ext4 filesystem on X86-64?

Viewed 64

I understand the O_DIRECT flag when opening a file via the system call. The file with this flag is read without buffering. There are restrictions of read offset and the number of bytes of each read opearation.

However, DAX is a parameter of the mount command, which is more relevant to the filesystem. So DAX is no system call and not equivalent to the O_DIRECT flag.

But these two topics are conceptually very similar, that the data is transferred directly without any unnecessary copying. There are some previous discussions about this confusion [1, 2]. But the answer of it is still not clear, so I would like to ask it again to eliminate this confusion.

[1]: https://community.unix.com/t/what-is-the-difference-between-o-direct-and-dax-with-ext4-filesystem/362685

[2]: https://www.kernel.org/doc/Documentation/filesystems/dax.txt

0 Answers
Related