]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dm: Simplify dm_io_complete()
authorDamien Le Moal <dlemoal@kernel.org>
Wed, 11 Jun 2025 01:14:57 +0000 (10:14 +0900)
committerMikulas Patocka <mpatocka@redhat.com>
Fri, 27 Jun 2025 10:59:22 +0000 (12:59 +0200)
The local variable first_requeue is not needed since it is always equal
to dm_io_flagged(io, DM_IO_WAS_SPLIT). Call __dm_io_complete() passing
this value directly and remove first_requeue.

Also declare dm_io_complete() as inline to make sure it is inlined in
its single call site, thus avoiding the cost of a function call.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm.c

index 1726f0f828cc948e5698645273c3b83f0381bb0d..55579adbeb3fb46ee63534b11e766896ae8fe1f4 100644 (file)
@@ -1024,10 +1024,8 @@ static void dm_wq_requeue_work(struct work_struct *work)
  *
  * 2) io->orig_bio points to new cloned bio which matches the requeued dm_io.
  */
-static void dm_io_complete(struct dm_io *io)
+static inline void dm_io_complete(struct dm_io *io)
 {
-       bool first_requeue;
-
        /*
         * Only dm_io that has been split needs two stage requeue, otherwise
         * we may run into long bio clone chain during suspend and OOM could
@@ -1036,12 +1034,7 @@ static void dm_io_complete(struct dm_io *io)
         * Also flush data dm_io won't be marked as DM_IO_WAS_SPLIT, so they
         * also aren't handled via the first stage requeue.
         */
-       if (dm_io_flagged(io, DM_IO_WAS_SPLIT))
-               first_requeue = true;
-       else
-               first_requeue = false;
-
-       __dm_io_complete(io, first_requeue);
+       __dm_io_complete(io, dm_io_flagged(io, DM_IO_WAS_SPLIT));
 }
 
 /*