Hi Greg,
> Then if userspace opens a file with O_DIRECT but the file is on a
> filesytem that can't support full O_DIRECT functionality for the
> reasons you give, the kernel could automatically fall back to
> O_DIRECT_NO_CACHE.
The solution you are proposing is definitely a good idea, but its not the mail thread is about. I am talking about the cases where filesystems _DO_ support DIRECT IO and they fail to serve IO because buffers passed are not mapped in user space process page table.
I think what needs to be done is patch get_user_pages or write a wrapper which filesystems can use something like:
get_pages_pinned
1. calls get_user_pages if buffer passed it user space buffer
2. ignore pinning for kernel buffers
I think modifying get_user_pages only should be the minimal chage as we dont have to patch individual file-systems in this case.
Thanks,
Rajat