lkml.org 
[lkml]   [2008]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 2/2] xfs: Make XFS use the new file system init infrastructure
Date
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


\
 
 \ /
  Last update: 2008-06-01 16:55    [W:0.037 / U:2.316 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site