From patchwork Wed Oct 9 11:30:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Kent X-Patchwork-Id: 11181039 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 97F8217D4 for ; Wed, 9 Oct 2019 11:31:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 820DB21835 for ; Wed, 9 Oct 2019 11:31:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729699AbfJILbK (ORCPT ); Wed, 9 Oct 2019 07:31:10 -0400 Received: from icp-osb-irony-out3.external.iinet.net.au ([203.59.1.153]:33503 "EHLO icp-osb-irony-out3.external.iinet.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729575AbfJILbK (ORCPT ); Wed, 9 Oct 2019 07:31:10 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2AnAABxxJ1d/0e30XYNWRwBAQEBAQcBAREBBAQBAYFpBQEBCwGEOYQjjygBAQEDBoERih2FH4RshSiBewkBAQEBAQEBAQE3AQGEOwMCAoJyNgcOAgwBAQEEAQEBAQEFAwGFWIYaAgEDIwRSEBgNAiYCAkcQBhOFGa9vdX8zGoosgQwoAYFkikF4gQeBETODHYdSglgEjQWCLzeGPEOWWYIslTQMjhUDixwthAqlLAGCCk0uCoMnUIF/F44wZ5EUAQE X-IPAS-Result: A2AnAABxxJ1d/0e30XYNWRwBAQEBAQcBAREBBAQBAYFpBQEBCwGEOYQjjygBAQEDBoERih2FH4RshSiBewkBAQEBAQEBAQE3AQGEOwMCAoJyNgcOAgwBAQEEAQEBAQEFAwGFWIYaAgEDIwRSEBgNAiYCAkcQBhOFGa9vdX8zGoosgQwoAYFkikF4gQeBETODHYdSglgEjQWCLzeGPEOWWYIslTQMjhUDixwthAqlLAGCCk0uCoMnUIF/F44wZ5EUAQE X-IronPort-AV: E=Sophos;i="5.67,273,1566835200"; d="scan'208";a="216229059" Received: from unknown (HELO [192.168.1.222]) ([118.209.183.71]) by icp-osb-irony-out3.iinet.net.au with ESMTP; 09 Oct 2019 19:30:58 +0800 Subject: [PATCH v5 09/17] xfs: mount-api - refactor xfs_fs_fill_super() From: Ian Kent To: linux-xfs Cc: Brian Foster , Eric Sandeen , David Howells , Dave Chinner , Al Viro Date: Wed, 09 Oct 2019 19:30:58 +0800 Message-ID: <157062065791.32346.8183392339697088078.stgit@fedora-28> In-Reply-To: <157062043952.32346.977737248061083292.stgit@fedora-28> References: <157062043952.32346.977737248061083292.stgit@fedora-28> User-Agent: StGit/unknown-version MIME-Version: 1.0 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Much of the code in xfs_fs_fill_super() will be used by the fill super function of the new mount-api. So refactor the common code into a helper in an attempt to show what's actually changed. Signed-off-by: Ian Kent Reviewed-by: Brian Foster --- fs/xfs/xfs_super.c | 64 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 7008355df065..cc2da9093e34 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1712,27 +1712,14 @@ xfs_mount_alloc( STATIC int -xfs_fs_fill_super( - struct super_block *sb, - void *data, +__xfs_fs_fill_super( + struct xfs_mount *mp, int silent) { + struct super_block *sb = mp->m_super; struct inode *root; - struct xfs_mount *mp = NULL; - int flags = 0, error = -ENOMEM; - - /* - * allocate mp and do all low-level struct initializations before we - * attach it to the super - */ - mp = xfs_mount_alloc(sb); - if (!mp) - goto out; - sb->s_fs_info = mp; - - error = xfs_parseargs(mp, (char *)data); - if (error) - goto out_free_fsname; + int flags = 0; + int error; sb_min_blocksize(sb, BBSIZE); sb->s_xattr = xfs_xattr_handlers; @@ -1759,7 +1746,7 @@ xfs_fs_fill_super( error = xfs_open_devices(mp); if (error) - goto out_free_fsname; + goto out; error = xfs_init_mount_workqueues(mp); if (error) @@ -1894,10 +1881,6 @@ xfs_fs_fill_super( xfs_destroy_mount_workqueues(mp); out_close_devices: xfs_close_devices(mp); - out_free_fsname: - sb->s_fs_info = NULL; - xfs_free_fsname(mp); - kfree(mp); out: return error; @@ -1907,6 +1890,41 @@ xfs_fs_fill_super( goto out_free_sb; } +STATIC int +xfs_fs_fill_super( + struct super_block *sb, + void *data, + int silent) +{ + struct xfs_mount *mp; + int error; + + /* + * allocate mp and do all low-level struct initializations before we + * attach it to the super + */ + mp = xfs_mount_alloc(sb); + if (!mp) + return -ENOMEM; + sb->s_fs_info = mp; + + error = xfs_parseargs(mp, (char *)data); + if (error) + goto out_free_fsname; + + error = __xfs_fs_fill_super(mp, silent); + if (error) + goto out_free_fsname; + + return 0; + + out_free_fsname: + sb->s_fs_info = NULL; + xfs_free_fsname(mp); + kfree(mp); + return error; +} + STATIC void xfs_fs_put_super( struct super_block *sb)