Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2919325rwr; Fri, 21 Apr 2023 17:05:02 -0700 (PDT) X-Google-Smtp-Source: AKy350aIg6NdWJ5/I6ksUEUp2GToFNKDkNJNlrwYjt1s1B6fTOENfojkboRqO6gQX0y561poYSfc X-Received: by 2002:a05:6a00:2da7:b0:625:ea57:389b with SMTP id fb39-20020a056a002da700b00625ea57389bmr8886490pfb.5.1682121902084; Fri, 21 Apr 2023 17:05:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682121902; cv=none; d=google.com; s=arc-20160816; b=IiiaR94MYhSY0DmhcEEs8iimI50eAOHnY8rd8V/qVJ8z65jc410ug5GgMME7LLARYq cSLjJKXcb3FGt67qmLwffPCmWqxVExLdFakVsFp+tSn1h7mvxW+1QJIjVc5L9dBEb4Xx Qczh7lFXQPnJOORJ4uSxDd5MByEkcbH7r7Ub/LoM42UXJh1yxjygSt7cIgzMQf3d3I93 dA2unTsweHLh49gk1Osj269bInssp24Zk4kd467j0QHFcNRCfXZk+BDPBEPO21MnFm+2 r0BdgguzbU/8YxcxfF7TizojHEgV8lzaBNXFOxOMcJ3oMzAvW68gyxWE5w+717q6+x/j rufg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=YqiIBZMQvLV95BFLfxrctu2be5/KPX/uxRWrEBPqc0A=; b=QQ8TM3Xpwv+x7+p8qp8rPswQg4sgiBdSrzO2j9/zekKM9to3BX+AEqWei2G/WLO4no CVHZuYrZvsSTutFE8wYVdEOVRkJVwMjj8BLOHWv1hjvYewGMGbicfncgLHEKoYWMXcM+ 3v5o9nnFvb52fQDTPxboKRzqd5kdin6NgPlfQFjG8Q0cqFaVtTUdVdH9p71RA8yTaSup VsGnJAMhBUf5oyruw156iyYIMSf71vTT9hiSE9kEr26xfr7Z2+QgjU2YUBRhqXKSyz5n e5mPotAYWx1UMwjzse3M6wDnCfYW6kns/m3pZt3hNuG8k/HfcoKmFQh9uW2O0RDZ0ca6 5Nbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=KImKHUVZ; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i62-20020a625441000000b0063b8685bab8si5407621pfb.229.2023.04.21.17.04.47; Fri, 21 Apr 2023 17:05:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=KImKHUVZ; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233804AbjDVADW (ORCPT + 99 others); Fri, 21 Apr 2023 20:03:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233792AbjDVADS (ORCPT ); Fri, 21 Apr 2023 20:03:18 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CC6C2135; Fri, 21 Apr 2023 17:03:16 -0700 (PDT) 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-out1.suse.de (Postfix) with ESMTPS id D809F21A3A; Sat, 22 Apr 2023 00:03:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1682121794; 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=YqiIBZMQvLV95BFLfxrctu2be5/KPX/uxRWrEBPqc0A=; b=KImKHUVZAOxq5frwDuSjuoEisrZ9H6q/kDQc3aKHPFZBetxORQqSO1UZaFzK0BvYi5IaCw ck67cznjoB4FbpdNQC1Ha+TbT05/HpT7QiX0jd05AxHXf2t5IbXXdJkT4Vcv1MUdz9vGev 0zptOvDKTxocbWPB2VSFq9MzAU0KGKI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1682121794; 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=YqiIBZMQvLV95BFLfxrctu2be5/KPX/uxRWrEBPqc0A=; b=TL6v/tiuEimjyYrmZSB/so8og9fCt0PvRh3wrCTxCyl9pFJIx1+ohWkRvU21WlgvwAt1V4 zYURTAY1vWdgLgAA== 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 A1E61138F2; Sat, 22 Apr 2023 00:03:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 5ATEIUIkQ2TcdwAAMHmgww (envelope-from ); Sat, 22 Apr 2023 00:03:14 +0000 From: Gabriel Krisman Bertazi To: viro@zeniv.linux.org.uk, brauner@kernel.org Cc: tytso@mit.edu, jaegeuk@kernel.org, ebiggers@kernel.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, krisman@suse.de Subject: [PATCH v2 2/7] fs: Add DCACHE_CASEFOLD_LOOKUP flag Date: Fri, 21 Apr 2023 20:03:05 -0400 Message-Id: <20230422000310.1802-3-krisman@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230422000310.1802-1-krisman@suse.de> References: <20230422000310.1802-1-krisman@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 --- 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 98521862e58a..05e4c7019e17 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_casefold_lookup(struct dentry *dentry) +{ + spin_lock(&dentry->d_lock); + dentry->d_flags |= DCACHE_CASEFOLD_LOOKUP; + 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 b6188f2e8950..457345123cb6 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -209,6 +209,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_CASEFOLD_LOOKUP 0x08000000 /* Dentry comes from a casefold directory */ #define DCACHE_PAR_LOOKUP 0x10000000 /* being looked up (with parent locked shared) */ #define DCACHE_DENTRY_CURSOR 0x20000000 @@ -497,6 +498,13 @@ static inline bool d_is_fallthru(const struct dentry *dentry) return dentry->d_flags & DCACHE_FALLTHRU; } +extern void d_set_casefold_lookup(struct dentry *dentry); + +static inline bool d_is_casefold_lookup(const struct dentry *dentry) +{ + return dentry->d_flags & DCACHE_CASEFOLD_LOOKUP; +} + extern int sysctl_vfs_cache_pressure; -- 2.40.0