linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* afs_fsync
@ 2010-04-18 19:46 Christoph Hellwig
  2010-04-19 11:54 ` afs_fsync David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2010-04-18 19:46 UTC (permalink / raw)
  To: dhowells; +Cc: linux-afs, linux-fsdevel

Dave,

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?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: afs_fsync
  2010-04-18 19:46 afs_fsync Christoph Hellwig
@ 2010-04-19 11:54 ` David Howells
  0 siblings, 0 replies; 2+ messages in thread
From: David Howells @ 2010-04-19 11:54 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: dhowells, linux-fsdevel, linux-afs

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-19 11:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-18 19:46 afs_fsync Christoph Hellwig
2010-04-19 11:54 ` afs_fsync David Howells

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).