* [PATCH 1/4] dm: refactor start_io_acct
@ 2019-02-14 15:00 Mikulas Patocka
0 siblings, 0 replies; only message in thread
From: Mikulas Patocka @ 2019-02-14 15:00 UTC (permalink / raw)
To: Mike Snitzer, Alasdair G Kergon; +Cc: dm-devel, Mikulas Patocka
[-- Attachment #1: refactor-start-io-acct.patch --]
[-- Type: text/plain, Size: 1891 bytes --]
This patch refactors start_io_acct, so that it doesn't take a pointer to
struct dm_io - so that it could be used in the following patch.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
---
drivers/md/dm.c | 30 ++++++++++++------------------
1 file changed, 12 insertions(+), 18 deletions(-)
Index: linux-2.6/drivers/md/dm.c
===================================================================
--- linux-2.6.orig/drivers/md/dm.c 2019-02-05 12:07:21.000000000 +0100
+++ linux-2.6/drivers/md/dm.c 2019-02-05 14:31:56.000000000 +0100
@@ -580,7 +580,10 @@ out:
return r;
}
-static void start_io_acct(struct dm_io *io);
+static void start_io_acct(struct mapped_device *md, struct bio *bio)
+{
+ generic_start_io_acct(md->queue, bio_op(bio), bio_sectors(bio), &dm_disk(md)->part0);
+}
static struct dm_io *alloc_io(struct mapped_device *md, struct bio *bio)
{
@@ -604,7 +607,14 @@ static struct dm_io *alloc_io(struct map
io->md = md;
spin_lock_init(&io->endio_lock);
- start_io_acct(io);
+ io->start_time = jiffies;
+
+ start_io_acct(md, bio);
+
+ if (unlikely(dm_stats_used(&md->stats)))
+ dm_stats_account_io(&md->stats, bio_data_dir(bio),
+ bio->bi_iter.bi_sector, bio_sectors(bio),
+ false, 0, &io->stats_aux);
return io;
}
@@ -668,22 +678,6 @@ static bool md_in_flight(struct mapped_d
return md_in_flight_bios(md);
}
-static void start_io_acct(struct dm_io *io)
-{
- struct mapped_device *md = io->md;
- struct bio *bio = io->orig_bio;
-
- io->start_time = jiffies;
-
- generic_start_io_acct(md->queue, bio_op(bio), bio_sectors(bio),
- &dm_disk(md)->part0);
-
- if (unlikely(dm_stats_used(&md->stats)))
- dm_stats_account_io(&md->stats, bio_data_dir(bio),
- bio->bi_iter.bi_sector, bio_sectors(bio),
- false, 0, &io->stats_aux);
-}
-
static void end_io_acct(struct dm_io *io)
{
struct mapped_device *md = io->md;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-02-14 15:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-14 15:00 [PATCH 1/4] dm: refactor start_io_acct Mikulas Patocka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox