diff mbox series

[v4,06/12] fscrypt: Ignore non-fscrypt volumes during d_move

Message ID 20240127001013.2845-7-krisman@suse.de (mailing list archive)
State New
Headers show
Series Set casefold/fscrypt dentry operations through sb->s_d_op | expand

Commit Message

Gabriel Krisman Bertazi Jan. 27, 2024, 12:10 a.m. UTC
Now that we do more than just clear the DCACHE_NOKEY_NAME in
fscrypt_handle_d_move, skip it entirely for volumes that don't need
fscrypt, to save the extra cost.

Note that fscrypt_handle_d_move is hopefully inlined back into __d_move,
so the call cost is not significant, and theefore we do the check in the
callee to avoid polluting the caller code with header guards.

Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de>
---
 include/linux/fscrypt.h | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h
index c1e285053b3e..566362fdc3af 100644
--- a/include/linux/fscrypt.h
+++ b/include/linux/fscrypt.h
@@ -232,6 +232,10 @@  static inline bool fscrypt_needs_contents_encryption(const struct inode *inode)
  */
 static inline void fscrypt_handle_d_move(struct dentry *dentry)
 {
+	/* Ignore volumes that don't care about fscrypt. */
+	if (dentry->d_sb->s_cop)
+		return;
+
 	dentry->d_flags &= ~DCACHE_NOKEY_NAME;
 
 	/*