Skip to content

Commit 2e803cd

Browse files
Ming LeiMike Snitzer
authored andcommitted
dm: don't grab target io reference in dm_zone_map_bio
dm_zone_map_bio() is only called from __map_bio in which the io's reference is grabbed already, and the reference won't be released until the bio is submitted, so not necessary to do it dm_zone_map_bio any more. Reviewed-by: Damien Le Moal <[email protected]> Tested-by: Damien Le Moal <[email protected]> Signed-off-by: Ming Lei <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent 7dd76d1 commit 2e803cd

File tree

3 files changed

+6
-18
lines changed

3 files changed

+6
-18
lines changed

drivers/md/dm-core.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -296,13 +296,6 @@ static inline void dm_io_set_flag(struct dm_io *io, unsigned int bit)
296296
io->flags |= (1U << bit);
297297
}
298298

299-
static inline void dm_io_inc_pending(struct dm_io *io)
300-
{
301-
atomic_inc(&io->io_count);
302-
}
303-
304-
void dm_io_dec_pending(struct dm_io *io, blk_status_t error);
305-
306299
static inline struct completion *dm_get_completion_from_kobject(struct kobject *kobj)
307300
{
308301
return &container_of(kobj, struct dm_kobject_holder, kobj)->completion;

drivers/md/dm-zone.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -550,13 +550,6 @@ int dm_zone_map_bio(struct dm_target_io *tio)
550550
return DM_MAPIO_KILL;
551551
}
552552

553-
/*
554-
* The target map function may issue and complete the IO quickly.
555-
* Take an extra reference on the IO to make sure it does disappear
556-
* until we run dm_zone_map_bio_end().
557-
*/
558-
dm_io_inc_pending(io);
559-
560553
/* Let the target do its work */
561554
r = ti->type->map(ti, clone);
562555
switch (r) {
@@ -587,9 +580,6 @@ int dm_zone_map_bio(struct dm_target_io *tio)
587580
break;
588581
}
589582

590-
/* Drop the extra reference on the IO */
591-
dm_io_dec_pending(io, sts);
592-
593583
if (sts != BLK_STS_OK)
594584
return DM_MAPIO_KILL;
595585

drivers/md/dm.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,11 @@ static void dm_io_complete(struct dm_io *io)
955955
}
956956
}
957957

958+
static void dm_io_inc_pending(struct dm_io *io)
959+
{
960+
atomic_inc(&io->io_count);
961+
}
962+
958963
/*
959964
* Decrements the number of outstanding ios that a bio has been
960965
* cloned into, completing the original io if necc.
@@ -978,7 +983,7 @@ static void dm_io_set_error(struct dm_io *io, blk_status_t error)
978983
spin_unlock_irqrestore(&io->lock, flags);
979984
}
980985

981-
void dm_io_dec_pending(struct dm_io *io, blk_status_t error)
986+
static void dm_io_dec_pending(struct dm_io *io, blk_status_t error)
982987
{
983988
if (unlikely(error))
984989
dm_io_set_error(io, error);

0 commit comments

Comments
 (0)