The right way to do it is to just not use O_DIRECT. The whole notion of "direct IO" is totally braindamaged. Just say no. This is your brain: O This is your brain on O_DIRECT: . Any questions? Our measurements show that the page cache dramatically increases latency. At the speeds of flash storage, the page cache is disastrous. Linus agreed substantially in his own post: Side note: the only reason
![Switch your databases to Flash storage. Now. Or you're doing it wrong. - High Scalability -](https://cdn-ak-scissors.b.st-hatena.com/image/square/1d45b9ea6ae3ca1cdb3820c06d34417b3316649c/height=288;version=1;width=512/http%3A%2F%2Ffarm9.staticflickr.com%2F8319%2F7952195310_8078e8c9df_m.jpg)