From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Spink Subject: [RFC PATCH 2/2] xfs: Make XFS use the new file system init infrastructure Date: Sun, 1 Jun 2008 15:51:55 +0100 Message-ID: <1212331915-22856-3-git-send-email-tspink@gmail.com> References: <> <1212331915-22856-1-git-send-email-tspink@gmail.com> <1212331915-22856-2-git-send-email-tspink@gmail.com> Cc: linux-fsdevel@vger.kernel.org, Tom Spink To: linux-kernel@vger.kernel.org Return-path: In-Reply-To: <1212331915-22856-2-git-send-email-tspink@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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 --- 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