public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sami Tolvanen <samitolvanen@google.com>
To: Eric Biggers <ebiggers@kernel.org>
Cc: dm-devel@lists.linux.dev, Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>,
	Mikulas Patocka <mpatocka@redhat.com>,
	Benjamin Marzinski <bmarzins@redhat.com>,
	Eran Messeri <eranm@google.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/7] dm-verity: make dm_verity_fec_io::bufs variable-length
Date: Fri, 19 Dec 2025 20:07:08 +0000	[thread overview]
Message-ID: <20251219200708.GA2662043@google.com> (raw)
In-Reply-To: <20251219192909.385494-3-ebiggers@kernel.org>

On Fri, Dec 19, 2025 at 11:29:04AM -0800, Eric Biggers wrote:
> 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>

Sami

  reply	other threads:[~2025-12-19 20:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-19 19:29 [PATCH v2 0/7] dm-verity: FEC optimizations and fixes Eric Biggers
2025-12-19 19:29 ` [PATCH v2 1/7] dm-verity: move dm_verity_fec_io to mempool Eric Biggers
2025-12-19 19:29 ` [PATCH v2 2/7] dm-verity: make dm_verity_fec_io::bufs variable-length Eric Biggers
2025-12-19 20:07   ` Sami Tolvanen [this message]
2025-12-19 19:29 ` [PATCH v2 3/7] dm-verity: remove unnecessary condition for verity_fec_finish_io() Eric Biggers
2025-12-19 19:29 ` [PATCH v2 4/7] dm-verity: remove unnecessary ifdef around verity_fec_decode() Eric Biggers
2025-12-19 19:29 ` [PATCH v2 5/7] dm-verity: make verity_fec_is_enabled() an inline function Eric Biggers
2025-12-19 19:29 ` [PATCH v2 6/7] dm-verity: correctly handle dm_bufio_client_create() failure Eric Biggers
2025-12-19 19:29 ` [PATCH v2 7/7] dm-verity: allow REED_SOLOMON to be 'm' if DM_VERITY is 'm' Eric Biggers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251219200708.GA2662043@google.com \
    --to=samitolvanen@google.com \
    --cc=agk@redhat.com \
    --cc=bmarzins@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=ebiggers@kernel.org \
    --cc=eranm@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox