Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp7251107rwn; Tue, 13 Sep 2022 17:04:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR50V58+zRwjz6REclc986QhYZWYEhV6Oudo+WkNFdLnKBUuG86J4AAIzZ71zQ9CxKqN4fYv X-Received: by 2002:a17:906:fc6:b0:72f:d080:416 with SMTP id c6-20020a1709060fc600b0072fd0800416mr23862761ejk.1.1663113873645; Tue, 13 Sep 2022 17:04:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663113873; cv=none; d=google.com; s=arc-20160816; b=a2HI2N+MjVom98QDR/LRTOGasL2Im+QpLlSsGNdhsk0mpbBzbOI3siWecw1H7/gPMY BCoau4c3XPOw3ra/lHGhVI6X64m84nSyQZJXiqDLR4oTmNV9vxkbVFHoBy+JCgLMvD0j 4sAhPKrTEp5+bWch1Obv2kiLEjL/Ws3+Eqhy0xjFmzCKJ7Ybh6yHjDtGQmchvpM5pxvB 0IJXko63chBImKGx1SeUrw6MbDFJNi5qHetsTuSBP+rAFul2I4ysLWSVieNc8MQVwyNS q/JM6lw5V7E4A5LVInt04QSw30NV85WuOH63k6TVmmyT+Ovth7jQ/hERQ7huDrmVPa4Q qmAg== 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=QCj8y9iGacZibm/o3SQEwfd6D69exr0yb14wndFXBOM=; b=Z0buaAOvjFADyiaq8H95kF89S1ESYF6vjBIlMOKO2vompT4i980HtSVNs7YJh9stKN m+NMfyS+/L8QU8Dr8e88W6LTJ902T1xPKDtp+HmSvh0CJH0nHM9J92yOqq0B+c6smsK5 YtFc2meMIcw1ItYsNCn+FyVlT/e2RW1WJqJoheBOHcBJKYkv2BPH33hhdKS7WaxIPTmy rqCNnU0Xk345c4MTQ/MwygVUr4aOVe0sjZIiTdyh/OIq5xxt5PlU9/xV5lNfTZrhvPkt uj5Y+TvQ1lR8pdzRI752pWAH8jxgPtprDZCf2Z4JPCIaf8xrokQ5kTtxZRWsyZcq1ZKw GnGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=cPPc7Pa0; 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 o26-20020a17090637da00b0076f0a8679ecsi9371328ejc.875.2022.09.13.17.04.09; Tue, 13 Sep 2022 17:04:33 -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=cPPc7Pa0; 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 S229585AbiIMXmh (ORCPT + 99 others); Tue, 13 Sep 2022 19:42:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229824AbiIMXmd (ORCPT ); Tue, 13 Sep 2022 19:42:33 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3D8752FE8 for ; Tue, 13 Sep 2022 16:42:32 -0700 (PDT) Received: from localhost (modemcable141.102-20-96.mc.videotron.ca [96.20.102.141]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: krisman) by madras.collabora.co.uk (Postfix) with ESMTPSA id 5728F6602033; Wed, 14 Sep 2022 00:42:31 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1663112551; bh=MZQbRUazF2vg4Tg978XNZC0bZGGWs1+KayZdfr4nmDg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cPPc7Pa0OPPQPm+v7ijRy+jPvVM8ChYaO0lb96yEtuq6kvBzPggB1gapwJF+7pJfr QclxIPGpEyHXcm0XyxNuJQM/sktZsQeWHH8VOsWHON/OfYe7XW1hBypf+3sGgW9nse vNDXJ88EBv8TCXcGwl49ArCU88wfCXlklKqk7FXldamHsY8JExEcfIF6TlYuuVpACu jA59parZn6SVCDJl/dLgN0NS+bEsG1vj3/50HXRacKA6PrlK6fNsW7e5lHLb1IH6gA kfocSlUWDrOPf3mzLwWOWK48I9u42LtjrobkEGhyjV1x20douTORMUEYKfZFfMGHiA eAplXxelPhmsw== 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 , Chao Yu Subject: [PATCH v9 8/8] f2fs: Move CONFIG_UNICODE defguards into the code flow Date: Tue, 13 Sep 2022 19:41:50 -0400 Message-Id: <20220913234150.513075-9-krisman@collabora.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913234150.513075-1-krisman@collabora.com> References: <20220913234150.513075-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_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Reviewed-by: Chao Yu 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 bf00d5057abb..46325cac4fb6 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -571,8 +571,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 @@ -581,7 +580,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); @@ -632,16 +631,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 2451623c05a7..636488d65342 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -284,7 +284,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; @@ -1273,13 +1273,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.37.3