Dear all,
I'm interested in the synchronization mechanism between
buffer and page cache, e.g. for read/writes/mmap
on an ext2 file system.
Can anybody give me a hint?
I understand how the read and writes get synchronized:
read (generic_file_read) checks the page cache,
if not found it calls the read page interface of the
inode (generic_readpage). generic_readpage fetches
the data finally out of buffer cache, or in case of
a miss from disk.
write (ext2_file_write) checks whether a new buffer
needs to be allocated. If yes, it gets one and
copies data into it. If not, checks whether a
buffer with valid data exists. If not so, if fetches
the data from disk and modifies the to be written part.
ext2_file_write marks the buffer dirty and call
update_vm_cache_conditional to remove modified pages
in the page cache. Following reads will go into the
buffer cache, reads from an mmaped area will also
fall into a page read that goes through the buffer
cache.
(is this correct so far?)
What I don't understand is what happens if somebody
writes to a mmaped area. The page will certainly be
modifed. Reads will see the modification since the
page is in page cache. What about a write that
modifies a part of the same page? The contents in
the page cache is newer than that what is in buffer
cache or on disk, so a write that modifies only
a part of a block should fetch out of page cache
for a read-modify-write instead of buffer cache
or from disk.
What am I missing here?
Thanks for any help & best regards,
Martin Frey
--
Supercomputing Systems AG email: [EMAIL PROTECTED]
Martin Frey web: http://www.scs.ch/~frey/
Technoparkstrasse 1 phone: +41 (0) 1 445 16 00
CH-8005 Zurich fax: +41 (0) 1 445 16 10
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]