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)
|
||||
|
||||
def pass_complete(self, pass_name):
|
||||
"""Check if pass_num is complete based on map data, returns bool."""
|
||||
complete = False
|
||||
pending_size = 0
|
||||
"""Check if pass_name is complete based on map data, returns bool."""
|
||||
pending_size = self.map_data['non-tried']
|
||||
|
||||
# Check map data
|
||||
# Full recovery
|
||||
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']
|
||||
if pass_name in ('trim', 'scrape'):
|
||||
pending_size += self.map_data['non-trimmed']
|
||||
if pass_name == 'scrape':
|
||||
pending_size += self.map_data['non-scraped']
|
||||
if pending_size == 0:
|
||||
complete = True
|
||||
return True
|
||||
|
||||
# Done
|
||||
return complete
|
||||
# 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'):
|
||||
pending_size += self.map_data['non-trimmed']
|
||||
if pass_name == 'scrape':
|
||||
pending_size += self.map_data['non-scraped']
|
||||
if pending_size == 0:
|
||||
# This is true when the previous and current passes are complete
|
||||
return True
|
||||
|
||||
# This should never be reached
|
||||
return False
|
||||
|
||||
def safety_check(self):
|
||||
"""Run safety check and abort if necessary."""
|
||||
|
|
|
|||
Loading…
Reference in a new issue