linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: dhowells@redhat.com, linux-fsdevel@vger.kernel.org,
	linux-afs@lists.infradead.org
Subject: Re: afs_fsync
Date: Mon, 19 Apr 2010 12:54:09 +0100	[thread overview]
Message-ID: <10333.1271678049@redhat.com> (raw)
In-Reply-To: <20100418194653.GA20069@lst.de>

Christoph Hellwig <hch@lst.de> wrote:

> I've been looking at afs_fsync a bit lately and don't quite
> understanding what's going on there.  As of 2.6.32 we always
> write out all data before calling into ->fsync.  From my very
> unscientific exploration into afs_fsync it's doing exactly that
> data writeout again, just in a rather complicated way, and
> then marks the inode as having dirty pages again, which is not
> very helpful inside ->fsync.  Any chance you could explain
> what's really going on there?

kAFS maintains a queue of outstanding writebacks for each inode/vnode, which
afs_writepages() attempts to write back in order when there are multiple
elements in the queue for the range being written.  The afs_writeback struct
that forms the elements in that queue maps a written region in the file to a
key struct, which defines the security details to use for the AFS StoreData op.

These afs_writeback structs also make it easier to write back multiple pages
with one network op.

Now, afs_fsync() sticks a null record at the tail of the queue, so that it will
get woken up when everything before it in the queue at that point is gone.  It
then invokes afs_writepages() to write out the contents of the queue and waits
for the null record to be processes.

I don't recall why I put __mark_inode_dirty() in there with I_DIRTY_PAGES.  I
would suspect I copied it from somewhere, but I don't remember where.

I should probably optimise afs_fsync() to not do anything if vnode->writebacks
is empty once it has taken vnode->writeback_lock.

David

      reply	other threads:[~2010-04-19 11:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-18 19:46 afs_fsync Christoph Hellwig
2010-04-19 11:54 ` David Howells [this message]

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=10333.1271678049@redhat.com \
    --to=dhowells@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /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).