Re: [RFC PATCH 1/2] vfs: Introduce on-demand filesysteminitialisation

From: Al Viro
Date: Sun Jun 01 2008 - 11:32:20 EST


On Sun, Jun 01, 2008 at 03:51:54PM +0100, Tom Spink wrote:


Occam's Razor...

You've just serialized ->kill_sb() for given fs type (and made sure that
if one gets stuck, _everything_ gets stuck). Moreover, you've serialized
sget() against the same thing (i.e. pretty much each ->get_sb()).

All of that (and a couple of new methods) is done for something that just
plain does not belong to VFS. It's trivially doable in filesystem *and*
it's about the objects with lifetimes that make sense only for filesystem
itself.

Hell, just do

int want_xfs_threads(void)
{
int res = 0;
mutex_lock(&foo_lock);
if (!count++) {
start threads
if failed {
count--;
res = -Esomething;
}
}
mutex_unlock(&foo_lock);
return res;
}

void leave_xfs_threads(void)
{
mutex_lock(&foo_lock);
if (!--count)
stop threads
mutex_unlock(&foo_lock);
}

Call want_xfs_threads() in xfs_fs_fill_super(); call leave_xfs_threads() in
the end of xfs_put_super() and on failure exit from xfs_fs_fill_super().
End of story... Any other fs that wants such things can do the same.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/