From: Eric Biggers <ebiggers@kernel.org>
To: 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>
Cc: Sami Tolvanen <samitolvanen@google.com>,
linux-kernel@vger.kernel.org, Eric Biggers <ebiggers@kernel.org>
Subject: [PATCH] dm-verity: consolidate the BH and normal work structs
Date: Sun, 11 Jan 2026 12:25:30 -0800 [thread overview]
Message-ID: <20260111202530.52665-1-ebiggers@kernel.org> (raw)
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
next reply other threads:[~2026-01-11 20:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-11 20:25 Eric Biggers [this message]
2026-01-23 22:45 ` [PATCH] dm-verity: consolidate the BH and normal work structs Sami Tolvanen
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=20260111202530.52665-1-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=agk@redhat.com \
--cc=bmarzins@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=samitolvanen@google.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