linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 0/12] make ->sync_fs mandatory
Date: Tue, 09 Jun 2009 15:55:06 +0300	[thread overview]
Message-ID: <4A2E5BAA.7070404@panasas.com> (raw)
In-Reply-To: <20090608144501.GK8633@ZenIV.linux.org.uk>

On 06/08/2009 05:45 PM, Al Viro wrote:
> On Mon, Jun 08, 2009 at 10:02:52AM +0200, Christoph Hellwig wrote:
>> Currently the superblock methods are a bit confusing.  There is the
>> newer ->sync_fs method which is unconditionally called from
>> __sync_filesystem for data integrity writebacks.  And there is the older
>> ->write_super which is called from pdflush for the periodic superblock
>> writeback, but also from __sync_filesystem just before calling
>> ->sync_fs. (And still from file_fsync, but that is about to go away).
>>
>> This series makes sure all filesystems that need superblock writeouts
>> define a ->sync_fs so we can stop calling ->write_super for the data
>> integrity writeback.  This means the presence of ->write_super indicates
>> a filesystem does want periodic superblock writeback and can implement
>> these independently from the data integrity writeback. It also means
>> we don't need to bother with possible s_dirt races for the data
>> integrity syncs.
>>
>> This patch series first adds ->sync_fs methods to all filesystems having
>> ->write_super, often refactoring the code in that are (and also
>> preparing the ->write_super instances for moving MS_RDONLY checking into
>> the caller), then it makes sure the existing ->sync_fs instaces cover
>> the work previously done in ->write_super for the two cases where they
>> differed widely, and lastly removes the call to ->write_super from
>> __sync_filesystem.
> 
> Applied.  FWIW, file_fsync() is nearly gone; the last remnants are exofs,
> hfs and hfsplus.  Is there any sane way to keep track of dirty metadata
> blocks there?  Or is "just flush all dirty buffer_head for the device"
> really the best we can do?

Hi Al

Below is just an RFC for review concerning the file_fsync() use. I've
open coded the parts of file_fsync() that are actually needed. Note
the TODO as the sb update is only needed for new files, I'll farther
look into it later.

The below patch is no good because it's based on an old tree. The lock_super
was moved to inside write_super right? and also I should call the new
exofs_sync_fs() directly. Please just give me the OK that this is the
idea here and I'll prepare the right patch.

What is the most uptodate tree that has all these changes? so I can cut
the patches over? (Sorry for the novice-ness)
---
[RFC] exofs: Avoid using file_fsync()

The use of file_fsync() in exofs_file_sync() is not necessary since it
does some extra stuff not used by exofs. Open code just the parts that
are currently needed.

TODO: Farther optimization can be done to sync the sb only on inode update
of new files, Usually the sb update is not needed in exofs.

Boaz
---
git diff --stat -p fs/exofs/file.c
 fs/exofs/file.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/fs/exofs/file.c b/fs/exofs/file.c
index 6ed7fe4..9e60d68 100644
--- a/fs/exofs/file.c
+++ b/fs/exofs/file.c
@@ -47,16 +47,24 @@ static int exofs_file_fsync(struct file *filp, struct dentry *dentry,
 {
 	int ret;
 	struct address_space *mapping = filp->f_mapping;
+	struct inode * inode = dentry->d_inode;
+	struct super_block * sb;
 
 	ret = filemap_write_and_wait(mapping);
 	if (ret)
 		return ret;
 
-	/*Note: file_fsync below also calles sync_blockdev, which is a no-op
-	 *      for exofs, but other then that it does sync_inode and
-	 *      sync_superblock which is what we need here.
-	 */
-	return file_fsync(filp, dentry, datasync);
+	/* sync the inode attributes */
+	ret = write_inode_now(inode, 0);
+
+	/* This is a good place to write the sb */
+	/* TODO: Schedule an sb-sync on create */
+	sb = inode->i_sb;
+	lock_super(sb);
+	if (sb->s_dirt && sb->s_op->write_super)
+		sb->s_op->write_super(sb);
+	unlock_super(sb);
+	return ret;
 }
 
 static int exofs_flush(struct file *file, fl_owner_t id)




      reply	other threads:[~2009-06-09 12:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-08  8:02 [PATCH 0/12] make ->sync_fs mandatory Christoph Hellwig
2009-06-08  8:03 ` [PATCH 1/12] affs: add ->sync_fs Christoph Hellwig
2009-06-08  8:03 ` [PATCH 2/12] bfs: " Christoph Hellwig
2009-06-08  8:03 ` [PATCH 3/12] exofs: " Christoph Hellwig
2009-06-09 13:03   ` Boaz Harrosh
2009-06-08  8:04 ` [PATCH 4/12] ext2: " Christoph Hellwig
2009-06-08  8:04 ` [PATCH 0/12] make ->sync_fs mandatory Christoph Hellwig
2009-06-08  8:04 ` [PATCH 6/12] hfs: add ->sync_fs Christoph Hellwig
2009-06-08  8:05 ` [PATCH 7/12] hfsplus: " Christoph Hellwig
2009-06-08  8:07 ` [PATCH 8/12] sysv: " Christoph Hellwig
2009-06-08  8:08 ` [PATCH 9/12] ufs: " Christoph Hellwig
2009-06-08  8:08 ` [PATCH 10/12] jffs2: call jffs2_write_super from jffs2_sync_fs Christoph Hellwig
2009-06-08  8:08 ` [PATCH 11/12] nilfs2: call nilfs2_write_super from nilfs2_sync_fs Christoph Hellwig
2009-06-08  8:08 ` [PATCH 12/12] remove the call to ->write_super in __sync_filesystem Christoph Hellwig
2009-06-08 14:45 ` [PATCH 0/12] make ->sync_fs mandatory Al Viro
2009-06-09 12:55   ` Boaz Harrosh [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=4A2E5BAA.7070404@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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).