[PATCH 05/11] md: match the type of variables to percpu_ref

From: tada keisuke
Date: Tue Mar 26 2024 - 07:19:10 EST


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.

Signed-off-by: Keisuke TADA <keisuke1.tada@xxxxxxxxxx>
Signed-off-by: Toshifumi OHTAKE <toshifumi.ootake@xxxxxxxxxx>
---
drivers/md/md.h | 4 ++--
drivers/md/raid1.c | 4 ++--
drivers/md/raid10.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/md/md.h b/drivers/md/md.h
index ed7e36212d58..724439400ed1 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -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,
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 9cf56bc1340f..43cc36fec7a2 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -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;
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index d8c4bf608767..cd5094c4df50 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -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)
--
2.34.1