[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251217120013.2616531-15-linan666@huaweicloud.com>
Date: Wed, 17 Dec 2025 20:00:12 +0800
From: linan666@...weicloud.com
To: song@...nel.org,
yukuai@...as.com
Cc: linux-raid@...r.kernel.org,
linux-kernel@...r.kernel.org,
xni@...hat.com,
linan666@...weicloud.com,
yangerkun@...wei.com,
yi.zhang@...wei.com
Subject: [PATCH 14/15] md/raid10: clean up sync IO size calculation in raid10_sync_request
From: Li Nan <linan122@...wei.com>
Use 'nr_sectors' directly for sync IO size calculation. Prepare folio
allocation failure fallback.
No functional changes.
Signed-off-by: Li Nan <linan122@...wei.com>
---
drivers/md/raid10.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index c3ef2ea38b08..f3e10e20ebb1 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -3618,28 +3618,24 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
}
}
- nr_sectors = 0;
if (sector_nr + max_sync < max_sector)
max_sector = sector_nr + max_sync;
do {
- int len = RESYNC_BLOCK_SIZE;
+ nr_sectors = max_sector - sector_nr;
- if (sector_nr + (len>>9) > max_sector)
- len = (max_sector - sector_nr) << 9;
- if (len == 0)
+ if (nr_sectors == 0)
break;
for (bio= biolist ; bio ; bio=bio->bi_next) {
struct resync_folio *rf = get_resync_folio(bio);
- if (WARN_ON(!bio_add_folio(bio, rf->folio, len, 0))) {
+ if (WARN_ON(!bio_add_folio(bio, rf->folio, nr_sectors << 9, 0))) {
bio->bi_status = BLK_STS_RESOURCE;
bio_endio(bio);
*skipped = 1;
- return len;
+ return nr_sectors << 9;
}
}
- nr_sectors += len>>9;
- sector_nr += len>>9;
+ sector_nr += nr_sectors;;
} while (0);
r10_bio->sectors = nr_sectors;
--
2.39.2
Powered by blists - more mailing lists