From patchwork Mon Jun 24 02:58:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Kent X-Patchwork-Id: 11012089 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 45DFC76 for ; Mon, 24 Jun 2019 03:08:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 367E728AF8 for ; Mon, 24 Jun 2019 03:08:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2AD2428B08; Mon, 24 Jun 2019 03:08:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA2E628AF8 for ; Mon, 24 Jun 2019 03:08:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726579AbfFXDID (ORCPT ); Sun, 23 Jun 2019 23:08:03 -0400 Received: from icp-osb-irony-out1.external.iinet.net.au ([203.59.1.210]:33315 "EHLO icp-osb-irony-out1.external.iinet.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726323AbfFXDID (ORCPT ); Sun, 23 Jun 2019 23:08:03 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2AeAACVOxBd/3Gu0HYNVxwBAQEEAQEHBAEBgVUFAQELAYQshBaTSQaBEYl4hReEX4UdgXsJAQEBAQEBAQEBNwEBAYQ6AwICgwE2Bw4BAwEBAQQBAQEBBAGQewIBAyMEUhAYDQImAgJHEAYThRmiSXF+MxqKEYEMKAGBYYoTeIEHgREzgx2HToJYBIt8gk6Fdz+VCQmCFpN9DI0gA4oYLYNjnSiEcAyBfU0uCoMngk0Xji1lkDIBAQ X-IPAS-Result: A2AeAACVOxBd/3Gu0HYNVxwBAQEEAQEHBAEBgVUFAQELAYQshBaTSQaBEYl4hReEX4UdgXsJAQEBAQEBAQEBNwEBAYQ6AwICgwE2Bw4BAwEBAQQBAQEBBAGQewIBAyMEUhAYDQImAgJHEAYThRmiSXF+MxqKEYEMKAGBYYoTeIEHgREzgx2HToJYBIt8gk6Fdz+VCQmCFpN9DI0gA4oYLYNjnSiEcAyBfU0uCoMngk0Xji1lkDIBAQ X-IronPort-AV: E=Sophos;i="5.63,410,1557158400"; d="scan'208";a="221015739" Received: from unknown (HELO [192.168.1.222]) ([118.208.174.113]) by icp-osb-irony-out1.iinet.net.au with ESMTP; 24 Jun 2019 10:58:45 +0800 Subject: [PATCH 04/10] xfs: mount-api - refactor xfs_fs_fill_super() From: Ian Kent To: linux-xfs Cc: Dave Chinner , David Howells , Al Viro Date: Mon, 24 Jun 2019 10:58:44 +0800 Message-ID: <156134512264.2519.11045220600510784871.stgit@fedora-28> In-Reply-To: <156134510205.2519.16185588460828778620.stgit@fedora-28> References: <156134510205.2519.16185588460828778620.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 X-Virus-Scanned: ClamAV using ClamSMTP Much of the code in xfs_fs_fill_super() will be used by the fill super function used by 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 --- fs/xfs/xfs_super.c | 65 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index e78fea14d598..cf8efb465969 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1823,27 +1823,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; @@ -1870,7 +1857,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) @@ -2003,10 +1990,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; @@ -2016,6 +1999,42 @@ 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 = NULL; + int 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; + + 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); +out: + return error; +} + STATIC void xfs_fs_put_super( struct super_block *sb)