Skip to contentSkip to conversation

writethrough of mmapped pages

DISCUSSION Steve French 3 participants 3 messages Jan 30, 2004 – Jan 31, 2004 VFS

lore
Share & tools
lore
#0 lore raw

Is there an easy way to locally force the page cache to do in effect writethrough of mmapped pages (when I lose my write caching token in cifs vfs e.g.)? Standard writes can be hooked easily enough by wrapping the inode operation for write and only calling generic_write if they are (still) cacheable locally which is what I do in current code, but mmapped writes still go through the page cache presumably and thus would have to be synced if a non-mmmapped read followed an mmapped write of an overlapping range.

#1 lore raw
Quoted 9 lines · Steve French

Is there an easy way to locally force the page cache to do in effect writethrough of mmapped pages (when I lose my write caching token in cifs vfs e.g.)? Standard writes can be hooked easily enough by wrapping the inode operation for write and only calling generic_write if they are (still) cacheable locally which is what I do in current code, but mmapped writes still go through the page cache presumably and thus would have to be synced if a non-mmmapped read followed an mmapped write of an overlapping range.

You mean that you want the filesytem to know whenever an application attempts to modify a mmapped page? After the modification, rather than before?

Not sure how to do that - even if you modify the MM to take a trap on every write the page still hasn't been modified on entry to the fault handler.

#2 lore raw
Quoted 6 lines · Andrew Morton

You mean that you want the filesytem to know whenever an application attempts to modify a mmapped page? After the modification, rather than before?

Not sure how to do that - even if you modify the MM to take a trap on every write the page still hasn't been modified on entry to the fault handler.

If I'm ever going to implement shared writable mmap in JFFS2 I'm going to need part of this actually -- a hook in do_wp_page() so I can preallocate data structures, and make appropriate reservations on the medium to make sure we can always satisfy the writepage() without having to garbage collect or allocate memory.

Knowing about it before the modification is fine for me though.

Signature · 1 line
dwmw2