[PATCH v3 04/13] ubifs: move fscrypt to filesystem inode

Christian Brauner
2025-07-22T19:28:04Z

Move fscrypt data pointer into the filesystem's private inode and record
the offset from the embedded struct inode.

This will allow us to drop the fscrypt data pointer from struct inode
itself and move it into the filesystem's inode.

Signed-off-by: Christian Brauner <brauner@kernel.org>
---
fs/ubifs/super.c | 4 ++++
fs/ubifs/ubifs.h | 3 +++
2 files changed, 7 insertions(+)

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index f3e3b2068608..5b484f054faf 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -2003,6 +2003,10 @@ static int ubifs_reconfigure(struct fs_context *fc)
}

const struct super_operations ubifs_super_operations = {
+#ifdef CONFIG_FS_ENCRYPTION
+ .i_fscrypt = offsetof(struct ubifs_inode, i_fscrypt_info) -
+ offsetof(struct ubifs_inode, vfs_inode),
+#endif
.alloc_inode = ubifs_alloc_inode,
.free_inode = ubifs_free_inode,
.put_super = ubifs_put_super,
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 256dbaeeb0de..0442782a54ab 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -416,6 +416,9 @@ struct ubifs_inode {
pgoff_t read_in_a_row;
int data_len;
void *data;
+#ifdef CONFIG_FS_ENCRYPTION
+ struct fscrypt_inode_info *i_fscrypt_info;
+#endif
};

/**

--
2.47.2