Fix bug locking ddrescue-tui to pass Read-Skip
This commit is contained in:
parent
989fe9f047
commit
9e874f8034
1 changed files with 25 additions and 19 deletions
|
|
@ -250,28 +250,34 @@ class BlockPair():
|
||||||
self.map_data.update(data)
|
self.map_data.update(data)
|
||||||
|
|
||||||
def pass_complete(self, pass_name):
|
def pass_complete(self, pass_name):
|
||||||
"""Check if pass_num is complete based on map data, returns bool."""
|
"""Check if pass_name is complete based on map data, returns bool."""
|
||||||
complete = False
|
|
||||||
pending_size = 0
|
|
||||||
|
|
||||||
# Check map data
|
|
||||||
if self.map_data.get('full recovery', False):
|
|
||||||
complete = True
|
|
||||||
elif 'non-tried' not in self.map_data:
|
|
||||||
# Assuming recovery has not been attempted yet
|
|
||||||
complete = False
|
|
||||||
else:
|
|
||||||
# Check that current and previous passes are complete
|
|
||||||
pending_size = self.map_data['non-tried']
|
pending_size = self.map_data['non-tried']
|
||||||
|
|
||||||
|
# Full recovery
|
||||||
|
if self.map_data.get('full recovery', False):
|
||||||
|
return True
|
||||||
|
|
||||||
|
# New recovery
|
||||||
|
if 'non-tried' not in self.map_data:
|
||||||
|
return False
|
||||||
|
|
||||||
|
# Initial read skip pass
|
||||||
|
if pass_name == 'read-skip':
|
||||||
|
pass_threshold = cfg.ddrescue.AUTO_PASS_THRESHOLDS[pass_name]
|
||||||
|
if self.get_percent_recovered() >= pass_threshold:
|
||||||
|
return True
|
||||||
|
|
||||||
|
# Recovery in progress
|
||||||
if pass_name in ('trim', 'scrape'):
|
if pass_name in ('trim', 'scrape'):
|
||||||
pending_size += self.map_data['non-trimmed']
|
pending_size += self.map_data['non-trimmed']
|
||||||
if pass_name == 'scrape':
|
if pass_name == 'scrape':
|
||||||
pending_size += self.map_data['non-scraped']
|
pending_size += self.map_data['non-scraped']
|
||||||
if pending_size == 0:
|
if pending_size == 0:
|
||||||
complete = True
|
# This is true when the previous and current passes are complete
|
||||||
|
return True
|
||||||
|
|
||||||
# Done
|
# This should never be reached
|
||||||
return complete
|
return False
|
||||||
|
|
||||||
def safety_check(self):
|
def safety_check(self):
|
||||||
"""Run safety check and abort if necessary."""
|
"""Run safety check and abort if necessary."""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue