Skip to content

Commit a1108dc

Browse files
dvandercorphsiangkao
authored andcommitted
erofs: rename ctime to mtime
EROFS images should inherit modification time rather than change time, since users and host tooling have no easy way to control change time. To reflect the new timestamp meaning, i_ctime and i_ctime_nsec are renamed to i_mtime and i_mtime_nsec. Link: https://lore.kernel.org/r/[email protected] # v1 Signed-off-by: David Anderson <[email protected]> [ Gao Xiang: update document as well. ] Reviewed-by: Chao Yu <[email protected]> Link: https://lore.kernel.org/r/[email protected] # v2 Signed-off-by: Gao Xiang <[email protected]>
1 parent 500edd0 commit a1108dc

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Documentation/filesystems/erofs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Here is the main features of EROFS:
4040
Inode metadata size 32 bytes 64 bytes
4141
Max file size 4 GB 16 EB (also limited by max. vol size)
4242
Max uids/gids 65536 4294967296
43-
File change time no yes (64 + 32-bit timestamp)
43+
Per-inode timestamp no yes (64 + 32-bit timestamp)
4444
Max hardlinks 65536 4294967296
4545
Metadata reserved 4 bytes 14 bytes
4646
===================== ============ =====================================

fs/erofs/erofs_fs.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#define EROFS_SUPER_OFFSET 1024
1313

1414
#define EROFS_FEATURE_COMPAT_SB_CHKSUM 0x00000001
15+
#define EROFS_FEATURE_COMPAT_MTIME 0x00000002
1516

1617
/*
1718
* Any bits that aren't in EROFS_ALL_FEATURE_INCOMPAT should
@@ -186,8 +187,8 @@ struct erofs_inode_extended {
186187

187188
__le32 i_uid;
188189
__le32 i_gid;
189-
__le64 i_ctime;
190-
__le32 i_ctime_nsec;
190+
__le64 i_mtime;
191+
__le32 i_mtime_nsec;
191192
__le32 i_nlink;
192193
__u8 i_reserved2[16];
193194
};

fs/erofs/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ static void *erofs_read_inode(struct erofs_buf *buf,
113113
set_nlink(inode, le32_to_cpu(die->i_nlink));
114114

115115
/* extended inode has its own timestamp */
116-
inode->i_ctime.tv_sec = le64_to_cpu(die->i_ctime);
117-
inode->i_ctime.tv_nsec = le32_to_cpu(die->i_ctime_nsec);
116+
inode->i_ctime.tv_sec = le64_to_cpu(die->i_mtime);
117+
inode->i_ctime.tv_nsec = le32_to_cpu(die->i_mtime_nsec);
118118

119119
inode->i_size = le64_to_cpu(die->i_size);
120120

0 commit comments

Comments
 (0)