Skip to contentSkip to conversation

md: match the type of variables to percpu_ref

PATCH In review tada keisuke 1 participant 1 message Apr 18, 2024 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH v2 5/11 md: match the type of variables to percpu_ref

This patch depends on patch 04.

The counter size of percpu_ref is different from that of atomic_t. This is the only place where the value of nr_pending is read. The others are used for zero check and type has no effect.

---
 drivers/md/md.h     | 4 ++--
 drivers/md/raid1.c  | 4 ++--
 drivers/md/raid10.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/md/md.h +2 -2
index 2eaf8606af9e..783fec1f1445 100644
@@ -231,9 +231,9 @@ static inline bool nr_pending_is_not_zero(struct md_rdev *rdev)
 	return atomic_read(&rdev->nr_pending) != 0;
 }
 
-static inline unsigned int nr_pending_read(struct md_rdev *rdev)
+static inline unsigned long nr_pending_read(struct md_rdev *rdev)
 {
-	return atomic_read(&rdev->nr_pending);
+	return (unsigned long)atomic_read(&rdev->nr_pending);
 }
 
 static inline int is_badblock(struct md_rdev *rdev, sector_t s, int sectors,
drivers/md/raid1.c +2 -2
index 962cebbba6cd..12318fb15a88 100644
@@ -751,7 +751,7 @@ static bool rdev_readable(struct md_rdev *rdev, struct r1bio *r1_bio)
 struct read_balance_ctl {
 	sector_t closest_dist;
 	int closest_dist_disk;
-	int min_pending;
+	long min_pending;
 	int min_pending_disk;
 	int sequential_disk;
 	int readable_disks;
@@ -771,7 +771,7 @@ static int choose_best_rdev(struct r1conf *conf, struct r1bio *r1_bio)
 	for (disk = 0 ; disk < conf->raid_disks * 2 ; disk++) {
 		struct md_rdev *rdev;
 		sector_t dist;
-		unsigned int pending;
+		unsigned long pending;
 
 		if (r1_bio->bios[disk] == IO_BLOCKED)
 			continue;
drivers/md/raid10.c +2 -2
index 2b1238befd8a..b91dd6c0be5a 100644
@@ -733,7 +733,7 @@ static struct md_rdev *read_balance(struct r10conf *conf,
 	int do_balance;
 	int best_dist_slot, best_pending_slot;
 	bool has_nonrot_disk = false;
-	unsigned int min_pending;
+	unsigned long min_pending;
 	struct geom *geo = &conf->geo;
 
 	raid10_find_phys(conf, r10_bio);
@@ -753,7 +753,7 @@ static struct md_rdev *read_balance(struct r10conf *conf,
 		sector_t first_bad;
 		int bad_sectors;
 		sector_t dev_sector;
-		unsigned int pending;
+		unsigned long pending;
 		bool nonrot;
 
 		if (r10_bio->devs[slot].bio == IO_BLOCKED)
Signature · 1 line
2.34.1