![]() | |||||||||||
Messages in this thread |
On Wed, 04 Oct 2006 16:53:53 -0400 Jeff Moyer <jmoyer@redhat.com> wrote: > The man page for open states: > > O_DIRECT > Try to minimize cache effects of the I/O to and from this file. > > I think that invalidating the page cache pages we use when falling back to > buffered I/O stays true to the above description. What the manpage forgot to mention is "direct-io is synchronous". Except it isn't, when we fall back to buffered-IO. So yup, I think we could justify this (sort of) change on those grounds alone: preserving the synchronous semantics. I'd propose that we do this via generic_file_buffered_write(...); do_sync_file_range(..., SYNC_FILE_RANGE_WAIT_BEFORE| SYNC_FILE_RANGE_WRITE| SYNC_FILE_RANGE_WAIT_AFTER) invalidate_mapping_pages(...); There is a slight inefficiency here: generic_file_direct_IO() does invalidate_inode_pages2_range(), then we go and instantiate some pagecache, then we strip it away again with invalidate_mapping_pages(). That first invalidate_inode_pages2_range() was somewhat of a waste of cycles. But we expect that the next call to generic_file_direct_IO() won't actually call invalidate_inode_pages2_range(), because mapping->nrpages is usually zero. Well, it would have been, back in the days when we were invalidating the whole file. Now are more efficient and we only invalidate the specific segment of that file. So if there's a stray pagecache page somewhere at the far end ofthe file, we'll pointlessly call invalidate_inode_pages2_range() every time. Oh well. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ | ||||||||||
| Last update: 2006-10-05 01:59 [from the cache] ©2003-2008 | |||||||||||