From patchwork Sat Aug 12 00:41:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel Krisman Bertazi X-Patchwork-Id: 13351621 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 5A65CC04E69 for ; Sat, 12 Aug 2023 00:42:23 +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.95) (envelope-from ) id 1qUchy-0001O9-HC; Sat, 12 Aug 2023 00:42:22 +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.95) (envelope-from ) id 1qUchr-0001Nf-FY for linux-f2fs-devel@lists.sourceforge.net; Sat, 12 Aug 2023 00:42:15 +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=9oCLm5O/TfEzHLI4v9CFF2If6jDnpmsmOxID/3lxDto=; b=CXWs2fau3/d0jKw/0RucqEClur Zbh2+4O/boyA26fWDKNSlmpJupKtckwK6HvRxJlG0SiXFyPqb8qajB98bPQUDdGfv9eq4A6eS9JVm XjwsXIeD9KunI6zItlccNBVDrZ1ptH9F99YFrcbiaiGpKdnijuMf5Iepr/5IvPzGQINI=; 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=9oCLm5O/TfEzHLI4v9CFF2If6jDnpmsmOxID/3lxDto=; b=LqzuKEEpMBOe8kz5juX5CXf1e+ lq2+/vL9qlqb+2436tGvYRQKl6h5icoZHY/e6x/7H/Pm1X37y2a2qwIW6fQ812r/UGYLvi2Klzfpu TOZQpyQqwLC+HLw+enR4Ll0vBbxyKW27+mO9tX3p6LWmDlVZtBIdLJRQrB8PFnOiCQEk=; Received: from smtp-out2.suse.de ([195.135.220.29]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1qUchk-0002eI-L4 for linux-f2fs-devel@lists.sourceforge.net; Sat, 12 Aug 2023 00:42:13 +0000 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 68EB61F460; Sat, 12 Aug 2023 00:42:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691800922; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9oCLm5O/TfEzHLI4v9CFF2If6jDnpmsmOxID/3lxDto=; b=z6Sp2GC8+jBUk4Xx/A77FekdsXw0LySonxn/vojNIRs8+QDJ3peu6XxH9Z0DFa3dgM1R2p WuecezI0IXifkVqSKW/OcTMwPsEawf2PMfFdc/ynwnn7DaMoilA0/be9ywUHwZcXVyxfSb V0lKoKwDpEdwEGvObRc2J3gLS0G5Mew= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691800922; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9oCLm5O/TfEzHLI4v9CFF2If6jDnpmsmOxID/3lxDto=; b=RVwQwTMRI2YS7bafrUHDV4SStZsR5/eJYZVYF02/jr6Kw/TxjEdUBYlMJieDgSUXM22ayd L44McZvMY2uGN1AA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 31A0113592; Sat, 12 Aug 2023 00:42:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id jYNIBlrV1mQZEAAAMHmgww (envelope-from ); Sat, 12 Aug 2023 00:42:02 +0000 From: Gabriel Krisman Bertazi To: viro@zeniv.linux.org.uk, brauner@kernel.org, tytso@mit.edu, ebiggers@kernel.org, jaegeuk@kernel.org Date: Fri, 11 Aug 2023 20:41:41 -0400 Message-ID: <20230812004146.30980-6-krisman@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230812004146.30980-1-krisman@suse.de> References: <20230812004146.30980-1-krisman@suse.de> MIME-Version: 1.0 X-Headers-End: 1qUchk-0002eI-L4 Subject: [f2fs-dev] [PATCH v5 05/10] fs: Add DCACHE_CASEFOLDED_NAME flag 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: linux-fsdevel@vger.kernel.org, Gabriel Krisman Bertazi , linux-ext4@vger.kernel.org, Gabriel Krisman Bertazi , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net From: Gabriel Krisman Bertazi This flag marks a negative or positive dentry as being created after a case-insensitive lookup operation. It is useful to differentiate dentries this way to detect whether the negative dentry can be trusted during a case-insensitive lookup. Reviewed-by: Theodore Ts'o Signed-off-by: Gabriel Krisman Bertazi --- Changes since v4: - Fixup names of functions to reflect flag name change (Eric) Changes since v2: - Rename DCACHE_CASEFOLD_LOOKUP -> DCACHE_CASEFOLDED_NAME (Eric) --- fs/dcache.c | 8 ++++++++ include/linux/dcache.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/fs/dcache.c b/fs/dcache.c index 52e6d5fdab6b..269367c1a86c 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1958,6 +1958,14 @@ void d_set_fallthru(struct dentry *dentry) } EXPORT_SYMBOL(d_set_fallthru); +void d_set_casefolded_name(struct dentry *dentry) +{ + spin_lock(&dentry->d_lock); + dentry->d_flags |= DCACHE_CASEFOLDED_NAME; + spin_unlock(&dentry->d_lock); +} +EXPORT_SYMBOL(d_set_casefold_lookup); + static unsigned d_flags_for_inode(struct inode *inode) { unsigned add_flags = DCACHE_REGULAR_TYPE; diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 9362e4ef0bad..ccbb5c4db7ce 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -208,6 +208,7 @@ struct dentry_operations { #define DCACHE_FALLTHRU 0x01000000 /* Fall through to lower layer */ #define DCACHE_NOKEY_NAME 0x02000000 /* Encrypted name encoded without key */ #define DCACHE_OP_REAL 0x04000000 +#define DCACHE_CASEFOLDED_NAME 0x08000000 /* Dentry comes from a casefold directory */ #define DCACHE_PAR_LOOKUP 0x10000000 /* being looked up (with parent locked shared) */ #define DCACHE_DENTRY_CURSOR 0x20000000 @@ -496,6 +497,13 @@ static inline bool d_is_fallthru(const struct dentry *dentry) return dentry->d_flags & DCACHE_FALLTHRU; } +extern void d_set_casefolded_name(struct dentry *dentry); + +static inline bool d_is_casefolded_name(const struct dentry *dentry) +{ + return dentry->d_flags & DCACHE_CASEFOLDED_NAME; +} + extern int sysctl_vfs_cache_pressure;