Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1509901rdb; Wed, 24 Jan 2024 19:13:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IGtO8yt0Ea9+u6soGItnaT4xopPhM+cnYh8b4NWy49G4L9WNcu6v7hP86Yjtqe4ty8NdEhL X-Received: by 2002:a05:622a:20f:b0:42a:383b:419b with SMTP id b15-20020a05622a020f00b0042a383b419bmr459652qtx.77.1706152383294; Wed, 24 Jan 2024 19:13:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706152383; cv=pass; d=google.com; s=arc-20160816; b=n3Zoe6dE19r5F7V+FPFRXF7gp7qD8DrjwCNVB68uXytzUo6G72PLlZfgque5CSw/6/ 6hW5wtpuVDhpwsB2kQV6m56aLxlWgw58Bo8VgKQa7kYDnVf6QTPfnzLBrp2g4jUIngk8 W3o8lpRl7McvWWkANEi+oOgQ+xj/aSuo6UI07eE53NeapaQvcjGNZXmUYl+ylBlQsPwr AiZg6XH1Q5FAukRGmOWtNd0nhMjPl46fowVVgQO0D+cafUYnU31vfwCCDQikKipaOmlE AuXBOgA5B2zJAH/ETb3KyZaQl56g9cln+3kO5lCdv9PGdBZgHHE4ChxXPMRX4sVAkJuu ShsA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Ltawi/q+QwKIc79Ljr+y1UlrS+n25loM4V01eAT2Vyo=; fh=iyy13j/hzfuQ7wUjKw2aoGVnHVkfJeRlTmijr91AKLc=; b=neElDHBmY7OKHVAWoSpxXNJn8N8kVDwf+8Xcq8+Vj9YPRRVMSh+ag3T7Yst0S30BXz nx2w7UjxBmlG9V9V6rntGp0qCaMaqi9X7amC7kxlZfGNwYO2QurDbhZqFPoCvntcEEP5 nDnAXkKC4g678UD4680rB/iYS+vxtuY29FnDPmPOYlWUtKCUw3xvlXU3auJ3/rNsdpiw R/SOs5GCIaknWaMavjZvRnJzJFW/z5ysQtnKzYb/BG16JXr/cxoRPfFUb8lTiIBxWBlJ M1VaOtlQkdAWYDIe/p/+nEIPWieqsWU/guTKycjfKv5D2At0YIUwmH64iLPrcSYR4FsF 9bew== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A00aORVz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-ext4+bounces-911-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-ext4+bounces-911-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 18-20020ac85952000000b0042a5d0cb37fsi3053334qtz.662.2024.01.24.19.13.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 19:13:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-911-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A00aORVz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-ext4+bounces-911-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-ext4+bounces-911-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 105171C245B8 for ; Thu, 25 Jan 2024 03:13:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C58AB63AE; Thu, 25 Jan 2024 03:12:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="A00aORVz" X-Original-To: linux-ext4@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BC4A1FB2; Thu, 25 Jan 2024 03:12:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706152374; cv=none; b=F6CNIEqrzfAdKKSl9ZXYtMgdU2wqBBRxPkoa6P09885JxjzoeRDJZWCAxC59zLrDGlnzy3BIzmCwiyurPdlQolUA/009HCOKEG5oyQSb+Rl4sUU1Lcch6xtr8r37H0DEsI+AXRAZoomc5HxPiPfubZvRz1bH0A8x4QneXwz9ZUU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706152374; c=relaxed/simple; bh=fRk1oYOWwebE3Gwdrh/Tnqsxt6v+AVSd7r7lMjh5y1Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Xy1r2LpZgJlf58eVxpfnyEq6WAJrTMVSHQ4x1V2qd55d77xpokl9xMzYdO+YKY5Ei57TvDcRF0OVp99s99y8hxjswD9jbcTxFEWfL/TxUAIc/txpUN6Tj/EwsRpTTTQlasSVckTDBzzbYqKh1LRVJgcJu8EkfEdfZnPP0MxpGek= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=A00aORVz; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 763FBC433C7; Thu, 25 Jan 2024 03:12:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706152373; bh=fRk1oYOWwebE3Gwdrh/Tnqsxt6v+AVSd7r7lMjh5y1Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=A00aORVzedzHs30RWLFcTiWlC03VdaDvQqDuKIAniFdAVLKuMFWQwxb59IXtBz2js biOOHxBJXNbV378sLsEZGXvS6lPyMptuibzGnJvQkqseD6lrRtyTeMKtB8mXtpbXSx 4Pv1Ln6RLbqUw4p/jGh/OIqpEAo8vZua8MzySaGj2g6Rn+HM8ilr3C649ktYm+KQxq WhkYcxMLZRZcUiTXCT0TRYg30Qym+0RffALXDgmH3PKCar90DVOLimPGCPIgo7pfcf YTEAglBkTetGeXVcp+JEsx32RwjkZVRMtm6LCS7LJyGymi76fkcv/tS/ve/NGo1uxA +/ugfqmnbe8Cw== Date: Wed, 24 Jan 2024 19:12:51 -0800 From: Eric Biggers To: Gabriel Krisman Bertazi Cc: viro@zeniv.linux.org.uk, jaegeuk@kernel.org, tytso@mit.edu, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, amir73il@gmail.com Subject: Re: [PATCH v3 04/10] fscrypt: Drop d_revalidate once the key is added Message-ID: <20240125031251.GC52073@sol.localdomain> References: <20240119184742.31088-1-krisman@suse.de> <20240119184742.31088-5-krisman@suse.de> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240119184742.31088-5-krisman@suse.de> On Fri, Jan 19, 2024 at 03:47:36PM -0300, Gabriel Krisman Bertazi wrote: > /* > * When d_splice_alias() moves a directory's no-key alias to its plaintext alias > * as a result of the encryption key being added, DCACHE_NOKEY_NAME must be > * cleared. Note that we don't have to support arbitrary moves of this flag > * because fscrypt doesn't allow no-key names to be the source or target of a > * rename(). > */ > static inline void fscrypt_handle_d_move(struct dentry *dentry) > { > dentry->d_flags &= ~DCACHE_NOKEY_NAME; > + > + /* > + * Save the d_revalidate call cost during VFS operations. We > + * can do it because, when the key is available, the dentry > + * can't go stale and the key won't go away without eviction. > + */ > + if (dentry->d_op && dentry->d_op->d_revalidate == fscrypt_d_revalidate) > + dentry->d_flags &= ~DCACHE_OP_REVALIDATE; > } Is there any way to optimize this further for the case where fscrypt is not being used? This is called unconditionally from d_move(). I've generally been trying to avoid things like this where the fscrypt support slows things down for everyone even when they're not using the feature. In any case, as always please don't let function comments get outdated. Since it now seems to just describe the DCACHE_NOKEY_NAME clearing and not the whole function, maybe it should be moved to above that line. - Eric