[PATCH] Optimize wait_sb_inodes()

OGAWA Hirofumi hirofumi at mail.parknet.co.jp
Wed Jun 26 17:01:23 PDT 2013

Jörn Engel <joern at logfs.org> writes:

> Two things.  Until there are actual implementations of
> s_op->wait_inodes, this is pure obfuscation.  You already know this,
> of course.

On tux3, implementation of ->wait_inodes() is the following. Because
tux3 guarantees order what wait_sb_inodes() wants to check, like

+static void tux3_wait_inodes(struct super_block *sb)
+	/*
+	 * Since tux3 flushes whole delta and guarantee order of
+	 * deltas, so tux3 doesn't need to wait inodes.
+	 *
+	 * Note, when we start to support direct I/O, we might have to
+	 * revisit this to check in-progress direct I/O.
+	 */

Another (untested) example for ext* would be like the following

static void ext4_wait_inodes(struct super_block *sb)
	/* ->sync_fs() guarantees to wait all */
	if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)

	/* FIXME: On data=ordered, we might be able to do something. */

> More interestingly, I personally hate methods with a default option if
> they are not implemented.  Not too bad in this particular case, but
> the same pattern has burned me a number of times and wasted weeks of
> my life.  So I would prefer to unconditionally call
> sb->s_op->wait_inodes(sb) and set it to wait_sb_inodes for all
> filesystems that don't have a smarter way to do things.

I don't have strong opinion about it though. Because the optimized
version is optional, this way might be safer.

Well, if there is the reason to push down, I will do it.

OGAWA Hirofumi <hirofumi at mail.parknet.co.jp>

More information about the Tux3 mailing list