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:
commit
c5822010ae
@ -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);
|
||||
|
@ -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" */
|
||||
|
Loading…
Reference in New Issue
Block a user