Re: [PATCH] zerocopy NFS updated

Hirokazu Takahashi (taka@valinux.co.jp)
Thu, 11 Apr 2002 20:38:23 +0900 (JST)


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);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/