Skip to contentSkip to conversation

erofs: rename ctime to mtime

PATCH In review David Anderson via Linux-erofs 2 participants 4 messages Mar 11, 2022 – Mar 18, 2022 EROFS file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 erofs: rename ctime to mtime

EROFS images should inherit modification time rather than creation time, since users and host tooling have no easy way to control creation time. To reflect the new timestamp meaning, i_ctime and i_ctime_nsec are renamed to i_mtime and i_mtime_nsec.

---
 fs/erofs/erofs_fs.h | 5 +++--
 fs/erofs/inode.c    | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)
fs/erofs/erofs_fs.h +3 -2
index 3ea62c6fb00a..1238ca104f09 100644
@@ -12,6 +12,7 @@
 #define EROFS_SUPER_OFFSET      1024
 
 #define EROFS_FEATURE_COMPAT_SB_CHKSUM          0x00000001
+#define EROFS_FEATURE_COMPAT_MTIME              0x00000002
 
 /*
  * Any bits that aren't in EROFS_ALL_FEATURE_INCOMPAT should
@@ -186,8 +187,8 @@ struct erofs_inode_extended {
 
 	__le32 i_uid;
 	__le32 i_gid;
-	__le64 i_ctime;
-	__le32 i_ctime_nsec;
+	__le64 i_mtime;
+	__le32 i_mtime_nsec;
 	__le32 i_nlink;
 	__u8   i_reserved2[16];
 };
fs/erofs/inode.c +2 -2
index ff62f84f47d3..e8b37ba5e9ad 100644
@@ -113,8 +113,8 @@ static void *erofs_read_inode(struct erofs_buf *buf,
 		set_nlink(inode, le32_to_cpu(die->i_nlink));
 
 		/* extended inode has its own timestamp */
-		inode->i_ctime.tv_sec = le64_to_cpu(die->i_ctime);
-		inode->i_ctime.tv_nsec = le32_to_cpu(die->i_ctime_nsec);
+		inode->i_ctime.tv_sec = le64_to_cpu(die->i_mtime);
+		inode->i_ctime.tv_nsec = le32_to_cpu(die->i_mtime_nsec);
 
 		inode->i_size = le64_to_cpu(die->i_size);
 
Signature · 1 line
2.35.1.723.g4982287a31-goog
#1 lore raw

Hi David,

Quoted 6 lines · David Anderson via Linux-erofs

EROFS images should inherit modification time rather than creation time, since users and host tooling have no easy way to control creation time. To reflect the new timestamp meaning, i_ctime and i_ctime_nsec are renamed to i_mtime and i_mtime_nsec.

Thanks for the patch!

This patch looks good to me, yet, should we update
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/erofs.rst#n43

here as well? (I think "Inode timestamp" might be fine..)

Thanks,
Gao Xiang

Quoted 45 lines
---
 fs/erofs/erofs_fs.h | 5 +++--
 fs/erofs/inode.c    | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)
fs/erofs/erofs_fs.h +3 -2
index 3ea62c6fb00a..1238ca104f09 100644
@@ -12,6 +12,7 @@
 #define EROFS_SUPER_OFFSET      1024
 
 #define EROFS_FEATURE_COMPAT_SB_CHKSUM          0x00000001
+#define EROFS_FEATURE_COMPAT_MTIME              0x00000002
 
 /*
  * Any bits that aren't in EROFS_ALL_FEATURE_INCOMPAT should
@@ -186,8 +187,8 @@ struct erofs_inode_extended {
 
 	__le32 i_uid;
 	__le32 i_gid;
-	__le64 i_ctime;
-	__le32 i_ctime_nsec;
+	__le64 i_mtime;
+	__le32 i_mtime_nsec;
 	__le32 i_nlink;
 	__u8   i_reserved2[16];
 };
fs/erofs/inode.c +2 -2
index ff62f84f47d3..e8b37ba5e9ad 100644
@@ -113,8 +113,8 @@ static void *erofs_read_inode(struct erofs_buf *buf,
 		set_nlink(inode, le32_to_cpu(die->i_nlink));
 
 		/* extended inode has its own timestamp */
-		inode->i_ctime.tv_sec = le64_to_cpu(die->i_ctime);
-		inode->i_ctime.tv_nsec = le32_to_cpu(die->i_ctime_nsec);
+		inode->i_ctime.tv_sec = le64_to_cpu(die->i_mtime);
+		inode->i_ctime.tv_nsec = le32_to_cpu(die->i_mtime_nsec);
 
 		inode->i_size = le64_to_cpu(die->i_size);
 
Signature · 1 line
2.35.1.723.g4982287a31-goog
#2 lore raw

Hi David,

Quoted 8 lines · Gao Xiang

Hi David,

Quoted 5 lines · David Anderson via Linux-erofs

EROFS images should inherit modification time rather than creation time, since users and host tooling have no easy way to control creation time. To reflect the new timestamp meaning, i_ctime and i_ctime_nsec are renamed to i_mtime and i_mtime_nsec.

Quoted 8 lines
Quoted 1 line

Thanks for the patch!

This patch looks good to me, yet, should we update
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/erofs.rst#n43

here as well? (I think "Inode timestamp" might be fine..)

Since another -rc8 is out, would you mind revising the patch with the document update... Or would you mind if I could help revise it?

Thanks,
Gao Xiang

Quoted 3 lines

Thanks,
Gao Xiang

#3 lore raw

Sorry about this - thank you for updating the patch!

Quoted 33 lines · Gao Xiang

Hi David,

Quoted 3 lines · Gao Xiang

Hi David,

On Fri, Mar 11, 2022 at 04:18:29AM +0000, David Anderson via Linux-erofs

Quoted 1 line · wrote:
Quoted 1 line

EROFS images should inherit modification time rather than creation

time,

Quoted 10 lines
Quoted 5 lines

since users and host tooling have no easy way to control creation time. To reflect the new timestamp meaning, i_ctime and i_ctime_nsec are renamed to i_mtime and i_mtime_nsec.

Thanks for the patch!

This patch looks good to me, yet, should we update

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/erofs.rst#n43

Quoted 2 lines

here as well? (I think "Inode timestamp" might be fine..)

Since another -rc8 is out, would you mind revising the patch with the document update... Or would you mind if I could help revise it?

Thanks,
Gao Xiang

Quoted 3 lines

Thanks,
Gao Xiang