Re: [PATCH] zerocopy NFS updated

Hirokazu Takahashi
2002-04-11T11:38:29Z

Hi, David

davem> Now I wonder if we could make these pages COW mode.
davem> When some process try to update the pages, they should be duplicated.
davem> I's easy to implement it in write(), truncate() and so on.
davem> But mmap() is little bit difficult if there no reverse mapping page to PTE.
davem>
davem> How do you think about this idea?
davem>
davem> I think this idea has such high overhead that it is even not for
davem> consideration, consider SMP.

Hmmm... If I'd implement them.....
How about following codes ?

nfsd read()
{
:
page_cache_get(page);
if (page is mapped to anywhere)
page = duplicate_and_rehash(page);
else {
page_lock(page);
page->flags |= COW;
page_unlock(page);
}
sendpage(page);
page_cache_release(page);
}

generic_file_write()
{
page = _grab_cache_page()
lock_page(page);
if (page->flags & COW)
page = duplicate_and_rehash(page);
prepare_write();
commit_write();
UnlockPage(page);
page_cache_release(page)
}

truncate_list_page() <-- truncate() calls
{
page_cache_get();
lock_page(page);
if (page->flags & COW)
page = duplicate_and_rehash(page);
truncate_partial_page();
UnlockPage(page);
page_cache_release(page);
}