summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2022-04-12 10:56:14 +0200
committerMike Snitzer <snitzer@kernel.org>2022-05-05 23:31:36 +0200
commit2e803cd99ba8b7a84be155c1d5ee28d363fdbe44 (patch)
tree2255fec7acdf7812b8b30c16928afca2ac4286a7 /drivers/md
parentdm: improve bio splitting and associated IO accounting (diff)
downloadlinux-2e803cd99ba8b7a84be155c1d5ee28d363fdbe44.tar.xz
linux-2e803cd99ba8b7a84be155c1d5ee28d363fdbe44.zip
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 <damien.lemoal@opensource.wdc.com> Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-core.h7
-rw-r--r--drivers/md/dm-zone.c10
-rw-r--r--drivers/md/dm.c7
3 files changed, 6 insertions, 18 deletions
diff --git a/drivers/md/dm-core.h b/drivers/md/dm-core.h
index 37ddedf61249..d2d188c9b632 100644
--- a/drivers/md/dm-core.h
+++ b/drivers/md/dm-core.h
@@ -296,13 +296,6 @@ static inline void dm_io_set_flag(struct dm_io *io, unsigned int 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)
{
return &container_of(kobj, struct dm_kobject_holder, kobj)->completion;
diff --git a/drivers/md/dm-zone.c b/drivers/md/dm-zone.c
index 57daa86c19cf..3e7b1fe1580b 100644
--- a/drivers/md/dm-zone.c
+++ b/drivers/md/dm-zone.c
@@ -550,13 +550,6 @@ int dm_zone_map_bio(struct dm_target_io *tio)
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 */
r = ti->type->map(ti, clone);
switch (r) {
@@ -587,9 +580,6 @@ int dm_zone_map_bio(struct dm_target_io *tio)
break;
}
- /* Drop the extra reference on the IO */
- dm_io_dec_pending(io, sts);
-
if (sts != BLK_STS_OK)
return DM_MAPIO_KILL;
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 7a1a83b58677..7cae8235fbe1 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -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
* 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)
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))
dm_io_set_error(io, error);