[PATCH v2 07/14] md/raid1: clean up useless sync_blocks handling in raid1_sync_request

[email protected]
Newsgroups gmane.linux.raid,gmane.linux.kernel
Message-ID <[email protected]>
From: Li Nan <[email protected]>

Since the loop is changed to while(0), some handling of sync_blocks
in raid1_sync_request() is no longer needed and can be removed.

No functional changes.

Signed-off-by: Li Nan <[email protected]>
---
 drivers/md/raid1.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 5954ead7dfd4..2308e16b1280 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2985,7 +2985,6 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
 	if (max_sector > sector_nr + good_sectors)
 		max_sector = sector_nr + good_sectors;
 	nr_sectors = 0;
-	sync_blocks = 0;
 	do {
 		struct folio *folio;
 		int len = RESYNC_BLOCK_SIZE;
@@ -2993,15 +2992,13 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
 			len = (max_sector - sector_nr) << 9;
 		if (len == 0)
 			break;
-		if (sync_blocks == 0) {
-			if (!md_bitmap_start_sync(mddev, sector_nr,
-						  &sync_blocks, still_degraded) &&
-			    !conf->fullsync &&
-			    !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery))
-				break;
-			if ((len >> 9) > sync_blocks)
-				len = sync_blocks<<9;
-		}
+		if (!md_bitmap_start_sync(mddev, sector_nr,
+					  &sync_blocks, still_degraded) &&
+		    !conf->fullsync &&
+		    !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery))
+			break;
+		if ((len >> 9) > sync_blocks)
+			len = sync_blocks<<9;
 
 		for (i = 0 ; i < conf->raid_disks * 2; i++) {
 			struct resync_folio *rf;
@@ -3015,7 +3012,6 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
 		}
 		nr_sectors += len>>9;
 		sector_nr += len>>9;
-		sync_blocks -= (len>>9);
 	} while (0);
 
 	r1_bio->sectors = nr_sectors;
-- 
2.39.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.