Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp155200rwb; Thu, 27 Jul 2023 10:40:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlHQ2Z2QrMlKucXQ6KHlJKi9a854QRtVZ+fn1ZtALKzXrS+t3nKU2L32UYImVtSTU885rjJE X-Received: by 2002:a05:6a00:1589:b0:679:9639:1f6a with SMTP id u9-20020a056a00158900b0067996391f6amr7221876pfk.14.1690479627737; Thu, 27 Jul 2023 10:40:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690479627; cv=none; d=google.com; s=arc-20160816; b=ld6XxjaBykQs8efw1WIJdmmgItemEHZhv+LT2egtlhxzijLlsKMDR4ADhwtlfX56Nv o7IYCPnZ4pRRiTyq0YEbqZiCJEWmzNTj3sB2ALGJDkf73eILf9etDcgjO+7LcioOKRKK t4vf9bEFyVM3ppq2TOBDT4cRVhQoO8tgGVLHbb53gtUKWneTlTWeQA43z0PayWio9Lw9 OLjSmT4LHkI8oriNXteX7MAU5XRc62E/Hot2CrPoe+vtD4cW0Lt5g3NeqeFMijcXIWkq u+KpvrlhuAWmmTFqITCW7FNiYErum7jbxHsd2VQ98jcUIUAw+Oem9zHQLfp2vs9wukfC hxqw== 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=Fw/NYpjSy+0nTfiVyMLNRxLrMsXbdIWyk8rDJ16hgls=; fh=HFDFbc5lRXwuu0vgGURCiLYm5ywsvQKdSNBX4pGxTs4=; b=T/HC1MbyK86bFsJ+32EiWgs+OE+b9k9RW9Lf9D/pMb31bFN5XAiAZzdTorM+RPPaMn gpach7V+OH2/K2GnoduaAfa3DfhRcdKpSHOBQ3aphBugQEvFJQ6SFAHmT6W06zGBz/qw ACiOQD/4fgDB9Ti9ZMImx+njggyGxZElsWZyfoTaa6a/uAaJORQsI4OjZyreEXK4M7VX MGOQEgKiLG/rmLql4913PVHjSP2Rj6fLMMKFnf+hN3sNWI09fEGBeuzIGBNCUdxlo7Gq zt07gx6vXGH8sOCIhxi6KnE/90mBFLNEluSweK7/gkq3Ym//ngX+luq/YIozPLrLssNq fZFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=u8HWGzcK; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=1WuPKiFI; 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 194-20020a6300cb000000b00563dd9b6da6si1469526pga.718.2023.07.27.10.40.11; Thu, 27 Jul 2023 10:40: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=u8HWGzcK; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=1WuPKiFI; 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 S230064AbjG0R3B (ORCPT + 99 others); Thu, 27 Jul 2023 13:29:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231916AbjG0R2x (ORCPT ); Thu, 27 Jul 2023 13:28:53 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C99922D67; Thu, 27 Jul 2023 10:28:52 -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 5124221A9B; Thu, 27 Jul 2023 17:28:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1690478931; 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=Fw/NYpjSy+0nTfiVyMLNRxLrMsXbdIWyk8rDJ16hgls=; b=u8HWGzcK3YEQ8BuWy1kNg7F+QEuwZUtN2Jdyqo7p6n31i9vu9BK/slAL+iN7FG0VluMr/1 doYfJF0VnQkahJyvgp2T8DrB0HFAydmtrMD5zPB+jjF2IH8B72XmZ72dACQOAgtmy780H7 JCu/AS7yl7hBLHESPkGTGIJq8VoxByA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1690478931; 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=Fw/NYpjSy+0nTfiVyMLNRxLrMsXbdIWyk8rDJ16hgls=; b=1WuPKiFIfsKawmQAZnWIYNFRdcD6uuDpx3+xHoCRgK2ctdPkefDwOPN91/axvzOPuiWS+7 L6wJCyvsiKyg/CBA== 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 1972413902; Thu, 27 Jul 2023 17:28:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id LqqFAFOpwmTGaAAAMHmgww (envelope-from ); Thu, 27 Jul 2023 17:28:51 +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 v4 2/7] fs: Add DCACHE_CASEFOLDED_NAME flag Date: Thu, 27 Jul 2023 13:28:38 -0400 Message-ID: <20230727172843.20542-3-krisman@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727172843.20542-1-krisman@suse.de> References: <20230727172843.20542-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 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 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 98521862e58a..5791489b589f 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_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 b6188f2e8950..14aa0255bd04 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_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 @@ -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_CASEFOLDED_NAME; +} + extern int sysctl_vfs_cache_pressure; -- 2.41.0