1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-12 21:57:27 +03:00

repart: Add more logging

This commit is contained in:
Daan De Meyer 2023-04-05 19:36:05 +02:00
parent 7393530f22
commit b24bfd6ee4
2 changed files with 30 additions and 2 deletions

View File

@ -3963,6 +3963,8 @@ static int partition_populate_directory(Partition *p, Hashmap *denylist, char **
assert(ret);
log_info("Populating %s filesystem.", p->format);
r = var_tmp_dir(&vt);
if (r < 0)
return log_error_errno(r, "Could not determine temporary directory: %m");
@ -3983,6 +3985,8 @@ static int partition_populate_directory(Partition *p, Hashmap *denylist, char **
if (r < 0)
return r;
log_info("Successfully populated %s filesystem.", p->format);
*ret = TAKE_PTR(root);
return 0;
}
@ -3993,7 +3997,7 @@ static int partition_populate_filesystem(Partition *p, const char *node, Hashmap
assert(p);
assert(node);
log_info("Populating %s filesystem with files.", p->format);
log_info("Populating %s filesystem.", p->format);
/* We copy in a child process, since we have to mount the fs for that, and we don't want that fs to
* appear in the host namespace. Hence we fork a child that has its own file system namespace and
@ -4030,7 +4034,7 @@ static int partition_populate_filesystem(Partition *p, const char *node, Hashmap
_exit(EXIT_SUCCESS);
}
log_info("Successfully populated %s filesystem with files.", p->format);
log_info("Successfully populated %s filesystem.", p->format);
return 0;
}
@ -5436,6 +5440,7 @@ static int context_minimize(Context *context) {
_cleanup_(loop_device_unrefp) LoopDevice *d = NULL;
_cleanup_strv_free_ char **extra_mkfs_options = NULL;
_cleanup_close_ int fd = -EBADF;
_cleanup_free_ char *hint = NULL;
sd_id128_t fs_uuid;
uint64_t fsz;
@ -5456,6 +5461,11 @@ static int context_minimize(Context *context) {
assert(!p->copy_blocks_path);
(void) partition_hint(p, context->node, &hint);
log_info("Pre-populating %s filesystem of partition %s twice to calculate minimal partition size",
p->format, strna(hint));
r = make_copy_files_denylist(context, p, &denylist);
if (r < 0)
return r;
@ -5513,6 +5523,14 @@ static int context_minimize(Context *context) {
/* Read-only filesystems are minimal from the first try because they create and size the
* loopback file for us. */
if (fstype_is_ro(p->format)) {
struct stat st;
if (stat(temp, &st) < 0)
return log_error_errno(errno, "Failed to stat temporary file: %m");
log_info("Minimal partition size of %s filesystem of partition %s is %s",
p->format, strna(hint), FORMAT_BYTES(st.st_size));
p->copy_blocks_path = TAKE_PTR(temp);
p->copy_blocks_path_is_our_file = true;
continue;
@ -5546,6 +5564,9 @@ static int context_minimize(Context *context) {
if (minimal_size_by_fs_name(p->format) != UINT64_MAX)
fsz = MAX(minimal_size_by_fs_name(p->format), fsz);
log_info("Minimal partition size of %s filesystem of partition %s is %s",
p->format, strna(hint), FORMAT_BYTES(fsz));
d = loop_device_unref(d);
/* Erase the previous filesystem first. */

View File

@ -479,6 +479,13 @@ int make_filesystem(
if (extra_mkfs_args && strv_extend_strv(&argv, extra_mkfs_args, false) < 0)
return log_oom();
if (DEBUG_LOGGING) {
_cleanup_free_ char *j = NULL;
j = strv_join(argv, " ");
log_debug("Executing mkfs command: %s", strna(j));
}
r = safe_fork_full(
"(mkfs)",
stdio_fds,