Skip to content

Commit b992b40

Browse files
Ming LeiMike Snitzer
authored andcommitted
dm: don't pass bio to __dm_start_io_acct and dm_end_io_acct
dm->orig_bio is always passed to __dm_start_io_acct and dm_end_io_acct, so it isn't necessary to take one bio parameter for the two helpers. Signed-off-by: Ming Lei <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent bdb3475 commit b992b40

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

drivers/md/dm.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -531,16 +531,13 @@ static void dm_io_acct(bool end, struct mapped_device *md, struct bio *bio,
531531
bio->bi_iter.bi_size = bi_size;
532532
}
533533

534-
static void __dm_start_io_acct(struct dm_io *io, struct bio *bio)
534+
static void __dm_start_io_acct(struct dm_io *io)
535535
{
536-
dm_io_acct(false, io->md, bio, io->start_time, &io->stats_aux);
536+
dm_io_acct(false, io->md, io->orig_bio, io->start_time, &io->stats_aux);
537537
}
538538

539539
static void dm_start_io_acct(struct dm_io *io, struct bio *clone)
540540
{
541-
/* Must account IO to DM device in terms of orig_bio */
542-
struct bio *bio = io->orig_bio;
543-
544541
/*
545542
* Ensure IO accounting is only ever started once.
546543
*/
@@ -558,12 +555,12 @@ static void dm_start_io_acct(struct dm_io *io, struct bio *clone)
558555
spin_unlock_irqrestore(&io->lock, flags);
559556
}
560557

561-
__dm_start_io_acct(io, bio);
558+
__dm_start_io_acct(io);
562559
}
563560

564-
static void dm_end_io_acct(struct dm_io *io, struct bio *bio)
561+
static void dm_end_io_acct(struct dm_io *io)
565562
{
566-
dm_io_acct(true, io->md, bio, io->start_time, &io->stats_aux);
563+
dm_io_acct(true, io->md, io->orig_bio, io->start_time, &io->stats_aux);
567564
}
568565

569566
static struct dm_io *alloc_io(struct mapped_device *md, struct bio *bio)
@@ -899,14 +896,14 @@ static void dm_io_complete(struct dm_io *io)
899896

900897
io_error = io->status;
901898
if (dm_io_flagged(io, DM_IO_ACCOUNTED))
902-
dm_end_io_acct(io, bio);
899+
dm_end_io_acct(io);
903900
else if (!io_error) {
904901
/*
905902
* Must handle target that DM_MAPIO_SUBMITTED only to
906903
* then bio_endio() rather than dm_submit_bio_remap()
907904
*/
908-
__dm_start_io_acct(io, bio);
909-
dm_end_io_acct(io, bio);
905+
__dm_start_io_acct(io);
906+
dm_end_io_acct(io);
910907
}
911908
free_io(io);
912909
smp_wmb();

0 commit comments

Comments
 (0)