[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240905190252.461639-6-andrealmeid@igalia.com>
Date: Thu, 5 Sep 2024 16:02:48 -0300
From: André Almeida <andrealmeid@...lia.com>
To: Hugh Dickins <hughd@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>,
Jan Kara <jack@...e.cz>,
krisman@...nel.org
Cc: linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org,
kernel-dev@...lia.com,
Daniel Rosenberg <drosen@...gle.com>,
smcv@...labora.com,
Christoph Hellwig <hch@....de>,
Theodore Ts'o <tytso@....edu>,
André Almeida <andrealmeid@...lia.com>
Subject: [PATCH v3 5/9] libfs: Create the helper struct generic_ci_always_del_dentry_ops
Create a helper to assign dentry_operations with the generic case
insensitive functions plus setting .d_delete as always_delete_dentry.
This is useful to in-memory casefold filesystems like tmpfs.
Signed-off-by: André Almeida <andrealmeid@...lia.com>
---
v3: New patch
---
fs/libfs.c | 15 +++++++++++++++
include/linux/fs.h | 1 +
2 files changed, 16 insertions(+)
diff --git a/fs/libfs.c b/fs/libfs.c
index 99fb36b48708..58b39640b686 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -1855,6 +1855,21 @@ static const struct dentry_operations generic_ci_dentry_ops = {
#endif
};
+/*
+ * Same as generic_ci_dentry_ops, but also set d_delete. Useful for in-memory
+ * casefold filesystems.
+ */
+const struct dentry_operations generic_ci_always_del_dentry_ops = {
+ .d_hash = generic_ci_d_hash,
+ .d_compare = generic_ci_d_compare,
+#ifdef CONFIG_FS_ENCRYPTION
+ .d_revalidate = fscrypt_d_revalidate,
+#endif
+ .d_delete = always_delete_dentry,
+};
+EXPORT_SYMBOL(generic_ci_always_del_dentry_ops);
+
+
/**
* generic_ci_match() - Match a name (case-insensitively) with a dirent.
* This is a filesystem helper for comparison with directory entries.
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 937142950dfe..254a1dcf987b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3337,6 +3337,7 @@ extern int always_delete_dentry(const struct dentry *);
extern struct inode *alloc_anon_inode(struct super_block *);
extern int simple_nosetlease(struct file *, int, struct file_lease **, void **);
extern const struct dentry_operations simple_dentry_operations;
+extern const struct dentry_operations generic_ci_always_del_dentry_ops;
extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags);
extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);
--
2.46.0
Powered by blists - more mailing lists