linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Spink <tspink@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org, Tom Spink <tspink@gmail.com>
Subject: [RFC PATCH 2/2] xfs: Make XFS use the new file system init infrastructure
Date: Sun,  1 Jun 2008 15:51:55 +0100	[thread overview]
Message-ID: <1212331915-22856-3-git-send-email-tspink@gmail.com> (raw)
In-Reply-To: <1212331915-22856-2-git-send-email-tspink@gmail.com>

This patch makes XFS use the file system type specific init and exit
callbacks, so that XFS only initialises when it's used for the first
time.

This is useful for when XFS is compiled into the kernel, but never
actually used as it stops XFS from creating global threads, until
they are needed.

Signed-off-by: Tom Spink <tspink@gmail.com>
---
 fs/xfs/linux-2.6/xfs_super.c |   55 +++++++++++++++++++++++-------------------
 1 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 742b2c7..3e7340a 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -1422,23 +1422,9 @@ static struct quotactl_ops xfs_quotactl_operations = {
 	.set_xquota		= xfs_fs_setxquota,
 };
 
-static struct file_system_type xfs_fs_type = {
-	.owner			= THIS_MODULE,
-	.name			= "xfs",
-	.get_sb			= xfs_fs_get_sb,
-	.kill_sb		= kill_block_super,
-	.fs_flags		= FS_REQUIRES_DEV,
-};
-
-
-STATIC int __init
-init_xfs_fs( void )
+static int xfs_fs_init(void)
 {
-	int			error;
-	static char		message[] __initdata = KERN_INFO \
-		XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled\n";
-
-	printk(message);
+	int error;
 
 	ktrace_init(64);
 
@@ -1455,14 +1441,8 @@ init_xfs_fs( void )
 	uuid_init();
 	vfs_initquota();
 
-	error = register_filesystem(&xfs_fs_type);
-	if (error)
-		goto undo_register;
 	return 0;
 
-undo_register:
-	xfs_buf_terminate();
-
 undo_buffers:
 	xfs_destroy_zones();
 
@@ -1470,17 +1450,42 @@ undo_zones:
 	return error;
 }
 
-STATIC void __exit
-exit_xfs_fs( void )
+static void xfs_fs_exit(void)
 {
 	vfs_exitquota();
-	unregister_filesystem(&xfs_fs_type);
 	xfs_cleanup();
 	xfs_buf_terminate();
 	xfs_destroy_zones();
 	ktrace_uninit();
 }
 
+static struct file_system_type xfs_fs_type = {
+	.owner			= THIS_MODULE,
+	.name			= "xfs",
+	.get_sb			= xfs_fs_get_sb,
+	.kill_sb		= kill_block_super,
+	.fs_flags		= FS_REQUIRES_DEV,
+	.init			= xfs_fs_init,
+	.exit			= xfs_fs_exit,
+};
+
+
+STATIC int __init
+init_xfs_fs( void )
+{
+	static char		message[] __initdata = KERN_INFO \
+		XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled\n";
+
+	printk(message);
+	return register_filesystem(&xfs_fs_type);
+}
+
+STATIC void __exit
+exit_xfs_fs( void )
+{
+	unregister_filesystem(&xfs_fs_type);
+}
+
 module_init(init_xfs_fs);
 module_exit(exit_xfs_fs);
 
-- 
1.5.4.3

  reply	other threads:[~2008-06-01 14:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-01 14:51 [RFC PATCH 0/2] On-demand Filesystem Initialisation Tom Spink
2008-06-01 14:51 ` [RFC PATCH 1/2] vfs: Introduce on-demand filesystem initialisation Tom Spink
2008-06-01 14:51   ` Tom Spink [this message]
2008-06-01 15:32   ` Al Viro
2008-06-02 13:38     ` Tom Spink
2008-06-02  1:58 ` [RFC PATCH 0/2] On-demand Filesystem Initialisation Dave Chinner
2008-06-02 13:39   ` Tom Spink

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=1212331915-22856-3-git-send-email-tspink@gmail.com \
    --to=tspink@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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).