[PATCH 1/3] dm: move dm_stats_account_io before generic_end_io_acct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make sure that the statistics are not updated while the device is
suspended. So, we move statistics update before generic_end_io_acct.

Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>

---
 drivers/md/dm.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Index: linux-dm/drivers/md/dm.c
===================================================================
--- linux-dm.orig/drivers/md/dm.c	2018-11-15 21:56:36.000000000 +0100
+++ linux-dm/drivers/md/dm.c	2018-11-15 21:56:36.000000000 +0100
@@ -674,6 +674,11 @@ static void end_io_acct(struct dm_io *io
 	struct bio *bio = io->orig_bio;
 	unsigned long duration = jiffies - io->start_time;
 
+	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),
+				    true, duration, &io->stats_aux);
+
 	/*
 	 * make sure that atomic_dec in generic_end_io_acct is not reordered
 	 * with previous writes
@@ -687,11 +692,6 @@ static void end_io_acct(struct dm_io *io
 	 */
 	smp_mb__after_atomic();
 
-	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),
-				    true, duration, &io->stats_aux);
-
 	/* nudge anyone waiting on suspend queue */
 	if (unlikely(waitqueue_active(&md->wait))) {
 		if (!md_in_flight(md))




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux