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

From: Andrew Morton
Date: Fri Feb 16 2007 - 20:01:53 EST


On Fri, 16 Feb 2007 18:46:59 -0600
Eric Van Hensbergen <ericvh@xxxxxxxxx> wrote:

> Loose cache mode was added primarily to asssist exclusive, read-only
> mounts (like venti) -- however, there is also a case for using loose
> write cacheing in support of read/write exclusive mounts. This feature
> is linked to the loose cache option and is disabled by default.
>
> This code adds the necessary code to support writes through the page
> cache. Write caches are not used for synthetic files or for files opened
> in APPEND mode.
>

Me again ;)

> +int v9fs_prepare_write(struct file *file, struct page *page,
> + unsigned from, unsigned to)
> +{
> + 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);
> + }
> +
> + return 0;
> +}

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?

And did the error from v9fs_vfs_readpage_worker() just get lost?

> +/**
> + * v9fs_commit_write - prepare for mmap or page-cache I/O
> + *
> + * @file: file being read

"written"

> + * @page: structure to page
> + * @offset: starting offset
> + * @to: ending offset
> + *
> + */
> +
>
-
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/