LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Eric Van Hensbergen" <ericvh@gmail.com>
To: "Andrew Morton" <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, v9fs-developer@lists.sourceforge.net
Subject: Re: [PATCH] 9p: add write-cache support to loose cache mode (take 3)
Date: Fri, 16 Feb 2007 16:28:31 -0600 [thread overview]
Message-ID: <a4e6962a0702161428p240ab9acwd0a384dedd1b99e6@mail.gmail.com> (raw)
In-Reply-To: <20070216121226.f2382a17.akpm@linux-foundation.org>
On 2/16/07, Andrew Morton <akpm@linux-foundation.org> wrote:
> On Fri, 16 Feb 2007 09:37:01 -0600 Eric Van Hensbergen <ericvh@gmail.com> wrote:
>
> > +static int v9fs_vfs_writepage(struct page *page, struct writeback_control *wbc)
> > +{
> > + char *buffer = NULL;
> > + struct address_space *mapping = page->mapping;
> > + int retval = -EIO;
> > + loff_t offset = 0;
> > + pgoff_t end_index;
> > + int count = PAGE_CACHE_SIZE;
> > + struct file *filp = v9fs_find_file(page);
> > + struct inode *inode = mapping->host;
> > +
> > + dprintk(DEBUG_VFS, "page: %p\n", page);
> > +
> > + if ((!inode) || (!filp))
> > + goto UnlockPage;
> > +
> > + end_index = inode->i_size >> PAGE_CACHE_SHIFT;
> > +
> > + /* complicated case at end of file */
> > + if (page->index >= end_index) {
> > + /* things got complicated... */
> > + count = inode->i_size & (PAGE_CACHE_SIZE - 1);
> > + if (page->index >= end_index + 1 || !count)
> > + return 0; /* truncated - don't care */
> > + }
> > +
> > + buffer = kmap(page);
> > + offset = ((loff_t) page->index << PAGE_CACHE_SHIFT);
> > + page_cache_get(page);
> > + retval = v9fs_write(filp, NULL, buffer, count, &offset);
> > +
> > kunmap(page);
> > +
> > + UnlockPage:
> > unlock_page(page);
> > + page_cache_release(page);
> > +
> > return retval;
> > }
>
> The page_cache_get/release here aren't needed: lock_page suffices.
>
> Are you sure the page refcounting is right if the `goto UnlockPage'
> happens?
>
> Can that goto actually happen??
>
It shouldn't, if it does we are probably in big trouble anyways. I'll
pull it out. Thanks.
-eric
next prev parent reply other threads:[~2007-02-16 22:28 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
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 [this message]
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=a4e6962a0702161428p240ab9acwd0a384dedd1b99e6@mail.gmail.com \
--to=ericvh@gmail.com \
--cc=akpm@linux-foundation.org \
--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: link
Be 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).