diff options
author | David Anderson <dvander@google.com> | 2022-03-11 04:17:24 +0000 |
---|---|---|
committer | David Anderson <dvander@google.com> | 2022-03-23 12:20:28 -0700 |
commit | d89215b66a420aa2e60b0d4a4d300cfc3ff5815d (patch) | |
tree | e93e9aea40dfb2e0c98408d0b6a5cc6f62c06c4c | |
parent | 8b34f017ffbb7f07e8bf99209c5d917ae3b063e5 (diff) | |
download | erofs-utils-d89215b66a420aa2e60b0d4a4d300cfc3ff5815d.tar.gz |
erofs-utils: mkfs: use mtime instead of ctime
Change the default timestamp behavior to use modification time
rather than change time. This will allow more control over the
output timestamps when not using TIMESTAMP_FIXED.
EROFS_FEATURE_COMPAT_MTIME has been added so tooling can detect
the change in timestamp behavior.
Link: https://lore.kernel.org/r/20220311041724.3107622-2-dvander@google.com
Signed-off-by: David Anderson <dvander@google.com>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Change-Id: I5bf9a003b99ed029be7c2fb55039357a635aa501
-rw-r--r-- | dump/main.c | 1 | ||||
-rw-r--r-- | include/erofs_fs.h | 1 | ||||
-rw-r--r-- | lib/inode.c | 4 | ||||
-rw-r--r-- | mkfs/main.c | 3 |
4 files changed, 6 insertions, 3 deletions
diff --git a/dump/main.c b/dump/main.c index 6565d35..72761bd 100644 --- a/dump/main.c +++ b/dump/main.c @@ -84,6 +84,7 @@ struct erofsdump_feature { static struct erofsdump_feature feature_lists[] = { { true, EROFS_FEATURE_COMPAT_SB_CHKSUM, "sb_csum" }, + { true, EROFS_FEATURE_COMPAT_MTIME, "mtime" }, { false, EROFS_FEATURE_INCOMPAT_LZ4_0PADDING, "0padding" }, { false, EROFS_FEATURE_INCOMPAT_BIG_PCLUSTER, "big_pcluster" }, { false, EROFS_FEATURE_INCOMPAT_CHUNKED_FILE, "chunked_file" }, diff --git a/include/erofs_fs.h b/include/erofs_fs.h index e01f5c7..7956a62 100644 --- a/include/erofs_fs.h +++ b/include/erofs_fs.h @@ -13,6 +13,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 diff --git a/lib/inode.c b/lib/inode.c index 24f2567..c9fdda1 100644 --- a/lib/inode.c +++ b/lib/inode.c @@ -806,8 +806,8 @@ static int erofs_fill_inode(struct erofs_inode *inode, inode->i_mode = st->st_mode; inode->i_uid = cfg.c_uid == -1 ? st->st_uid : cfg.c_uid; inode->i_gid = cfg.c_gid == -1 ? st->st_gid : cfg.c_gid; - inode->i_mtime = st->st_ctime; - inode->i_mtime_nsec = ST_CTIM_NSEC(st); + inode->i_mtime = st->st_mtime; + inode->i_mtime_nsec = ST_MTIM_NSEC(st); switch (cfg.c_timeinherit) { case TIMESTAMP_CLAMPING: diff --git a/mkfs/main.c b/mkfs/main.c index 3f34450..9f35179 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -511,7 +511,8 @@ static void erofs_mkfs_default_options(void) { cfg.c_legacy_compress = false; sbi.feature_incompat = EROFS_FEATURE_INCOMPAT_LZ4_0PADDING; - sbi.feature_compat = EROFS_FEATURE_COMPAT_SB_CHKSUM; + sbi.feature_compat = EROFS_FEATURE_COMPAT_SB_CHKSUM | + EROFS_FEATURE_COMPAT_MTIME; /* generate a default uuid first */ #ifdef HAVE_LIBUUID |