Merge pull request #28839 from DaanDeMeyer/repart-followups

Repart followups
This commit is contained in:
Luca Boccassi
2023-08-15 16:40:05 +01:00
committed by GitHub
2 changed files with 8 additions and 8 deletions

View File

@@ -2281,8 +2281,8 @@ static int context_load_partition_table(Context *context) {
return log_oom();
if (arg_sector_size > 0) {
r = fdisk_save_user_sector_size(c, /* phy= */ 0, arg_sector_size);
fs_secsz = arg_sector_size;
r = fdisk_save_user_sector_size(c, /* phy= */ 0, arg_sector_size);
} else {
uint32_t ssz;
struct stat st;
@@ -6150,7 +6150,8 @@ static int context_minimize(Context *context) {
/* Massage the size a bit because just going by actual data used in the sparse file isn't
* fool-proof. */
fsz = round_up_size(fsz + (fsz / 2), context->grain_size);
uint64_t heuristic = streq(p->format, "xfs") ? fsz : fsz / 2;
fsz = round_up_size(fsz + heuristic, context->grain_size);
if (minimal_size_by_fs_name(p->format) != UINT64_MAX)
fsz = MAX(minimal_size_by_fs_name(p->format), fsz);

View 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,