On Wed, 2009-03-04 at 01:19 +0900, hooanon05@xxxxxxxxxxx wrote: > Dave Kleikamp: > > > - you have two mmap for a single file > > > > Explain what you mean by a single file. If there are two mmaps to the > > upper file, they will see the same changes. If one is to the upper > > file, and one is to the lower file, they will NOT be mmap'ed to the same > > file. > > A regular file on the lower readonly layer. Not a single block/page is > copied-up yet. I understand the file physically resides on the lower layer. The delta file system will presents a new file on a different path that initially has the contents of the lower file. If you are mmapping the file presented by the delta files system, then both mmaps will see the same modified data. Any mmaps to the original path of the read-only file system will not see any modified data. dd if=/dev/zero of=/ro/a bs=4096 count=1000 # /ro/a contains 1000 pages of zeros mount -o remount,ro /ro # make sure it's read-only mount -t deltafs /ro /rw mmap(addr1, "/ro/a", ...); mmap(addr2, "/rw/a", ...); mmap(addr3, "/rw/a", ...); If you modify the file through addr3, addr2 will see the changes. the address space for /rw/a is shared. However, addr1 will only see the read-only data. /ro/a will not be modified. deltafs (does this filesystem have a name yet?) does not need to copy all 1000 pages from the lower file. It can read from the lower file as needed when a page is accessed. The modified data will be present in the upper address space's page cache. I assume it will eventually be written as a "delta" in the upper file system. > > No. The first mapping is not even aware of the second mapping. It > > continues to see the read-only data > > Should the first mapping see the latest (modified) content? If you're asking about the case of addr2 and addr3 above, then yes. For addr1, no. -- David Kleikamp IBM Linux Technology Center -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html