[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1234617597.19783.110.camel@sebastian.kern.oss.ntt.co.jp>
Date: Sat, 14 Feb 2009 22:19:57 +0900
From: Fernando Luis Vázquez Cao
<fernando@....ntt.co.jp>
To: Dave Chinner <david@...morbit.com>
Cc: Fernando Luis Vazquez Cao <fernando@....ac.jp>,
Eric Sandeen <sandeen@...hat.com>, Jan Kara <jack@...e.cz>,
Theodore Tso <tytso@....EDU>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
Pavel Machek <pavel@...e.cz>,
kernel list <linux-kernel@...r.kernel.org>,
Jens Axboe <jens.axboe@...cle.com>,
Ric Wheeler <rwheeler@...hat.com>
Subject: Re: vfs: Add MS_FLUSHONFSYNC mount flag
On Sat, 2009-02-14 at 22:03 +0900, Fernando Luis Vázquez Cao wrote:
> > > 2- Modify file_fsync() so that it checks whether FLUSHONFSYNC is set and
> > > flushes the underlying device accordingly. With this we would cover all
> > > filesystems that use the vfs-provided file_fsync() as their fsync method
> > > (commonly used filesystems such as fat fall in this group).
> >
> > Just make it flush the block device.
>
> I wrote a patch that does exactly that but, in addition, it checks
> whether FLUSHONFSYNC is set to avoid sending unnecessary flushes down
> the block layer (this patch is not included in this patch-set, but I
> will add it in the next iteration).
I probably should have mentioned in my proposal all filesystems would
just call the helper function block_flush_device() to flush the
underlying block device, unconditionally.
This helper function looks like this:
+/* Issue flush of write caches on the block device */
+int block_flush_device(struct super_block *sb)
+{
+ int ret = 0;
+
+ if (!(sb->s_flags & MS_FLUSHONFSYNC))
+ return ret;
+
+ ret = blkdev_issue_flush(sb->s_bdev, NULL);
+
+ if (ret == -EOPNOTSUPP)
+ return 0;
+
+ return ret;
+}
As you can see the check for flushonfsync is done here, so changing my
patches along the lines you suggest would be a trivial two lines patch.
- Fernando
> As I mentioned above, if everyone thinks this small optimization not
> elegant or an undesirable layering violation I will remove it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists