From: Zbigniew Jędrzejewski-Szmek Date: Mon, 8 Nov 2021 11:18:30 +0000 (+0100) Subject: makefs: also set uuid/label for ext2/ext3 X-Git-Tag: v250-rc1~240^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8e93a614e7c20ee28f1d3b4aa51c0e4200aa2c52;p=thirdparty%2Fsystemd.git makefs: also set uuid/label for ext2/ext3 We were only "supporting" ext4. Let's add "support", i.e. pass our optimization options and uuid/label for the other two fses in the same family. Nowadays there is separate code in the kernel, all three fs types are handled by ext4 code. ext2 in particular is useful for in-memory devices: the journal is just a waste of space there. ext3 is added for completeness mostly, since ext4 should probably be used instead. But people might use it for testing or for compatibility with older systems and I don't see much reason to not add "support" here. --- diff --git a/src/shared/mkfs-util.c b/src/shared/mkfs-util.c index b9c2f147bc1..1056de1bec2 100644 --- a/src/shared/mkfs-util.c +++ b/src/shared/mkfs-util.c @@ -68,7 +68,16 @@ int make_filesystem( return r; if (r == 0) { /* Child */ - if (streq(fstype, "ext4")) + if (streq(fstype, "ext2")) + (void) execlp(mkfs, mkfs, + "-L", label, + "-U", ID128_TO_UUID_STRING(uuid), + "-I", "256", + "-m", "0", + "-E", discard ? "discard,lazy_itable_init=1" : "nodiscard,lazy_itable_init=1", + node, NULL); + + else if (STR_IN_SET(fstype, "ext3", "ext4")) (void) execlp(mkfs, mkfs, "-L", label, "-U", ID128_TO_UUID_STRING(uuid),