Commit 2e803cd9 authored by Ming Lei's avatar Ming Lei Committed by Mike Snitzer

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: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
Tested-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
parent 7dd76d1f
...@@ -296,13 +296,6 @@ static inline void dm_io_set_flag(struct dm_io *io, unsigned int bit) ...@@ -296,13 +296,6 @@ static inline void dm_io_set_flag(struct dm_io *io, unsigned int bit)
io->flags |= (1U << bit); io->flags |= (1U << bit);
} }
static inline void dm_io_inc_pending(struct dm_io *io)
{
atomic_inc(&io->io_count);
}
void dm_io_dec_pending(struct dm_io *io, blk_status_t error);
static inline struct completion *dm_get_completion_from_kobject(struct kobject *kobj) static inline struct completion *dm_get_completion_from_kobject(struct kobject *kobj)
{ {
return &container_of(kobj, struct dm_kobject_holder, kobj)->completion; return &container_of(kobj, struct dm_kobject_holder, kobj)->completion;
......
...@@ -550,13 +550,6 @@ int dm_zone_map_bio(struct dm_target_io *tio) ...@@ -550,13 +550,6 @@ int dm_zone_map_bio(struct dm_target_io *tio)
return DM_MAPIO_KILL; return DM_MAPIO_KILL;
} }
/*
* The target map function may issue and complete the IO quickly.
* Take an extra reference on the IO to make sure it does disappear
* until we run dm_zone_map_bio_end().
*/
dm_io_inc_pending(io);
/* Let the target do its work */ /* Let the target do its work */
r = ti->type->map(ti, clone); r = ti->type->map(ti, clone);
switch (r) { switch (r) {
...@@ -587,9 +580,6 @@ int dm_zone_map_bio(struct dm_target_io *tio) ...@@ -587,9 +580,6 @@ int dm_zone_map_bio(struct dm_target_io *tio)
break; break;
} }
/* Drop the extra reference on the IO */
dm_io_dec_pending(io, sts);
if (sts != BLK_STS_OK) if (sts != BLK_STS_OK)
return DM_MAPIO_KILL; return DM_MAPIO_KILL;
......
...@@ -955,6 +955,11 @@ static void dm_io_complete(struct dm_io *io) ...@@ -955,6 +955,11 @@ static void dm_io_complete(struct dm_io *io)
} }
} }
static void dm_io_inc_pending(struct dm_io *io)
{
atomic_inc(&io->io_count);
}
/* /*
* Decrements the number of outstanding ios that a bio has been * Decrements the number of outstanding ios that a bio has been
* cloned into, completing the original io if necc. * 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) ...@@ -978,7 +983,7 @@ static void dm_io_set_error(struct dm_io *io, blk_status_t error)
spin_unlock_irqrestore(&io->lock, flags); spin_unlock_irqrestore(&io->lock, flags);
} }
void dm_io_dec_pending(struct dm_io *io, blk_status_t error) static void dm_io_dec_pending(struct dm_io *io, blk_status_t error)
{ {
if (unlikely(error)) if (unlikely(error))
dm_io_set_error(io, error); dm_io_set_error(io, error);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment