[PATCH] erofs-utils: mkfs: Use extended inodes when ctime is set

David Anderson dvander at google.com
Tue Mar 1 15:10:37 AEDT 2022


Currently ctime is effectively ignored because most inodes are compact.
If ctime was set, and it's different from the build time, then extended
inodes should be used instead.

To guarantee that timestamps do not cause extended inodes, a fixed
timestamp should be used (-T).

Change-Id: I3d2e5c5ffe2bdcabea6791b5def5973b507aa316
Signed-off-by: David Anderson <dvander at google.com>
---
 lib/inode.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/inode.c b/lib/inode.c
index f0a71a8..6f36c09 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -730,6 +730,10 @@ static bool erofs_should_use_inode_extended(struct erofs_inode *inode)
 		return true;
 	if (inode->i_nlink > USHRT_MAX)
 		return true;
+	if (inode->i_ctime != sbi.build_time ||
+	    inode->i_ctime_nsec != sbi.build_time_nsec) {
+		return true;
+	}
 	return false;
 }
 
-- 
2.35.1.574.g5d30c73bfb-goog



More information about the Linux-erofs mailing list