1
0
mirror of https://github.com/systemd/systemd.git synced 2025-08-30 05:49:54 +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
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)) 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 */ /* 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 { else {
/* Auto-detect sector size if not specified. */ /* Auto-detect sector size if not specified. */
r = probe_sector_size_prefer_ioctl(context->backing_fd, &ssz); r = probe_sector_size_prefer_ioctl(context->backing_fd, &ssz);

View File

@ -461,6 +461,15 @@ int make_filesystem(
if (quiet) if (quiet)
stdio_fds[1] = -EBADF; 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")) { } else if (streq(fstype, "f2fs")) {
argv = strv_new(mkfs, argv = strv_new(mkfs,
"-g", /* "default options" */ "-g", /* "default options" */