linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] erofs-utils: mkfs: introduce `--preserve-mtime'
@ 2022-06-11  8:22 Gao Xiang
  0 siblings, 0 replies; only message in thread
From: Gao Xiang @ 2022-06-11  8:22 UTC (permalink / raw)
  To: linux-erofs

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 <xiang@kernel.org>
---
 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 <blucerlee@gmail.com>,
 Miao Xie <miaoxie@huawei.com> and Gao Xiang <xiang@kernel.org> 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-11  8:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-11  8:22 [PATCH] erofs-utils: mkfs: introduce `--preserve-mtime' Gao Xiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).