mirror of
https://github.com/systemd/systemd.git
synced 2025-02-28 05:57:33 +03:00
repart: mention how long it took to copy in data blocks
This is quite interesting information, show it.
This commit is contained in:
parent
f3066d635a
commit
b7786df093
@ -4277,6 +4277,8 @@ static int context_copy_blocks(Context *context) {
|
|||||||
assert(p->copy_blocks_size != UINT64_MAX);
|
assert(p->copy_blocks_size != UINT64_MAX);
|
||||||
assert(p->new_size >= p->copy_blocks_size + (p->encrypt != ENCRYPT_OFF ? LUKS2_METADATA_KEEP_FREE : 0));
|
assert(p->new_size >= p->copy_blocks_size + (p->encrypt != ENCRYPT_OFF ? LUKS2_METADATA_KEEP_FREE : 0));
|
||||||
|
|
||||||
|
usec_t start_timestamp = now(CLOCK_MONOTONIC);
|
||||||
|
|
||||||
r = partition_target_prepare(context, p, p->new_size,
|
r = partition_target_prepare(context, p, p->new_size,
|
||||||
/*need_path=*/ p->encrypt != ENCRYPT_OFF || p->siblings[VERITY_HASH],
|
/*need_path=*/ p->encrypt != ENCRYPT_OFF || p->siblings[VERITY_HASH],
|
||||||
&t);
|
&t);
|
||||||
@ -4311,6 +4313,14 @@ static int context_copy_blocks(Context *context) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
usec_t time_spent = usec_sub_unsigned(now(CLOCK_MONOTONIC), start_timestamp);
|
||||||
|
if (time_spent > 250 * USEC_PER_MSEC) /* Show throughput, but not if we spent too little time on it, since it's just noise then */
|
||||||
|
log_info("Block level copying and synchronization of partition %" PRIu64 " complete in %s (%s/s).",
|
||||||
|
p->partno, FORMAT_TIMESPAN(time_spent, 0), FORMAT_BYTES((uint64_t) ((double) p->copy_blocks_size / time_spent * USEC_PER_SEC)));
|
||||||
|
else
|
||||||
|
log_info("Block level copying and synchronization of partition %" PRIu64 " complete in %s.",
|
||||||
|
p->partno, FORMAT_TIMESPAN(time_spent, 0));
|
||||||
|
|
||||||
if (p->siblings[VERITY_HASH] && !partition_type_defer(&p->siblings[VERITY_HASH]->type)) {
|
if (p->siblings[VERITY_HASH] && !partition_type_defer(&p->siblings[VERITY_HASH]->type)) {
|
||||||
r = partition_format_verity_hash(context, p->siblings[VERITY_HASH],
|
r = partition_format_verity_hash(context, p->siblings[VERITY_HASH],
|
||||||
/* node = */ NULL, partition_target_path(t));
|
/* node = */ NULL, partition_target_path(t));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user