In the past versions, `-Eforce-inode-compact' worked since timestamps were ignored. Currently, since we don't ignore mtime by default any more, `-Eforce-inode-compact' fails and that breaks compatibility.
Let's fix `-Eforce-inode-compact' to ignore mtime as the past versions did, also add another option `--preserve-mtime' for this. Signed-off-by: Gao Xiang <[email protected]> --- man/mkfs.erofs.1 | 4 ++++ mkfs/main.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/man/mkfs.erofs.1 b/man/mkfs.erofs.1 index d61e33e..6017760 100644 --- a/man/mkfs.erofs.1 +++ b/man/mkfs.erofs.1 @@ -119,6 +119,10 @@ can reduce total metadata size. .TP .BI "\-\-max-extent-bytes " # Specify maximum decompressed extent size # in bytes. +.TP +.B "\-\-preserve-mtime" +File modification time is preserved whenever \fBmkfs.erofs\fR decides to use +extended inodes over compact inodes. .SH AUTHOR This version of \fBmkfs.erofs\fR is written by Li Guifu <[email protected]>, Miao Xie <[email protected]> and Gao Xiang <[email protected]> with diff --git a/mkfs/main.c b/mkfs/main.c index 9d43cd4..54a3fed 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -50,6 +50,7 @@ static struct option long_options[] = { {"quiet", no_argument, 0, 12}, {"blobdev", required_argument, NULL, 13}, {"ignore-mtime", no_argument, NULL, 14}, + {"preserve-mtime", no_argument, NULL, 15}, #ifdef WITH_ANDROID {"mount-point", required_argument, NULL, 512}, {"product-out", required_argument, NULL, 513}, @@ -158,6 +159,7 @@ static int parse_extended_opts(const char *opts) if (vallen) return -EINVAL; cfg.c_force_inodeversion = FORCE_INODE_COMPACT; + cfg.c_ignore_mtime = true; } if (MATCH_EXTENTED_OPT("force-inode-extended", token, keylen)) { @@ -377,6 +379,9 @@ static int mkfs_parse_options_cfg(int argc, char *argv[]) case 14: cfg.c_ignore_mtime = true; break; + case 15: + cfg.c_ignore_mtime = false; + break; case 1: usage(); exit(0); -- 2.30.2
