[PATCH RFC 1/7] block: export part_stat_read_all

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

 



For mirrored raid profiles such as raid1, raid1c3, raid1c4, and raid10,
currently, btrfs use the PID method to determine which one of the
mirrored devices to use to read the block. However, the PID method is
not the best choice if the devices are heterogeneous in terms of type,
speed, and size, as we may end up reading from the slower device.

Export the function part_stat_read_all() so that the btrfs can determine
the device with the least average wait time to use.

Cc: linux-block@xxxxxxxxxxxxxxx
Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
---
 block/genhd.c         | 3 ++-
 include/linux/genhd.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/block/genhd.c b/block/genhd.c
index 0a273211fec2..81b10b90de71 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -89,7 +89,7 @@ const char *bdevname(struct block_device *bdev, char *buf)
 }
 EXPORT_SYMBOL(bdevname);
 
-static void part_stat_read_all(struct hd_struct *part, struct disk_stats *stat)
+void part_stat_read_all(struct hd_struct *part, struct disk_stats *stat)
 {
 	int cpu;
 
@@ -108,6 +108,7 @@ static void part_stat_read_all(struct hd_struct *part, struct disk_stats *stat)
 		stat->io_ticks += ptr->io_ticks;
 	}
 }
+EXPORT_SYMBOL_GPL(part_stat_read_all);
 
 static unsigned int part_in_flight(struct hd_struct *part)
 {
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 38f23d757013..eb77e0ac8a82 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -281,6 +281,7 @@ struct disk_part_iter {
 	unsigned int		flags;
 };
 
+extern void part_stat_read_all(struct hd_struct *part, struct disk_stats *stat);
 extern void disk_part_iter_init(struct disk_part_iter *piter,
 				 struct gendisk *disk, unsigned int flags);
 extern struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter);
-- 
2.25.1




[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