Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp655226lqp; Fri, 5 Apr 2024 05:16:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUNTHuXmbOuHfq7c793WGz8n2ti4uqGdZ8zSntuXAYMrzB3WT4gt0saWAG5e7exrI1N5qx4HdXfDTWkg/A9VD7tYqsOjAkFcmpDg1LBtA== X-Google-Smtp-Source: AGHT+IGYBL3PeQB028jnCxaDzMs2IV5v9Ph4YkL2CIPxDJXnAAdMcwy4v4HrLm5YKQ86GEyRNAMo X-Received: by 2002:a05:6122:c9a:b0:4d4:1551:6ef6 with SMTP id ba26-20020a0561220c9a00b004d415516ef6mr1438162vkb.2.1712319389309; Fri, 05 Apr 2024 05:16:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712319389; cv=pass; d=google.com; s=arc-20160816; b=o/Tihl55CxaErod9H9T6RIy6NBPVSO4V/ByXER+QClBaZMCgvXHcgTiCTy8emQ4qYL uAhD14UPeBf2+WueouACwRRmOdeKoJN7I1NenFyGJCOQ67WWR5666UVJ+z0UMRLnI/qU jTAhJ+KHma2AoLDzO0dCqF+ysLWayZEh+euEFUs5BcIuRyTV2QT/e7QGjbCgm1rJpIZE /vtxiFHG2L6iWmdXoxr0Bt8bxPIzvJX08FgTSFr9cljq7ZG20kIbliFHGJ+EX/EZbrUi gxlM6t3pBxuOI3krXor27lNA2lx+myL0bFVJB/7xclE1Vcm0J+rbwRyNTwOL4G+wvkyv Ot/w== 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=/ezJxfGYemehzFQ474FDiSGDq/uXRTtZO0VJNVCWpxw=; fh=i4fiMUBCQXbDZMdyre5oEqz49aLUEO6D1+7NN548JDQ=; b=lSOnqc7EunwAVeBObaEo8f1HNWpzn4s1ZY2m43Wv9C88zDWv+uv7KU1kBmrnt/nj2V WN29de+P/u2ZjrqTYk6X2PnehFGBDBc/SDl3qVpuVM0AxliZxHqcAaP1Gyz0EbafsMd7 ESrUjy6t4vBdgbfMeLrsCiGcVzq52KMWq874Vbm+ZPAtQ8fY6pI4P9m09hy9LNYqtz55 JL0gWt+vRrUTNbaYPCrWzA+PtF6cUKKWXbiKuuRn1eZtDnsJufEemd8PFe9wKQBNCi32 qSZ80ArWRNNO5afB4lKGBFTsADyNHTOgjvqX6qogesjHtbugdAV1D4ZCn5zfsX7nHWp6 Uo+Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=RP8DMOuO; 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-ext4+bounces-1893-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1893-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b14-20020a0561023a0e00b00478685f1ffcsi171713vsu.620.2024.04.05.05.16.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 05:16:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4+bounces-1893-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=RP8DMOuO; 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-ext4+bounces-1893-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1893-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5450E1C20DAF for ; Fri, 5 Apr 2024 12:16:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DCF416EC03; Fri, 5 Apr 2024 12:14:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="RP8DMOuO" X-Original-To: linux-ext4@vger.kernel.org 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 11D4516E873; Fri, 5 Apr 2024 12:14:12 +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=1712319254; cv=none; b=GiTG5uXHy9nutcehO/j4LSdPFaQBo9jB00U3pw8OqgUWcyBNnagLcIBUpgY+CERqjbuL2uGTv+SMkfZDqAipOQDTU/KcU7/UzuCw8sGx9VgsqHWYilC6ClBts/tgqcKdobmOuUw4SFuHfbeI5ht1cxaqKCh0pIkl/dd5nN5qbgM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712319254; c=relaxed/simple; bh=HTiihURQJkrf1R4qMENE36JKmwiQmaMABNkIFCv6n/0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MEWdiSoR0+3mHk5CLLDzxkIcmJcwTE47lnGu9x5CT0Q+xVn21Al5eK8DQDpg58fcnGgAdvp6vOnA0MGNAlERoGllMPu+SyOokeNZI7yYJ2VGd9nTsewj0yBz45Qu6rwAcTzHZ8G7cOoJODabo8bGIioh9TaYjdjkuZw1IcIPRNU= 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=RP8DMOuO; 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=1712319251; bh=HTiihURQJkrf1R4qMENE36JKmwiQmaMABNkIFCv6n/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RP8DMOuO94eoZIWw6RKTZw6SpuWp8MEirLCUdsT0mTFbGpDmgn29daN+lX9nf4oot YFDbXUsyXlOo79bYQaMpYCeZrhO03i/NQCXdiDFeKE+LImUgeGfFOdU/9jJ4by2Oe1 umlQ6HOBrveDsnshQGBIbnWZOkIgVemKleji6S6FCulHUOKpc9hVp+CYfIniM6wtr+ k1xcaMCJmreKZBaL3dfGZHjEbR0kdCv31yc0tFDYKupyhAkvdlsKh6QI+a/SjGRSHy qU3MIbfvyJzjkYofy6DuR8WFWp//EktpWO/x3XdB+ytLrk84INDSx2AppZ9wlmojiJ /9kk7zBZEyCOg== 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 63B8E3782136; Fri, 5 Apr 2024 12:14:10 +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, ebiggers@kernel.org, Gabriel Krisman Bertazi Subject: [PATCH v16 9/9] f2fs: Move CONFIG_UNICODE defguards into the code flow Date: Fri, 5 Apr 2024 15:13:32 +0300 Message-Id: <20240405121332.689228-10-eugen.hristev@collabora.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405121332.689228-1-eugen.hristev@collabora.com> References: <20240405121332.689228-1-eugen.hristev@collabora.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. 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 e54f8c08bda8..1ecde2b45e99 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -576,8 +576,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 @@ -586,7 +585,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); @@ -639,16 +638,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 a4bc26dfdb1a..68f3639d9b52 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -311,7 +311,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; } @@ -1313,13 +1313,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.34.1