Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1173682iob; Thu, 19 May 2022 00:29:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzggYLX6MCTW3rUpp6DbML9C4sp2XJV+7VDK7AFIhY52OVTML1QpTkwae0l5sU5vBVrF6Jj X-Received: by 2002:a17:907:c0d:b0:6f3:ed89:d9c with SMTP id ga13-20020a1709070c0d00b006f3ed890d9cmr2914579ejc.502.1652945375949; Thu, 19 May 2022 00:29:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652945375; cv=none; d=google.com; s=arc-20160816; b=Mj2VwznpaZm4VTQ9g6Fhr1BsWsDXqcCLKXYXHQ2+sbjQx99dTEe0YGeoaRCoAdkFz3 8f97fPc4Mten/6lZSr6snHACnKh6pD13JkPhwOtshgHxOyfWXDWzgdz0ZORd3xNjnjop ENH8jTrGq+tcO7lDDwq0q2Q6nCiJPVeRMJyGZ3QK3/NXkcx27qvAG7ty6FQwYNETEyiB APkQTT4DJNfIBvEJCQNSfklasYVs+/M2ZBGhRC2+0oI/V8uYNFH8iqta7XMRrZOwSahf RCMGjUb5yeQM6O8VZogKG+I4GIRAFjzezheYXv8jllRdLnpyZQWk453/bqcwiaG2PK1F KpOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8tCoJ/dSB2Ue2RsEwrMKt7QEF8ASr9sl2Eccv3XzWOM=; b=tIGFnHbtMlpq+G3Orq4JFgtu9lOLtKOvpZPX6hmS1v9Anlww14no6ynFvqWXlv1pRY /xTtYURWs4XcVzpkEWL7jILKJHSiEac15YecNKdRgpWsWTI2ii6AOIcrRgBB9ctqz0Bi RGf8wivITlzvQC8nUnir6wZSxycYyX58fFfdEZiEnstOIq2lMpqKWoJkz5CdM1HUJ3wr UU+Grys3necSr3rbzlCio9VCNtBxibS4Vhp9tKVmpZMGry4XYvPzpR0+NXfx0d/RNAEn HhHAZ8iCj92k456Sx0AXnU3Sz60nTCQw429vps4CNCyYWGeF6pfN2QnvJstdxnIZ+sJr njDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=AzdlUusc; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s21-20020a1709060c1500b006f37bde5a2csi3699317ejf.693.2022.05.19.00.29.11; Thu, 19 May 2022 00:29:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=AzdlUusc; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232489AbiESBlt (ORCPT + 99 others); Wed, 18 May 2022 21:41:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232555AbiESBli (ORCPT ); Wed, 18 May 2022 21:41:38 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E0BC8AE46 for ; Wed, 18 May 2022 18:41:30 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id D733B1F4542F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1652924489; bh=lVxCi2vcBawXM+9LvQgMSIUjo3YYqafepE8JNRdl2/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AzdlUusccC7kY4mQcr7yY8vgR3r9vYijVlTfpyc7aQReTSLla8k9EJN8mTUkGnpms JoQ+fW7e5kcAxzRl+arsUrFu5LX54rJMoSg96r9MPVjQYTvT1UEcRHO6aPKqnFANv6 gzhkqGa4ptCpDJgbpuoAcb9e6wr1tZSAJbFdE6XzXQ6Vud74NiiEp1t7HdrsmvpBZC Rqy6EDezKEaKVEAcYS6ibMZQ2daZ39FCVhb6Idmat2jEtmr46QnbUoFwwuoDXSgcDk L8RTarv8e7jYyp8L6LLM6NGLGNt4I+g2U+V+qyFHv1vQ6IN+kYoFK8VIYUpaaMNh4G TIX4tLmX2Lb/A== From: Gabriel Krisman Bertazi To: tytso@mit.edu, adilger.kernel@dilger.ca, jaegeuk@kernel.org, ebiggers@kernel.org Cc: linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Gabriel Krisman Bertazi , kernel@collabora.com, Eric Biggers Subject: [PATCH v6 8/8] f2fs: Move CONFIG_UNICODE defguards into the code flow Date: Wed, 18 May 2022 21:40:44 -0400 Message-Id: <20220519014044.508099-9-krisman@collabora.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220519014044.508099-1-krisman@collabora.com> References: <20220519014044.508099-1-krisman@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Instead of a bunch of ifdefs, make the unicode built checks part of the code flow where possible, as requested by Torvalds. Reviewed-by: Eric Biggers Signed-off-by: Gabriel Krisman Bertazi --- Changes since v4: - Drop stub removal for !CONFIG_UNICODE case (eric) --- fs/f2fs/namei.c | 11 +++++------ fs/f2fs/super.c | 8 ++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 5f213f05556d..8567a9045df1 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -561,8 +561,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, goto out_iput; } out_splice: -#if IS_ENABLED(CONFIG_UNICODE) - if (!inode && IS_CASEFOLDED(dir)) { + if (IS_ENABLED(CONFIG_UNICODE) && !inode && IS_CASEFOLDED(dir)) { /* Eventually we want to call d_add_ci(dentry, NULL) * for negative dentries in the encoding case as * well. For now, prevent the negative dentry @@ -571,7 +570,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, trace_f2fs_lookup_end(dir, dentry, ino, err); return NULL; } -#endif + new = d_splice_alias(inode, dentry); err = PTR_ERR_OR_ZERO(new); trace_f2fs_lookup_end(dir, dentry, ino, !new ? -ENOENT : err); @@ -622,16 +621,16 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) goto fail; } f2fs_delete_entry(de, page, dir, inode); -#if IS_ENABLED(CONFIG_UNICODE) + /* VFS negative dentries are incompatible with Encoding and * Case-insensitiveness. Eventually we'll want avoid * invalidating the dentries here, alongside with returning the * negative dentries at f2fs_lookup(), when it is better * supported by the VFS for the CI case. */ - if (IS_CASEFOLDED(dir)) + if (IS_ENABLED(CONFIG_UNICODE) && IS_CASEFOLDED(dir)) d_invalidate(dentry); -#endif + f2fs_unlock_op(sbi); if (IS_DIRSYNC(dir)) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index baefd398ec1a..b17bd7a70d53 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -283,7 +283,7 @@ struct kmem_cache *f2fs_cf_name_slab; static int __init f2fs_create_casefold_cache(void) { f2fs_cf_name_slab = f2fs_kmem_cache_create("f2fs_casefolded_name", - F2FS_NAME_LEN); + F2FS_NAME_LEN); if (!f2fs_cf_name_slab) return -ENOMEM; return 0; @@ -1259,13 +1259,13 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) return -EINVAL; } #endif -#if !IS_ENABLED(CONFIG_UNICODE) - if (f2fs_sb_has_casefold(sbi)) { + + if (!IS_ENABLED(CONFIG_UNICODE) && 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 -- 2.36.1