public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Eric Van Hensbergen <ericvh@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	v9fs-developer@lists.sourceforge.net,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH]: v9fs: add readpage support
Date: Fri, 13 Jan 2006 14:14:45 -0800	[thread overview]
Message-ID: <20060113141445.14b6469a.akpm@osdl.org> (raw)
In-Reply-To: <a4e6962a0601131345x6bf4ef3ftf3e6c6fb7bb2b530@mail.gmail.com>

Eric Van Hensbergen <ericvh@gmail.com> wrote:
>
> > > @@ -289,6 +289,8 @@ v9fs_file_write(struct file *filp, const
> > >               total += result;
> > >       } while (count);
> > >
> > > +     invalidate_inode_pages2(inode->i_mapping);
> > > +
> > >       return total;
> > >  }
> >
> 
> I went looking for an example of how to do this better.  More or less,
> v9fs reads and writes are similar to DirectIO since they don't go
> through the page-cache.

hm.  Why not?

>  So, I looked at what NFS does when it gets a
> DirectIO write, and it looks (to me) like it does more or less the
> same thing:
> (from nfs_file_direct_write() in fs/nfs/direct.c)
>         retval = nfs_direct_write(inode, ctx, &iov, pos, 1);
>         if (mapping->nrpages)
>                 invalidate_inode_pages2(mapping);
> 
> Now, that being said, it still seems to me to be a bit heavy weight --
> do folks have a better pointer to code that I can use as an example of
> how to do this more efficiently?

Not really.  If that's what you need to do then that's the way to do it. 
We've had nasty races and other problems wrt invalidate_inode_pages2 and
pagefaults, so I suggest you test that mix carefully.

Have you tried fsx-linux?  It's really good for finding data integrity
bugs.  There's a copy in
http://www.zip.com.au/~akpm/linux/patches/stuff/ext3-tools.tar.gz.

I'd suggest that you want the mapping->nrpages test - it'll be a useful
speedup in the common case.

Of course, someone could come in and add a page to pagecache via a
pagefault at any time after that test, but that's true of
invalidate_inode_pages2() in general.

  reply	other threads:[~2006-01-13 22:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-11  1:14 [PATCH]: v9fs: add readpage support Eric Van Hensbergen
2006-01-11 11:38 ` Andrew Morton
2006-01-11 13:05   ` Eric Van Hensbergen
2006-01-13 21:45   ` Eric Van Hensbergen
2006-01-13 22:14     ` Andrew Morton [this message]
2006-01-13 22:27       ` 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=20060113141445.14b6469a.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=ericvh@gmail.com \
    --cc=linux-fsdevel@vger.kernel.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