From 0a2ac84b72692fb3f68958e892341e74b1c23555 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 13 Feb 2020 16:19:46 -0600 Subject: [PATCH] [core] Only retry writes when they fail ClearMBRGPT attempts to write WRITE_RETRIES times, even if all those times succeed. Instead, skip the remaining retries on success. --- src/format.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/format.c b/src/format.c index fa7101fe..5c0c10e9 100644 --- a/src/format.c +++ b/src/format.c @@ -726,7 +726,7 @@ static BOOL ClearMBRGPT(HANDLE hPhysicalDrive, LONGLONG DiskSize, DWORD SectorSi uprintf("Retrying in %d seconds...", WRITE_TIMEOUT / 1000); // Don't sit idly but use the downtime to check for conflicting processes... Sleep(CheckDriveAccess(WRITE_TIMEOUT, FALSE)); - } + } else break; } } for (i = last_sector - MAX_SECTORS_TO_CLEAR; i < last_sector; i++) { @@ -743,7 +743,7 @@ static BOOL ClearMBRGPT(HANDLE hPhysicalDrive, LONGLONG DiskSize, DWORD SectorSi r = TRUE; goto out; } - } + } else break; } } r = TRUE;