Optimize LUKS2 metadata writes.

LUKS2 supports several jsom area length configurations. With
the largest size supported in megabytes we do not want to write full
metadata area unconditionaly (current code) with every metadata
update. This might generate noticeble overhead with LUKS2
reencryption.

With this patch we write only the real used json area
length plus necessary padding to overwrite remaining previous
metadata stored on the disk.

During LUKS2 format and LUKS2 autorecovery we always overwrite
whole json metadata area no matter the used size.
This commit is contained in:
Ondrej Kozina
2025-02-10 14:13:05 +01:00
committed by Milan Broz
parent 000f03ad31
commit cb0f568932
2 changed files with 64 additions and 28 deletions

View File

@@ -111,6 +111,7 @@ struct luks2_hdr {
char uuid[LUKS2_UUID_L];
void *jobj;
void *jobj_rollback;
size_t on_disk_json_end_offset;
};
struct luks2_keyslot_params {