]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mkfs-util: Don't set MKE2FS_DEVICE_PHYS_SECTSIZE
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 15 Aug 2023 10:10:14 +0000 (12:10 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 15 Aug 2023 10:10:14 +0000 (12:10 +0200)
We only care about the logical sector size and if the physical sector
size isn't set and we're operating on a file, mke2fs will default the
physical sector size to the logical block size anyway.

This change makes sure that if we're operating on a block device and
set an explicit logical sector size, that doesn't affect the physical
sector size.

src/shared/mkfs-util.c

index 3111bc0acc1720d2ce6e5362c8e57773aae18d55..b936a4733f4a359a3b861d6422a56a9bb3ba1aca 100644 (file)
@@ -432,14 +432,13 @@ int make_filesystem(
                 if (quiet && strv_extend(&argv, "-q") < 0)
                         return log_oom();
 
-                if (sector_size > 0)
-                        FOREACH_STRING(s, "MKE2FS_DEVICE_SECTSIZE", "MKE2FS_DEVICE_PHYS_SECTSIZE") {
-                                if (strv_extend(&env, s) < 0)
+                if (sector_size > 0) {
+                        if (strv_extend(&env, "MKE2FS_DEVICE_SECTSIZE") < 0)
                                         return log_oom();
 
-                                if (strv_extendf(&env, "%"PRIu64, sector_size) < 0)
-                                        return log_oom();
-                        }
+                        if (strv_extendf(&env, "%"PRIu64, sector_size) < 0)
+                                return log_oom();
+                }
 
         } else if (streq(fstype, "btrfs")) {
                 argv = strv_new(mkfs,