From patchwork Wed Aug 14 02:39:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13762756 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 18139C52D7C for ; Wed, 14 Aug 2024 02:32:49 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1se3of-0007G7-7X; Wed, 14 Aug 2024 02:32:48 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1se3od-0007Fz-R6 for linux-f2fs-devel@lists.sourceforge.net; Wed, 14 Aug 2024 02:32:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=AcPxhlT3vwNDfR8D6DWGk+04c1moSkfSKqi8ARDqwXs=; b=TqK3CPPwJSh0R9NpuyJPYX6c8F ioqJ4+jLP8xLe/piK9Cqm9lck6NMiDDPXGUwGvfcJwlgeBOkNcLgcdzlZyTf3nA84FPO+WA1MvD8Y 4xfcBYr9uZX5Ppyg9KqfDcrL697EtYCeVgUywcA86KW5u1St0v4xDVEKgiFwwcRZQUqA=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=AcPxhlT3vwNDfR8D6DWGk+04c1moSkfSKqi8ARDqwXs=; b=C2sm/AW9SEf+CwfZ3bRzdBlvfO W1ZTrxkKI+q9serzf5i4frCcVwhAjmrSLinre9KIKrn+ZT73GnuJkQe3zxedA0acb2K68EEE1bgTj fFgpUOI4ms6Lhd3MJiwyZEEPyHyzp3SoPiCaSSXDTd5yjw5HIY7W6/wi3NOt9RiUM9RI=; Received: from szxga04-in.huawei.com ([45.249.212.190]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1se3oc-0005Uz-6b for linux-f2fs-devel@lists.sourceforge.net; Wed, 14 Aug 2024 02:32:47 +0000 Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4WkBxd4PHDz20lcQ; Wed, 14 Aug 2024 10:28:05 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 3622914037B; Wed, 14 Aug 2024 10:32:39 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 14 Aug 2024 10:32:38 +0800 To: , Date: Wed, 14 Aug 2024 10:39:06 +0800 Message-ID: <20240814023912.3959299-4-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240814023912.3959299-1-lihongbo22@huawei.com> References: <20240814023912.3959299-1-lihongbo22@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500022.china.huawei.com (7.185.36.66) X-Headers-End: 1se3oc-0005Uz-6b Subject: [f2fs-dev] [PATCH 3/9] f2fs: move option validation into a separate helper X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Hongbo Li via Linux-f2fs-devel From: Hongbo Li Reply-To: Hongbo Li Cc: linux-fsdevel@vger.kernel.org, lczerner@redhat.com, brauner@kernel.org, lihongbo22@huawei.com, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Just move option validation out of parse_options(), and the validation logic is enclosed within f2fs_validate_options. Signed-off-by: Hongbo Li --- fs/f2fs/super.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 013b1078653f..8c8cd06a6d9c 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -41,6 +41,8 @@ #define CREATE_TRACE_POINTS #include +static int f2fs_validate_options(struct super_block *sb); + static struct kmem_cache *f2fs_inode_cachep; #ifdef CONFIG_F2FS_FAULT_INJECTION @@ -1418,7 +1420,15 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) return ret; } } + default_check: + return f2fs_validate_options(sb); +} + +static int f2fs_validate_options(struct super_block *sb) +{ + struct f2fs_sb_info *sbi = F2FS_SB(sb); + #ifdef CONFIG_QUOTA if (f2fs_check_quota_options(sbi)) return -EINVAL; @@ -1432,13 +1442,13 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) return -EINVAL; } #endif - - if (!IS_ENABLED(CONFIG_UNICODE) && f2fs_sb_has_casefold(sbi)) { +#if !IS_ENABLED(CONFIG_UNICODE) + if (f2fs_sb_has_casefold(sbi)) { f2fs_err(sbi, "Filesystem with casefold feature cannot be mounted without CONFIG_UNICODE"); return -EINVAL; } - +#endif /* * The BLKZONED feature indicates that the drive was formatted with * zone alignment optimization. This is optional for host-aware @@ -1458,10 +1468,10 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) return -EINVAL; } #else - f2fs_err(sbi, "Zoned block device support is not enabled"); - return -EINVAL; + f2fs_err(sbi, "Zoned block device support is not enabled"); + return -EINVAL; #endif - } + } #ifdef CONFIG_F2FS_FS_COMPRESSION if (f2fs_test_compress_extension(sbi)) {