backfs_sources := $(filter-out %.mod.c %/inode-test.c,$(wildcard @EXT4_SRC_DIR@/*.c))
endif
-new_sources := mmp.c htree_lock.c critical_encode.h
+new_sources := mmp.c htree_lock.c critical_encode.h encdata.h
new_headers :=
ldiskfs_patched_sources := $(notdir $(backfs_sources) $(backfs_headers)) $(new_sources) $(new_headers)
--- /dev/null
+diff -wur /dev/null b/fs/ext4/encdata.h
+--- /dev/null
++++ b/fs/ext4/encdata.h
+@@ -0,0 +1,16 @@
++/*
++ * encdata.h
++ *
++ * Copyright (c) 2022 Whamcloud
++ */
++
++#ifndef _ENCDATA_H
++#define _ENCDATA_H
++
++/* Define a fixed 4096-byte encryption unit size */
++/* Must be identical to LUSTRE_ENCRYPTION_UNIT_SIZE */
++#define EXT4_ENCRYPTION_BLOCKBITS 12
++#define EXT4_ENCRYPTION_UNIT_SIZE ((size_t)1 << EXT4_ENCRYPTION_BLOCKBITS)
++#define EXT4_ENCRYPTION_MASK (~(EXT4_ENCRYPTION_UNIT_SIZE - 1))
++
++#endif /* _ENCDATA_H */
+diff -wur a/fs/ext4/inode.c b/fs/ext4/inode.c
+--- a/fs/ext4/inode.c
++++ b/fs/ext4/inode.c
+@@ -45,6 +45,7 @@
+ #include "xattr.h"
+ #include "acl.h"
+ #include "truncate.h"
++#include "encdata.h"
+
+ #include <trace/events/ext4.h>
+
+@@ -5069,6 +5070,11 @@ int ext4_getattr(struct vfsmount *mnt
+
+ inode = dentry->d_inode;
+ generic_fillattr(inode, stat);
++
++ if (EXT4_I(inode)->i_flags & EXT4_ENCRYPT_FL &&
++ unlikely(!IS_LUSTRE_MOUNT(inode->i_sb)))
++ stat->size = round_up(stat->size,
++ EXT4_ENCRYPTION_UNIT_SIZE);
+
+ /*
+ * If there is inline data in the inode, the inode will normally not
--- /dev/null
+diff -wur /dev/null b/fs/ext4/encdata.h
+--- /dev/null
++++ b/fs/ext4/encdata.h
+@@ -0,0 +1,16 @@
++/*
++ * encdata.h
++ *
++ * Copyright (c) 2022 Whamcloud
++ */
++
++#ifndef _ENCDATA_H
++#define _ENCDATA_H
++
++/* Define a fixed 4096-byte encryption unit size */
++/* Must be identical to LUSTRE_ENCRYPTION_UNIT_SIZE */
++#define EXT4_ENCRYPTION_BLOCKBITS 12
++#define EXT4_ENCRYPTION_UNIT_SIZE ((size_t)1 << EXT4_ENCRYPTION_BLOCKBITS)
++#define EXT4_ENCRYPTION_MASK (~(EXT4_ENCRYPTION_UNIT_SIZE - 1))
++
++#endif /* _ENCDATA_H */
+diff -wur a/fs/ext4/inode.c b/fs/ext4/inode.c
+--- a/fs/ext4/inode.c
++++ b/fs/ext4/inode.c
+@@ -45,6 +45,7 @@
+ #include "xattr.h"
+ #include "acl.h"
+ #include "truncate.h"
++#include "encdata.h"
+
+ #include <trace/events/ext4.h>
+
+@@ -5769,6 +5770,12 @@ int ext4_getattr(const struct path *p
+ STATX_ATTR_NODUMP);
+
+ generic_fillattr(inode, stat);
++
++ if (flags & EXT4_ENCRYPT_FL &&
++ unlikely(!IS_LUSTRE_MOUNT(inode->i_sb)))
++ stat->size = round_up(stat->size,
++ EXT4_ENCRYPTION_UNIT_SIZE);
++
+ return 0;
+ }
+
rhel7.6/ext4-projid-xattrs.patch
rhel7.9/ext4-enc-flag.patch
rhel7.9/ext4-filename-encode.patch
+rhel7.9/ext4-encdata.patch
rhel7.6/ext4-projid-xattrs.patch
rhel7.9/ext4-enc-flag.patch
rhel7.9/ext4-filename-encode.patch
+rhel7.9/ext4-encdata.patch
rhel7.6/ext4-projid-xattrs.patch
rhel7.9/ext4-enc-flag.patch
rhel7.9/ext4-filename-encode.patch
+rhel7.9/ext4-encdata.patch
rhel7.6/ext4-projid-xattrs.patch
rhel7.9/ext4-enc-flag.patch
rhel7.9/ext4-filename-encode.patch
+rhel7.9/ext4-encdata.patch
rhel8/linux-5.4/ext4-enc-flag.patch
base/ext4-delayed-iput.patch
rhel8/ext4-filename-encode.patch
+rhel8/ext4-encdata.patch
rhel8/ext4-enc-flag.patch
base/ext4-delayed-iput.patch
rhel8/ext4-filename-encode.patch
+rhel8/ext4-encdata.patch
rhel8/ext4-enc-flag.patch
base/ext4-delayed-iput.patch
rhel8/ext4-filename-encode.patch
+rhel8/ext4-encdata.patch
rhel8.5/ext4-filename-encode.patch
rhel8/ext4-old_ea_inodes_handling_fix.patch
rhel8.4/ext4-optimize-find_delayed_extent.patch
+rhel8/ext4-encdata.patch
rhel8.5/ext4-filename-encode.patch
rhel8/ext4-old_ea_inodes_handling_fix.patch
rhel8.4/ext4-optimize-find_delayed_extent.patch
+rhel8/ext4-encdata.patch
rhel8.5/ext4-filename-encode.patch
rhel8/ext4-old_ea_inodes_handling_fix.patch
rhel8.4/ext4-optimize-find_delayed_extent.patch
+rhel8/ext4-encdata.patch
base/ext4-delayed-iput.patch
rhel8.7/ext4-filename-encode.patch
rhel8/ext4-old_ea_inodes_handling_fix.patch
+rhel8/ext4-encdata.patch
rhel8/ext4-enc-flag.patch
base/ext4-delayed-iput.patch
rhel8/ext4-filename-encode.patch
+rhel8/ext4-encdata.patch
base/ext4-delayed-iput.patch
linux-5.10/ext4-fiemap-kernel-data.patch
rhel8/ext4-old_ea_inodes_handling_fix.patch
+rhel8/ext4-encdata.patch
base/ext4-delayed-iput.patch
linux-5.10/ext4-fiemap-kernel-data.patch
rhel8/ext4-old_ea_inodes_handling_fix.patch
+rhel8/ext4-encdata.patch
base/ext4-projid-xattrs.patch
linux-5.8/ext4-enc-flag.patch
rhel8/ext4-old_ea_inodes_handling_fix.patch
+rhel8/ext4-encdata.patch
linux-5.4/ext4-enc-flag.patch
base/ext4-delayed-iput.patch
rhel8/ext4-old_ea_inodes_handling_fix.patch
+rhel8/ext4-encdata.patch
linux-5.4/ext4-enc-flag.patch
base/ext4-delayed-iput.patch
rhel8/ext4-old_ea_inodes_handling_fix.patch
+rhel8/ext4-encdata.patch
linux-5.4/ext4-enc-flag.patch
base/ext4-delayed-iput.patch
rhel8/ext4-old_ea_inodes_handling_fix.patch
+rhel8/ext4-encdata.patch
linux-5.4/ext4-enc-flag.patch
base/ext4-delayed-iput.patch
rhel8/ext4-old_ea_inodes_handling_fix.patch
+rhel8/ext4-encdata.patch
linux-5.4/ext4-enc-flag.patch
base/ext4-delayed-iput.patch
rhel8/ext4-old_ea_inodes_handling_fix.patch
+rhel8/ext4-encdata.patch
linux-5.4/ext4-enc-flag.patch
base/ext4-delayed-iput.patch
rhel8/ext4-old_ea_inodes_handling_fix.patch
+rhel8/ext4-encdata.patch
linux-5.4/ext4-enc-flag.patch
base/ext4-delayed-iput.patch
rhel8/ext4-old_ea_inodes_handling_fix.patch
+rhel8/ext4-encdata.patch
linux-5.8/ext4-enc-flag.patch
base/ext4-delayed-iput.patch
rhel8/ext4-old_ea_inodes_handling_fix.patch
+rhel8/ext4-encdata.patch
linux-5.8/ext4-enc-flag.patch
base/ext4-delayed-iput.patch
rhel8/ext4-old_ea_inodes_handling_fix.patch
+rhel8/ext4-encdata.patch
base/ext4-projid-xattrs.patch
linux-5.8/ext4-enc-flag.patch
rhel8/ext4-old_ea_inodes_handling_fix.patch
+rhel8/ext4-encdata.patch
base/ext4-projid-xattrs.patch
linux-5.8/ext4-enc-flag.patch
rhel8/ext4-old_ea_inodes_handling_fix.patch
+rhel8/ext4-encdata.patch