According to the Linux docs, it's bad to do mmap on a file that's been configured with O_DIRECT, and I put in a change a day or so ago to avoid that combination, if O_DIRECT is configured on a file, we don't mmap it.
Just to be sure, it seems like LSM merge files should ignore the connection's direct_io configuration option?
I agree, but I don't think we have any way to figure that out at the moment.
In the case of LSM, things are simple because files are never being written at the same time as they are being merged (though there are application cursor reads concurrent with a merge scan).
We need to pass something in from the LSM code to tell the lower layers when a cursor is opened for a merge. The same flag could turn on readahead, which should be a lot faster than page-at-a-time.