On Sep 23, 2009, at 2:46 AM, anubhav rakshit < email@hidden> wrote: By "afs" i meant "Anubhav FS" . Its a hypothetical name.I am not planning to delay an OTW open.What i need to know is when a file is being paged in, is it because the user is going to write on the mapped area or is he reading?
Pretty much you can't know. I can change the mapping after I page into a read-only area and make it into a read/write area and then write it. Even if you wrote a bunch of code to grovel the vm_object_t out of the upl you get passed and then assume it's the only vm_object_t pointing to a given backing page, you'll only get information which can be changed out from under you, without notification.
Anton is correct as far as he goes, but some protection changes, particularly through Mach interfaces, are not going to notify the VFS, and even if they did, it would be after the fact and therefore only partially useful for things like local replicas and not at all useful for predicting if you needed write permission at some point in the future at the time read happens.
Also, if the I/O is for page multiple on a page boundary, it won't trigger a read/modify/write, you'll end up only ever seeing the write.
-- Terry |