Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1849779iob; Thu, 19 May 2022 16:41:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkt8bGfQgSGHYt+jVfvmQlKC9DFzltqJ6GAvjX5F0pxdm12wf7k0A/FC4zP4ARHQgWnRz6 X-Received: by 2002:a05:6a02:19c:b0:3aa:1bf8:7388 with SMTP id bj28-20020a056a02019c00b003aa1bf87388mr5985654pgb.455.1653003713727; Thu, 19 May 2022 16:41:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653003713; cv=none; d=google.com; s=arc-20160816; b=RA7LIgt27eJWGAyH6iqMrHjeIAx2LmItRdT+c0veIE22dQl6YrCmmhk0JlGwynaGxD SZcgN01Sxc/VsahJde7bpchk1pBbICJ8SXGY61a3qcwXDvPEq0utugZ0o4GI2h+wq9c1 f5JKveIazEjdZQIYZH4/0/sLzeFGz3Hohob3bufSBqpw39lcsC90FXDFCQ19T120yUF+ 5d7yEe1PIJkANDIRkIwCW7HIrZCuaLACvBlD5g8j1U/3RwpsDnDZyx43KGVED9eU2C4D ft+mBvaxTH/zYhkqjrppY/ZoJFeBsve3qY4aZbN9F1PUbHb4/InzcoRY0GTW+xIocYMt jRWw== 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=zTP1dUhhXgr6bfYtZk6Q9k1WLUg8r58BOVzJFJ5xAOw=; b=0h/PciB31MjPvrkfC1lr/CJC9a3ieH9/EIt9XdFb5jtmaLesw7XMxR42YPbHcqkMJP /l10hex662hzUkGpwo5VoYbMo+wTqXEhP7+uPFoyL47UYbSm2izCtz6wJ/TsHKDRCG2q jDb1MATUx3mWjHocWyNUybQ3QAPKiL34GtKMY77/lzGs5ha8Nxyj7OEqYugbSAmiKe2r zQe5SOl7xW6IKBsTJvNWj1BnsOgJamtet1MNuvIQuDrGOnwEukcpxe8rX+n+Ftm0tjdW x1HvbrjuiSls4tJBqSG7ccxJ4GxDUk9LVO0Mgh2NFQ1m/2NeLz+Y25ay5WmY4WU90xd3 60rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=NnEO+PxI; 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 x2-20020a1709028ec200b00153b2d16513si6644241plo.283.2022.05.19.16.41.31; Thu, 19 May 2022 16:41:53 -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=NnEO+PxI; 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 S244813AbiESUr3 (ORCPT + 99 others); Thu, 19 May 2022 16:47:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244795AbiESUrU (ORCPT ); Thu, 19 May 2022 16:47:20 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 784F5326FB for ; Thu, 19 May 2022 13:47:19 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 27A801F4541F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1652993238; bh=n36NzGnXFuZBQyLINpfVhMRK9nBSM6nyts/SKCy4wzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NnEO+PxIH6oZyD8gQrnTMgLF++/B8xo19SPLELEQpgt2SbkE1ji6ehLtKtmCdO9c0 /2NRhf1PwwCLTQrw1ysVJ1YwNlWp67FFMWxiAILdAxwyWYmQjwK8rE5Bqr8s5HlSUg mSXN5shGSVrKOCL8/qjTFGeoNmhXs3i7HFDNbI/ifSW1g66dIE50R2aLERAwjgHG2k bym7jXn+VZMkHW6SHIlJ5mJAzyU6eVpNYbYT3inLrSB1tHotITCEMC9dHBxOnSZvnM aAT4j6tWGq5QoG2w/kkyoaSH7cL094DgUQ+0/EJw5G3atH4qOzCALkTHUzic+UFn9E zU2ygVbv9LWSA== 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 v7 8/8] f2fs: Move CONFIG_UNICODE defguards into the code flow Date: Thu, 19 May 2022 16:46:45 -0400 Message-Id: <20220519204645.16528-9-krisman@collabora.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220519204645.16528-1-krisman@collabora.com> References: <20220519204645.16528-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 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 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