Re: [PATCH] 9p: add write-cache support to loose cache mode (take 4)

From: Eric Van Hensbergen
Date: Sat Feb 17 2007 - 01:03:42 EST


On 2/16/07, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
On Fri, 16 Feb 2007 18:46:59 -0600
Eric Van Hensbergen <ericvh@xxxxxxxxx> wrote:
> + if(!PageUptodate(page)) {
> + if (to - from != PAGE_CACHE_SIZE) {
> + void *kaddr = kmap_atomic(page, KM_USER0);
> + memset(kaddr, 0, from);
> + memset(kaddr + to, 0, PAGE_CACHE_SIZE - to);
> + flush_dcache_page(page);
> + kunmap_atomic(kaddr, KM_USER0);
> + }
> + if ((file->f_flags & O_ACCMODE) != O_WRONLY)
> + v9fs_vfs_readpage_worker(file, page);
> + }

Seems strange to memset part of the page and to then go and fill the page
in from backing store. Perhaps some optimisation is possible here?


Just double-checking in an effort to actually get the next patch right
(hopefully) -- seems like there are two cases -- if I can read from
the file, I just call readpage and it'll zero out bits. If the file
is open write-only, things are a little cloudy -- fs/cifs looks like
they just don't do anything. In the write-only case, do I need to
zero the unwritten portions of the page, or does this get handled
under the covers? Looks like NFS just avoids this by only writing the
bits that change, which I suppose has other advantages. I'll refactor
the writepage code to follow the NFS example versus the CIFS code I
originally based my implementation on.

-eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/