* [PATCH] dm-verity: consolidate the BH and normal work structs
@ 2026-01-11 20:25 Eric Biggers
2026-01-23 22:45 ` Sami Tolvanen
0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2026-01-11 20:25 UTC (permalink / raw)
To: dm-devel, Alasdair Kergon, Mike Snitzer, Mikulas Patocka,
Benjamin Marzinski
Cc: Sami Tolvanen, linux-kernel, Eric Biggers
Since each dm_verity_io is never on both the BH and normal workqueues at
the same time, there's no need for two different work_structs. Replace
the 'bh_work' and 'work' fields with just 'work'.
Note: this is correct even though it means 'work' may be reused while
verity_bh_work() is running. The workqueue API allows work functions to
reuse or free their work_struct, and many workqueue users rely on that.
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
drivers/md/dm-verity-target.c | 8 ++++----
drivers/md/dm-verity.h | 1 -
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
index 777a0ebe8536..8f262ae04064 100644
--- a/drivers/md/dm-verity-target.c
+++ b/drivers/md/dm-verity-target.c
@@ -649,11 +649,11 @@ static void verity_work(struct work_struct *w)
verity_finish_io(io, errno_to_blk_status(verity_verify_io(io)));
}
static void verity_bh_work(struct work_struct *w)
{
- struct dm_verity_io *io = container_of(w, struct dm_verity_io, bh_work);
+ struct dm_verity_io *io = container_of(w, struct dm_verity_io, work);
int err;
io->in_bh = true;
err = verity_verify_io(io);
if (err == -EAGAIN || err == -ENOMEM) {
@@ -688,14 +688,14 @@ static void verity_end_io(struct bio *bio)
}
if (static_branch_unlikely(&use_bh_wq_enabled) && io->v->use_bh_wq &&
verity_use_bh(bytes, ioprio)) {
if (in_hardirq() || irqs_disabled()) {
- INIT_WORK(&io->bh_work, verity_bh_work);
- queue_work(system_bh_wq, &io->bh_work);
+ INIT_WORK(&io->work, verity_bh_work);
+ queue_work(system_bh_wq, &io->work);
} else {
- verity_bh_work(&io->bh_work);
+ verity_bh_work(&io->work);
}
} else {
INIT_WORK(&io->work, verity_work);
queue_work(io->v->verify_wq, &io->work);
}
diff --git a/drivers/md/dm-verity.h b/drivers/md/dm-verity.h
index 4ad7ce3dae0a..d6bfabb27113 100644
--- a/drivers/md/dm-verity.h
+++ b/drivers/md/dm-verity.h
@@ -107,11 +107,10 @@ struct dm_verity_io {
#ifdef CONFIG_DM_VERITY_FEC
struct dm_verity_fec_io *fec_io;
#endif
struct work_struct work;
- struct work_struct bh_work;
u8 tmp_digest[HASH_MAX_DIGESTSIZE];
/*
* This is the queue of data blocks that are pending verification. When
base-commit: 8fbb8fe75d4cf92eaa7b21828ec39c1bf79a262f
--
2.52.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] dm-verity: consolidate the BH and normal work structs
2026-01-11 20:25 [PATCH] dm-verity: consolidate the BH and normal work structs Eric Biggers
@ 2026-01-23 22:45 ` Sami Tolvanen
0 siblings, 0 replies; 2+ messages in thread
From: Sami Tolvanen @ 2026-01-23 22:45 UTC (permalink / raw)
To: Eric Biggers
Cc: dm-devel, Alasdair Kergon, Mike Snitzer, Mikulas Patocka,
Benjamin Marzinski, linux-kernel
On Sun, Jan 11, 2026 at 12:26 PM Eric Biggers <ebiggers@kernel.org> wrote:
>
> Since each dm_verity_io is never on both the BH and normal workqueues at
> the same time, there's no need for two different work_structs. Replace
> the 'bh_work' and 'work' fields with just 'work'.
>
> Note: this is correct even though it means 'work' may be reused while
> verity_bh_work() is running. The workqueue API allows work functions to
> reuse or free their work_struct, and many workqueue users rely on that.
>
> Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Sami
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-23 22:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-11 20:25 [PATCH] dm-verity: consolidate the BH and normal work structs Eric Biggers
2026-01-23 22:45 ` Sami Tolvanen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox