* [PATCH 0/2] Code cleanup and simplification
@ 2025-06-11 1:14 Damien Le Moal
2025-06-11 1:14 ` [PATCH 1/2] dm: Remove unnecessary return in dm_zone_endio() Damien Le Moal
2025-06-11 1:14 ` [PATCH 2/2] dm: Simplify dm_io_complete() Damien Le Moal
0 siblings, 2 replies; 5+ messages in thread
From: Damien Le Moal @ 2025-06-11 1:14 UTC (permalink / raw)
To: dm-devel, Mike Snitzer, Mikulas Patocka
Mike, Mikulas,
A couple of patches to cleanup/simplify code. No functional change.
Damien Le Moal (2):
dm: Remove unnecessary return in dm_zone_endio()
dm: Simplify dm_io_complete()
drivers/md/dm-zone.c | 2 --
drivers/md/dm.c | 11 ++---------
2 files changed, 2 insertions(+), 11 deletions(-)
--
2.49.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] dm: Remove unnecessary return in dm_zone_endio()
2025-06-11 1:14 [PATCH 0/2] Code cleanup and simplification Damien Le Moal
@ 2025-06-11 1:14 ` Damien Le Moal
2025-06-11 3:29 ` Christoph Hellwig
2025-06-11 1:14 ` [PATCH 2/2] dm: Simplify dm_io_complete() Damien Le Moal
1 sibling, 1 reply; 5+ messages in thread
From: Damien Le Moal @ 2025-06-11 1:14 UTC (permalink / raw)
To: dm-devel, Mike Snitzer, Mikulas Patocka
The return statement at the end of dm_zone_endio() is not needed.
Remove it.
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
drivers/md/dm-zone.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/md/dm-zone.c b/drivers/md/dm-zone.c
index 97ba70190821..4678076f5972 100644
--- a/drivers/md/dm-zone.c
+++ b/drivers/md/dm-zone.c
@@ -467,8 +467,6 @@ void dm_zone_endio(struct dm_io *io, struct bio *clone)
bdev_offset_from_zone_start(disk->part0,
clone->bi_iter.bi_sector);
}
-
- return;
}
static int dm_zone_need_reset_cb(struct blk_zone *zone, unsigned int idx,
--
2.49.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] dm: Simplify dm_io_complete()
2025-06-11 1:14 [PATCH 0/2] Code cleanup and simplification Damien Le Moal
2025-06-11 1:14 ` [PATCH 1/2] dm: Remove unnecessary return in dm_zone_endio() Damien Le Moal
@ 2025-06-11 1:14 ` Damien Le Moal
2025-06-11 3:29 ` Christoph Hellwig
1 sibling, 1 reply; 5+ messages in thread
From: Damien Le Moal @ 2025-06-11 1:14 UTC (permalink / raw)
To: dm-devel, Mike Snitzer, Mikulas Patocka
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>
---
drivers/md/dm.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index f1da8fde549c..21920991ab28 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -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));
}
/*
--
2.49.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-06-11 3:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-11 1:14 [PATCH 0/2] Code cleanup and simplification Damien Le Moal
2025-06-11 1:14 ` [PATCH 1/2] dm: Remove unnecessary return in dm_zone_endio() Damien Le Moal
2025-06-11 3:29 ` Christoph Hellwig
2025-06-11 1:14 ` [PATCH 2/2] dm: Simplify dm_io_complete() Damien Le Moal
2025-06-11 3:29 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).