LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: Josef Sipek <jsipek@fsl.cs.sunysb.edu> To: Eric Van Hensbergen <ericvh@gmail.com> Cc: linux-kernel@vger.kernel.org, v9fs-developer@lists.sourceforge.net Subject: Re: [PATCH] 9p: add write-cache support to loose cache mode (take 2) Date: Thu, 15 Feb 2007 14:19:11 -0500 [thread overview] Message-ID: <20070215191911.GB14473@filer.fsl.cs.sunysb.edu> (raw) In-Reply-To: <11715506591894-git-send-email-ericvh@gmail.com> On Thu, Feb 15, 2007 at 08:44:19AM -0600, Eric Van Hensbergen wrote: ... > diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c > index bed48fa..d43d6fb 100644 > --- a/fs/9p/vfs_addr.c > +++ b/fs/9p/vfs_addr.c > @@ -6,6 +6,9 @@ > * Copyright (C) 2005 by Eric Van Hensbergen <ericvh@gmail.com> > * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> > * > + * Some operations based on code from fs/cifs/file.c > + * Copyright (C) International Business Machines Corp., 2002,2003 > + * > * This program is free software; you can redistribute it and/or modify > * it under the terms of the GNU General Public License version 2 > * as published by the Free Software Foundation. > @@ -41,14 +44,14 @@ > #include "fid.h" > > /** > - * v9fs_vfs_readpage - read an entire page in from 9P > + * v9fs_vfs_readpage_worker - read an entire page in from 9P > * > * @file: file being read > * @page: structure to page > * > */ > > -static int v9fs_vfs_readpage(struct file *filp, struct page *page) > +static int v9fs_vfs_readpage_worker(struct file *filp, struct page *page) > { > char *buffer = NULL; > int retval = -EIO; > @@ -63,23 +66,21 @@ static int v9fs_vfs_readpage(struct file *filp, struct page *page) > int total = 0; > int result = 0; > > - dprintk(DEBUG_VFS, "\n"); > - > + page_cache_get(page); > buffer = kmap(page); > do { > if (count < rsize) > rsize = count; > > result = v9fs_t_read(v9ses, fid, offset, rsize, &fcall); > - > if (result < 0) { > - printk(KERN_ERR "v9fs_t_read returned %d\n", > - result); > + printk(KERN_ERR "v9fs_t_read returned %d\n", result); > > kfree(fcall); > - goto UnmapAndUnlock; > - } else > + goto io_error; > + } else { > offset += result; > + } There are a bunch of places where you have unneeded braces. > > memcpy(buffer, fcall->params.rread.data, result); > > @@ -98,12 +99,178 @@ static int v9fs_vfs_readpage(struct file *filp, struct page *page) > SetPageUptodate(page); > retval = 0; > > -UnmapAndUnlock: > + io_error: Indentation... > + kunmap(page); > + page_cache_release(page); > + return retval; > +} > + > +/** > + * v9fs_prepare_write - prepare for mmap or page-cache I/O > + * > + * @file: file being read > + * @page: structure to page > + * @from: starting offset > + * @to: ending offset > + * > + */ > + > +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; > +} > + > +/** > + * v9fs_commit_write - prepare for mmap or page-cache I/O > + * > + * @file: file being read > + * @page: structure to page > + * @offset: starting offset > + * @to: ending offset > + * > + * TODO: Perhaps I should just do the write here? > + */ > + > +int v9fs_commit_write(struct file *file, struct page *page, > + unsigned offset, unsigned to) > +{ > + struct inode *inode = page->mapping->host; > + loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to; whitespace > + > + dprintk(DEBUG_VFS, "\n"); > + > + if(!PageUptodate(page)) > + SetPageUptodate(page); > + > + /* > + * No need to use i_size_read() here, the i_size > + * cannot change under us because we hold the i_mutex. > + * > + */ > + if (pos > inode->i_size) { > + i_size_write(inode, pos); > + /* need to adjust inode on remote */ > + } > + set_page_dirty(page); > + dprintk(DEBUG_CURRENT, "inode->size: %llx\n",inode->i_size); > + > + return 0; > +} ... Josef "Jeff" Sipek. -- Computer Science is no more about computers than astronomy is about telescopes. - Edsger Dijkstra
next prev parent reply other threads:[~2007-02-15 19:19 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-02-15 14:44 [PATCH] 9p: add write-cache support to loose cache mode (take 2) Eric Van Hensbergen 2007-02-15 19:19 ` Josef Sipek [this message] 2007-02-16 15:37 ` [PATCH] 9p: add write-cache support to loose cache mode (take 3) Eric Van Hensbergen 2007-02-16 20:12 ` Andrew Morton 2007-02-16 22:28 ` Eric Van Hensbergen 2007-02-17 0:46 ` [PATCH] 9p: add write-cache support to loose cache mode (take 4) Eric Van Hensbergen 2007-02-17 1:01 ` Andrew Morton 2007-02-17 6:03 ` Eric Van Hensbergen
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20070215191911.GB14473@filer.fsl.cs.sunysb.edu \ --to=jsipek@fsl.cs.sunysb.edu \ --cc=ericvh@gmail.com \ --cc=linux-kernel@vger.kernel.org \ --cc=v9fs-developer@lists.sourceforge.net \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).