From patchwork Mon Feb 19 07:44:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 202931 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1136028dyc; Sun, 18 Feb 2024 23:52:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWZH2Zrr2cHf5f3+G3/nPbVm0/AgoSRAD87UQg+7fsRtQc+PwsMrLolIHuEygf2JyEcM0vIqvegp/hmOau5cMoxBxyx9A== X-Google-Smtp-Source: AGHT+IFTH7FH6Z2vOQPLN48nf2uBNd5dZgmSWNFz3rlSYWkmW5Bdl4Yd4yNn5UfzbuJQ6f/6Dd1D X-Received: by 2002:a17:903:230e:b0:1dc:248:28e6 with SMTP id d14-20020a170903230e00b001dc024828e6mr805833plh.67.1708329158162; Sun, 18 Feb 2024 23:52:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708329158; cv=pass; d=google.com; s=arc-20160816; b=ET/3mS6FOslgAVc+RJ+yJ0Wvnpwe5h+ukvUMPp2Pbph/RFebu+r60OIWqSuDgyXiKD MnyTehWbTTBMb4zI6mx5/CdjpYI47l51hfuhPGcb14akNCZ7H0tVnExcnqLt//HNJQi4 3yYYihrYXp8jmUaTM3J3Lg7QuSZCP1Y9Znyic20No4uionL7ZRm73OpGqoKgfleCKnMN EkgrM2nl5Q/ix10rG3inZwSMpYeWwqNYl5fY7f28TZYJo9qkJt9z+qbsmpNcJDYC30Ba dHmnpED8rQfdYYVk81333nZUuwhgEJT0uikQLhG6HwyBu+z9X5gonfyfFcqDmhWAPkbg 9H7Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=z/SBBNB2BmDGSCUdS+DWjObbKH1XusfBGNWAepodCdA=; fh=YX4HbHS7wMJfdu6Xp+2MgHIyDiEardnLcvtWgzaTy/w=; b=W/DI96zf+/ImCdPK0MvNijiN6d/NSW6fpbRSbdr12U2d3vEDsLucKEnWFc6sVELHJl RahcRRFVS1q2lXtWH77JVzsYBiupVe/02KxzaEQh0mxrDV0oWfZ2HWP/FBGrihycD91y T1Fzqlr9PRXaKPYfKVFc/YgQir30IoiK6Lnz+6E2J8G71darfVLYEMdVvnTZticrDCZf AWxCPGlv5t9+E8u3IVISInp7CjJvxdXxN4ML3t105xzmAm+mT+di+Qr7o26ymRy/UJzk cjruumxi2APmWQakqfirBnWGloGNn08NSc+PST/NRt2zDHHtTZ8glJQvpanBRKxInEVV IlVw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=BS2A+tGl; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-70859-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70859-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id v5-20020a170903238500b001dbcc32fcc4si3279027plh.466.2024.02.18.23.52.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 23:52:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70859-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=BS2A+tGl; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-70859-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70859-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 578FAB230CE for ; Mon, 19 Feb 2024 07:48:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA60128DC6; Mon, 19 Feb 2024 07:45:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="BS2A+tGl" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7931286AC; Mon, 19 Feb 2024 07:45:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708328748; cv=none; b=iTW1qC8YUM3Ss+rVRXI27bTqtT+rnLyaf02XMqrdujsuIylslTo/Vhvr5gW4yDog9x6823RNI0blYxWX5sM8PKC8priWJvngaeJ6yq2L94Do5wul7R3/jw1D1W263oYeO4MQa3k4qQdjkwIRH6y9UVCtLc5WVSZlIcA1+gzfusQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708328748; c=relaxed/simple; bh=PJX9nxRLEeoQwdUnmOqN3H2dctwppjpelMENczAYtJo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PcSZJcmXAJBSNsPBFgLiDE6l3wUwAezttQn53cWvOHEI8BWIqCKI4JBHQ1TNwzYXHNc5ER3jUH8FnNGnGUgKsnp3k6CzW6I2FyTBWEg4zw1VfcU5uzZwVSOJ/F2svuQYLFY+9Pmyx5zBV3Butj9oXBI4XCQpHIzxbGzxJFMhHpg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=BS2A+tGl; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1708328745; bh=PJX9nxRLEeoQwdUnmOqN3H2dctwppjpelMENczAYtJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BS2A+tGlyrlXhAMVAAqIP9FMTpGAabNIJMqExmdQc6ch0HMCeFPA7fPrAA7/MFYRZ is/znYhAW+23oSaFZ/76fl32JOqAhJuCpAarw6VJDGdNDzHbVW+m2ZOtFBtQf1r/7q ZDwFDQh5mNYydk8zOcFfGSt9rNA0kyu4IV5nJF2xAuvM7TKUw2eQLqWLxUcMXj/p3Y yTs8FSll/a7uFqrYvCgnjfE06iDRLIp3Rpo+WGEq6YTdJ30od8oZglKoU5ya1Qwsx/ Qn7zd6QEECx2FXgOxplbcu5G1HDLfSwYOcPB/2/cpUjZEECMKtFjR4fPj00ACaWmYR Tzg47AFqJtutA== Received: from eugen-station.. (cola.collaboradmins.com [195.201.22.229]) (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: ehristev) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 2859B37820BE; Mon, 19 Feb 2024 07:45:40 +0000 (UTC) From: Eugen Hristev To: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, jaegeuk@kernel.org, chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel@collabora.com, eugen.hristev@collabora.com, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, krisman@suse.de, Gabriel Krisman Bertazi , Eric Biggers Subject: [PATCH v11 8/8] f2fs: Move CONFIG_UNICODE defguards into the code flow Date: Mon, 19 Feb 2024 09:44:57 +0200 Message-Id: <20240219074457.24578-9-eugen.hristev@collabora.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240219074457.24578-1-eugen.hristev@collabora.com> References: <20240219074457.24578-1-eugen.hristev@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791312955405261147 X-GMAIL-MSGID: 1791312955405261147 From: Gabriel Krisman Bertazi 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 [eugen.hristev@collabora.com: port to 6.8-rc3] Signed-off-by: Eugen Hristev --- fs/f2fs/namei.c | 10 ++++------ fs/f2fs/super.c | 8 ++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index ba11298b7837..c317bfd1c344 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -577,8 +577,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 @@ -587,7 +586,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); trace_f2fs_lookup_end(dir, !IS_ERR_OR_NULL(new) ? new : dentry, ino, IS_ERR(new) ? PTR_ERR(new) : err); @@ -640,16 +639,15 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) f2fs_delete_entry(de, page, dir, inode); f2fs_unlock_op(sbi); -#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 + if (IS_DIRSYNC(dir)) f2fs_sync_fs(sbi->sb, 1); fail: diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 1b718bebfaa1..07c54981cb6b 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -312,7 +312,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); return f2fs_cf_name_slab ? 0 : -ENOMEM; } @@ -1360,13 +1360,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