1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-10 05:18:17 +03:00

Merge pull request #33544 from DaanDeMeyer/sector-size

repart: Two sector size improvements
This commit is contained in:
Luca Boccassi 2024-06-29 21:31:04 +02:00 committed by GitHub
commit c5822010ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -2564,7 +2564,7 @@ static int context_load_partition_table(Context *context) {
if (IN_SET(arg_empty, EMPTY_REQUIRE, EMPTY_FORCE, EMPTY_CREATE) && S_ISREG(st.st_mode))
/* Don't probe sector size from partition table if we are supposed to start from an empty disk */
fs_secsz = ssz = 512;
ssz = 512;
else {
/* Auto-detect sector size if not specified. */
r = probe_sector_size_prefer_ioctl(context->backing_fd, &ssz);

View File

@ -461,6 +461,15 @@ int make_filesystem(
if (quiet)
stdio_fds[1] = -EBADF;
if (sector_size > 0) {
if (strv_extend(&argv, "--sectorsize") < 0)
return log_oom();
/* mkfs.btrfs expects a sector size of at least 4k bytes. */
if (strv_extendf(&argv, "%"PRIu64, MAX(sector_size, 4 * U64_KB)) < 0)
return log_oom();
}
} else if (streq(fstype, "f2fs")) {
argv = strv_new(mkfs,
"-g", /* "default options" */