From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D568C433FE for ; Thu, 19 May 2022 21:24:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245175AbiESVYk (ORCPT ); Thu, 19 May 2022 17:24:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245174AbiESVYe (ORCPT ); Thu, 19 May 2022 17:24:34 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4714AED8C5 for ; Thu, 19 May 2022 14:24:34 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id EDE691F45F99 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1652995473; bh=n36NzGnXFuZBQyLINpfVhMRK9nBSM6nyts/SKCy4wzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m57SytYlEwhPdcab1KEpVPRwn1a1TDYapeVyAn3I1coKDcrrsPDKknqGBaVSesFJY QsDYsAAUIz7UMSAQFigwMjTKVRqChPpFERR/Huowy5aR5n3Brc5F/uvln0TsBHkOoq UiwCN0jZqoJL0QRZUwLHMatZd7u3LppvBpV0VseVLoSlKN7HqiITmlL7FTSWfMREdH UhBkNwKR3CgRKt9NquU854n8ZtIU9BRxHtyl0X6EOj7qo3K5P8BWO+E62QKmBSas3I O6yNZluYGcenYB9d+DeCgO4ls+L1/1CAN8WPcOHl8qJ6anP34+5VCVV2yhRJBBmcOU MpaDo/X0vcOrg== 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 v8 8/8] f2fs: Move CONFIG_UNICODE defguards into the code flow Date: Thu, 19 May 2022 17:23:59 -0400 Message-Id: <20220519212359.19442-9-krisman@collabora.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220519212359.19442-1-krisman@collabora.com> References: <20220519212359.19442-1-krisman@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 24056C433F5 for ; Thu, 19 May 2022 21:24:43 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.94.2) (envelope-from ) id 1nrndT-0006U5-3M; Thu, 19 May 2022 21:24:41 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nrndR-0006Th-IC for linux-f2fs-devel@lists.sourceforge.net; Thu, 19 May 2022 21:24:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=zTP1dUhhXgr6bfYtZk6Q9k1WLUg8r58BOVzJFJ5xAOw=; b=Xa4FOpFS2fztszXfMa+uWgECKl +HGjQ5UvHFKx3LLHnGWD0qEzQxlmXIiceEn7SfbGIgY6tUv8M8Q60QE0ToQC8jeSbYZ2aotozvrVR k9nACbbB+3H/dYdXdSdQIVE752Eakksrc4IwtADRIDpDSzBm/Jf0TZRHlF55/EIwwWoQ=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=zTP1dUhhXgr6bfYtZk6Q9k1WLUg8r58BOVzJFJ5xAOw=; b=Tr/5/Pn0CrI70f743aAHL8MMMo lU4RBGdLIBMQOUUesUZswgIvA5xvAOO/pIlisxT8cUqKjd95qnKkfzqeJdNZNxvsxt6LC+AeBkZ80 mcaHuEO9/0pxy/JOy1M3fFCWWQ2pBgO/CynbdJVpnvExte7SALLVB0jDuyakgiS8W00g=; Received: from bhuna.collabora.co.uk ([46.235.227.227]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.94.2) id 1nrndP-00AbUh-9N for linux-f2fs-devel@lists.sourceforge.net; Thu, 19 May 2022 21:24:39 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id EDE691F45F99 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1652995473; bh=n36NzGnXFuZBQyLINpfVhMRK9nBSM6nyts/SKCy4wzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m57SytYlEwhPdcab1KEpVPRwn1a1TDYapeVyAn3I1coKDcrrsPDKknqGBaVSesFJY QsDYsAAUIz7UMSAQFigwMjTKVRqChPpFERR/Huowy5aR5n3Brc5F/uvln0TsBHkOoq UiwCN0jZqoJL0QRZUwLHMatZd7u3LppvBpV0VseVLoSlKN7HqiITmlL7FTSWfMREdH UhBkNwKR3CgRKt9NquU854n8ZtIU9BRxHtyl0X6EOj7qo3K5P8BWO+E62QKmBSas3I O6yNZluYGcenYB9d+DeCgO4ls+L1/1CAN8WPcOHl8qJ6anP34+5VCVV2yhRJBBmcOU MpaDo/X0vcOrg== From: Gabriel Krisman Bertazi To: tytso@mit.edu, adilger.kernel@dilger.ca, jaegeuk@kernel.org, ebiggers@kernel.org Date: Thu, 19 May 2022 17:23:59 -0400 Message-Id: <20220519212359.19442-9-krisman@collabora.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220519212359.19442-1-krisman@collabora.com> References: <20220519212359.19442-1-krisman@collabora.com> MIME-Version: 1.0 X-Headers-End: 1nrndP-00AbUh-9N Subject: [f2fs-dev] [PATCH v8 8/8] f2fs: Move CONFIG_UNICODE defguards into the code flow X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel@collabora.com, Eric Biggers , linux-f2fs-devel@lists.sourceforge.net, linux-ext4@vger.kernel.org, Gabriel Krisman Bertazi Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel