diff options
| author | Eric Biggers <ebiggers@kernel.org> | 2025-12-19 11:29:04 -0800 |
|---|---|---|
| committer | Mikulas Patocka <mpatocka@redhat.com> | 2026-01-04 20:35:32 +0100 |
| commit | 533e641b4587cfe144f413e50eb771433ea82845 (patch) | |
| tree | 6c25de50e5b19a2cef7766096b9e267d376879b1 /tools/perf/lib/Documentation/tutorial/git@git.tavy.me:linux.git | |
| parent | b140a921eadfeaf48238a3a6d2da2a5e6946a31b (diff) | |
dm-verity: make dm_verity_fec_io::bufs variable-length
When correcting a data block, the FEC code performs optimally when it
has enough buffers to hold all the needed RS blocks. That number of
buffers is '1 << (v->data_dev_block_bits - DM_VERITY_FEC_BUF_RS_BITS)'.
However, since v->data_dev_block_bits isn't a compile-time constant, the
code actually used PAGE_SHIFT instead.
With the traditional PAGE_SIZE == data_block_size == 4096, this was
fine. However, when PAGE_SIZE > data_block_size, this wastes space.
E.g., with data_block_size == 4096 && PAGE_SIZE == 16384, struct
dm_verity_fec_io is 9240 bytes, when in fact only 3096 bytes are needed.
Fix this by making dm_verity_fec_io::bufs a variable-length array.
This makes the macros DM_VERITY_FEC_BUF_MAX and
fec_for_each_extra_buffer() no longer apply, so remove them. For
consistency, and because DM_VERITY_FEC_BUF_PREALLOC is fixed at 1 and
was already assumed to be 1 (considering that mempool_alloc() shouldn't
be called in a loop), also remove the related macros
DM_VERITY_FEC_BUF_PREALLOC and fec_for_each_prealloc_buffer().
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Diffstat (limited to 'tools/perf/lib/Documentation/tutorial/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
