From patchwork Tue Apr 2 15:48:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 1918921 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=ojBkiOGE; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=oauy=lh=vger.kernel.org=linux-ext4+bounces-1834-patchwork-incoming=ozlabs.org@ozlabs.org; receiver=patchwork.ozlabs.org) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V8C6x5HPpz1yYw for ; Wed, 3 Apr 2024 02:51:53 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4V8C6x4r8Rz4wd7 for ; Wed, 3 Apr 2024 02:51:53 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4V8C6x4nDyz4wyY; Wed, 3 Apr 2024 02:51:53 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=ojBkiOGE; dkim-atps=neutral Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.80.249; helo=am.mirrors.kernel.org; envelope-from=linux-ext4+bounces-1834-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by gandalf.ozlabs.org (Postfix) with ESMTPS id 4V8C6x0S8mz4wd7 for ; Wed, 3 Apr 2024 02:51:53 +1100 (AEDT) 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 6B3241F22D57 for ; Tue, 2 Apr 2024 15:51:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D31B413C67C; Tue, 2 Apr 2024 15:49:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="ojBkiOGE" 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 02DD0139585; Tue, 2 Apr 2024 15:49:00 +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=1712072942; cv=none; b=OlqFKJeIx9EmF4ZxMaixRgciEEVqsGtAz8rrojGARjAAoYZrzmkSViWZKECp20ucUCXRtV8PmeqSG4znX1PpMzZgejeqtSO419OYzFuEF+iAV8bLgFVZDZRyeO2QeVFWdJ6F8lfgy5WjZm8ciFDU90wGQ9zswI00kO5dC/mCXDk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712072942; c=relaxed/simple; bh=NYwDnN28mEZsfcXBv2JU5FVxAioxdPfAjfdUmE66h5Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kqvJNa8xSzhVqWq4Z/1eaFVzm1/VKAorNEworZ6OU/ep+XdI1i/4W02LtdanC1ZCzNA/JTGglNVKhY4Q1pM/M4OTgi1WQLLoV5zo5nleQ4xx/f1iIWXVMWxVDS4oHm9uGjVZptuLNc7kqq8LGpma1+8N9ope3PXIZGLDEKg0vdU= 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=ojBkiOGE; 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=1712072939; bh=NYwDnN28mEZsfcXBv2JU5FVxAioxdPfAjfdUmE66h5Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ojBkiOGEd8EryBXKAd1A3l+NAwTMwOHa6mKZLdO8lS5qjUHZhyZCR6XBbQ9y43WN/ GRxroD/u5YECm9ZHmyi4n23vp3p6mdumSQqQq/drrpVQFokwZlkP6GhtLk62oBDxMe AOY6bRpu0vJoL75ZYoNv1To3WBxNDEl9xUc9fPbQJA4XHnJZ0K3czPpt9oroMH/aGz WlhHmyQRtMLKerwc9F2+k91p56aT/kHBx2Qx5gQpI2RMv+st5DaC1n2U2t6qsahW28 pzuMV6Mka7xjfWcn/kELQpIyjUi4KffCOabcFge2nUm0IFDtM6sU7uHvni4mQOZgB/ FpdkZ+bOeJR1Q== 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 51E52378212E; Tue, 2 Apr 2024 15:48:58 +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 Subject: [PATCH v15 9/9] f2fs: Move CONFIG_UNICODE defguards into the code flow Date: Tue, 2 Apr 2024 18:48:42 +0300 Message-Id: <20240402154842.508032-10-eugen.hristev@collabora.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240402154842.508032-1-eugen.hristev@collabora.com> References: <20240402154842.508032-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 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 f7f63a567d86..5da1aae7d23a 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 313024f5c90c..c4325cc066c6 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -306,7 +306,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; } @@ -1354,13 +1354,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