Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1313384rdg; Fri, 11 Aug 2023 18:12:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE1IBHQThCQ5D72H6iy5aqJS4UEKBxRilpMAFV4r5VW/K3+A+NtRJxFhfNDhrQhbikwcMpE X-Received: by 2002:a17:906:3f18:b0:99c:55bc:3c9a with SMTP id c24-20020a1709063f1800b0099c55bc3c9amr2675237ejj.20.1691802747105; Fri, 11 Aug 2023 18:12:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691802747; cv=none; d=google.com; s=arc-20160816; b=C4FGZBtA6z9nDokJRAcKg9ZRkW4SyWtPnIJC3REcQnFyEpDoW3IhZG5eCOgNj+hQGv 83aAKnaisamU9WBZS8LUKAeNPlQRtWlbBr8D6ls6L0kOcNIVr/ItzDCvH7fsk4FlLbSo WvkzhwrHDjP30iwAcZgGD/vyKxQhOjDijOvl/xvw9j8va0TqQB7j9vQeScArhliMaLHX N6CH4tmw48N2jAU6SN4vN5Fze9co0hZ9+uqSrOAxArJH18vSEfQO1mXbYkzhijfHMyf5 a6T4yelUcBzyhL7P8yX5oCX9yfJipMgXDLnk3UvDQUEAGRDzeEwDbCwfS/BVHF/trQ8U 9PIw== 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=9oCLm5O/TfEzHLI4v9CFF2If6jDnpmsmOxID/3lxDto=; fh=HFDFbc5lRXwuu0vgGURCiLYm5ywsvQKdSNBX4pGxTs4=; b=J4j/7TOFYZWDerc3He4tMHd22RlV71gxads8X1J0VJlcKuXcpyTO0xRau2eXUgejsx 1yOVcAnwQZzZyZ9HhnD5HkP9tVjqqISTF1p5tuddOOAxy4WQnYwujyFsuezoJqgK6oKc bm4Cum7sKJp4hCclP8Jnd6FdNB1WC3LTRbchiXA8P/ifwfaTtI9iu7ShxZ5YRtBWNVib i0cylQyKBqEn/M2ejqn4qYnr5a5SPSJzvBRu5gU349KLLUxLufSyDVq2mMS+8BsjF/Nj 0TrnvBn5IAPP1wJjrIt0fP/SehXt/ap0uCeNcBg6B9cgZnuSTf5ATlqwmCoeM6WqjL1R pqQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=z6Sp2GC8; 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 a9-20020a1709066d4900b009665172f30esi4382425ejt.876.2023.08.11.18.12.03; Fri, 11 Aug 2023 18:12:27 -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=z6Sp2GC8; 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 S237239AbjHLAmI (ORCPT + 99 others); Fri, 11 Aug 2023 20:42:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237190AbjHLAmE (ORCPT ); Fri, 11 Aug 2023 20:42:04 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A42213582; Fri, 11 Aug 2023 17:42:03 -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-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 Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Gabriel Krisman Bertazi , Gabriel Krisman Bertazi Subject: [PATCH v5 05/10] fs: Add DCACHE_CASEFOLDED_NAME flag 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,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 --- 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; -- 2.41.0