diff mbox series

[2/2] fixup: btrfs: introduce RAID1 round-robin read balancing

Message ID bfd1e231b875ad2b3a7d9b1749b9a02428dd7426.1736369474.git.anand.jain@oracle.com (mailing list archive)
State New
Headers show
Series btrfs: migrate tracking read blocks from fs_devices to | expand

Commit Message

Anand Jain Jan. 8, 2025, 9:01 p.m. UTC
The member stats_read_blocks has been moved to fs_info, so update its
usage accordingly in btrfs_read_rr().

This is based on the `for-next` branch in the repo github.com/btrfs/linux.git.

Fixes: ee37a901a9d2 btrfs: introduce RAID1 round-robin read balancing
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/volumes.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index e0c64246f8f6..a594f66daedf 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -6018,21 +6018,22 @@  static int btrfs_read_rr(const struct btrfs_chunk_map *map, int first, int num_s
 {
 	struct stripe_mirror stripes[BTRFS_RAID1_MAX_MIRRORS] = { 0 };
 	struct btrfs_device *device  = map->stripes[first].dev;
-	struct btrfs_fs_devices *fs_devices = device->fs_devices;
+	struct btrfs_fs_info *fs_info = device->fs_devices->fs_info;
 	unsigned int read_cycle;
 	unsigned int total_reads;
 	unsigned int min_reads_per_dev;
 
-	total_reads = percpu_counter_sum(&fs_devices->stats_read_blocks);
-	min_reads_per_dev = READ_ONCE(fs_devices->rr_min_contig_read) >>
-			    fs_devices->fs_info->sectorsize_bits;
+	total_reads = percpu_counter_sum(&fs_info->stats_read_blocks);
+	min_reads_per_dev = READ_ONCE(fs_info->fs_devices->rr_min_contig_read) >>
+						       fs_info->sectorsize_bits;
 
 	for (int index = 0, i = first; i < first + num_stripes; i++) {
 		stripes[index].devid = map->stripes[i].dev->devid;
 		stripes[index].num = i;
 		index++;
 	}
-	sort(stripes, num_stripes, sizeof(struct stripe_mirror), btrfs_cmp_devid, NULL);
+	sort(stripes, num_stripes, sizeof(struct stripe_mirror),
+	     btrfs_cmp_devid, NULL);
 
 	read_cycle = total_reads / min_reads_per_dev;
 	return stripes[read_cycle % num_stripes].num;