]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dm-verity: consolidate the BH and normal work structs
authorEric Biggers <ebiggers@kernel.org>
Sun, 11 Jan 2026 20:25:30 +0000 (12:25 -0800)
committerMikulas Patocka <mpatocka@redhat.com>
Wed, 14 Jan 2026 12:18:08 +0000 (13:18 +0100)
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>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-verity-target.c
drivers/md/dm-verity.h

index 91fb465274bad96a1c6629e9304eb20274d6302d..e28e84562afbeb2a5d1505159760eeac32814de4 100644 (file)
@@ -651,7 +651,7 @@ static void verity_work(struct work_struct *w)
 
 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;
@@ -690,10 +690,10 @@ 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);
index 4ad7ce3dae0a569720f141757e450bc3efa4ad27..d6bfabb27113b95f697d882c18fdb288733f4a84 100644 (file)
@@ -109,7 +109,6 @@ struct dm_verity_io {
 #endif
 
        struct work_struct work;
-       struct work_struct bh_work;
 
        u8 tmp_digest[HASH_MAX_DIGESTSIZE];