Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] erofs-utils: mkfs: Use extended inodes when ctime is set
@ 2022-03-01  4:10 David Anderson via Linux-erofs
  2022-03-01  5:17 ` Gao Xiang
  0 siblings, 1 reply; 7+ messages in thread
From: David Anderson via Linux-erofs @ 2022-03-01  4:10 UTC (permalink / raw)
  To: linux-erofs

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@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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-03-18  4:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-01  4:10 [PATCH] erofs-utils: mkfs: Use extended inodes when ctime is set David Anderson via Linux-erofs
2022-03-01  5:17 ` Gao Xiang
2022-03-01  6:06   ` David Anderson via Linux-erofs
2022-03-01  6:14     ` Gao Xiang
2022-03-11  3:53       ` David Anderson via Linux-erofs
2022-03-11  5:24         ` Gao Xiang
2022-03-18  4:55           ` David Anderson via Linux-erofs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox