]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
UBUNTU: hio: Update io stat accounting for 4.14
authorSeth Forshee <seth.forshee@canonical.com>
Mon, 23 Oct 2017 17:43:58 +0000 (12:43 -0500)
committerAndrea Righi <andrea.righi@canonical.com>
Mon, 25 Nov 2019 13:56:31 +0000 (14:56 +0100)
In 4.14-rc1 invflight accounting calls were updated to require a
request queue be passed, and part_(inc|dec)_in_flight() were
moved out of linux/genhd.h and are not exported to modules. Make
a couple of updates to cope with these changes:

 - Pass the rq to part_round_stats for 4.14 and later.

 - Use generic_(start|end)_io_acct() helpers for io accounting
   with 4.14 and later. These do exactly what was being done with
   the no-longer-exported interfaces.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
ubuntu/hio/hio.c

index 299aec26c7be5bc68cbee6de8129acd08a38e687..855684738638d97e32b11d9ba424ea4617579770 100644 (file)
@@ -4135,7 +4135,10 @@ static void ssd_end_io_acct(struct ssd_cmd *cmd)
        unsigned long flag;
 #endif
        
-#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)) || (defined RHEL_MAJOR && RHEL_MAJOR == 6 && RHEL_MINOR >= 7))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
+       struct hd_struct *part = disk_map_sector_rcu(dev->gd, bio_start(bio));
+       generic_end_io_acct(dev->rq, rw, part, cmd->start_time);
+#elif ((LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)) || (defined RHEL_MAJOR && RHEL_MAJOR == 6 && RHEL_MINOR >= 7))
        int cpu = part_stat_lock();
        struct hd_struct *part = disk_map_sector_rcu(dev->gd, bio_start(bio));
        part_round_stats(cpu, part);
@@ -4192,7 +4195,10 @@ static void ssd_start_io_acct(struct ssd_cmd *cmd)
        unsigned long flag;
 #endif
 
-#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)) || (defined RHEL_MAJOR && RHEL_MAJOR == 6 && RHEL_MINOR >= 7))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
+       struct hd_struct *part = disk_map_sector_rcu(dev->gd, bio_start(bio));
+       generic_start_io_acct(dev->rq, rw, bio_sectors(bio), part);
+#elif ((LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)) || (defined RHEL_MAJOR && RHEL_MAJOR == 6 && RHEL_MINOR >= 7))
        int cpu = part_stat_lock();
        struct hd_struct *part = disk_map_sector_rcu(dev->gd, bio_start(bio));
        part_round_stats(cpu, part);
@@ -6088,7 +6094,11 @@ static int ssd_update_smart(struct ssd_device *dev, struct ssd_smart *smart)
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
        cpu = part_stat_lock();
        part = &dev->gd->part0;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
+       part_round_stats(dev->rq, cpu, part);
+#else
        part_round_stats(cpu, part);
+#endif
        part_stat_unlock();
 
        smart->io_stat.nr_read += part_stat_read(part, ios[READ]);