[PATCH v2 5/7] dm-verity: make verity_fec_is_enabled() an inline function

Eric Biggers
2025-12-19T19:32:22Z

verity_fec_is_enabled() is very short and is called in quite a few
places, so make it an inline function.

Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
drivers/md/dm-verity-fec.c | 8 --------
drivers/md/dm-verity-fec.h | 6 +++++-
2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/md/dm-verity-fec.c b/drivers/md/dm-verity-fec.c
index 6d0b5b4b2699..ef9970b889aa 100644
--- a/drivers/md/dm-verity-fec.c
+++ b/drivers/md/dm-verity-fec.c
@@ -20,18 +20,10 @@
static inline unsigned int fec_max_nbufs(struct dm_verity *v)
{
return 1 << (v->data_dev_block_bits - DM_VERITY_FEC_BUF_RS_BITS);
}

-/*
- * If error correction has been configured, returns true.
- */
-bool verity_fec_is_enabled(struct dm_verity *v)
-{
- return v->fec && v->fec->dev;
-}
-
/*
* Return an interleaved offset for a byte in RS block.
*/
static inline u64 fec_interleave(struct dm_verity *v, u64 offset)
{
diff --git a/drivers/md/dm-verity-fec.h b/drivers/md/dm-verity-fec.h
index 571097438311..35d28d9f8a9b 100644
--- a/drivers/md/dm-verity-fec.h
+++ b/drivers/md/dm-verity-fec.h
@@ -64,11 +64,15 @@ struct dm_verity_fec_io {
#ifdef CONFIG_DM_VERITY_FEC

/* each feature parameter requires a value */
#define DM_VERITY_OPTS_FEC 8

-extern bool verity_fec_is_enabled(struct dm_verity *v);
+/* Returns true if forward error correction is enabled. */
+static inline bool verity_fec_is_enabled(struct dm_verity *v)
+{
+ return v->fec && v->fec->dev;
+}

extern int verity_fec_decode(struct dm_verity *v, struct dm_verity_io *io,
enum verity_block_type type, const u8 *want_digest,
sector_t block, u8 *dest);

--
2.52.0