summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Pouzenc <lpouzenc@gmail.com>2015-07-19 14:22:33 +0200
committerLudovic Pouzenc <lpouzenc@gmail.com>2015-07-19 14:22:33 +0200
commit0028794b08c1deba0554d4a90bbace69cde599ca (patch)
treee9c29cf4d27688489ffb01a72f375950d14df5db
parent0670424be379bc5a9e5d769147f1378d1238b3c2 (diff)
downloadraidguessfs-0028794b08c1deba0554d4a90bbace69cde599ca.tar.gz
raidguessfs-0028794b08c1deba0554d4a90bbace69cde599ca.tar.bz2
raidguessfs-0028794b08c1deba0554d4a90bbace69cde599ca.zip
find_files: block list aggregated. May have some bogus offset on
ref_offset_end
-rw-r--r--mytasks.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/mytasks.py b/mytasks.py
index ab5d63f..225064b 100644
--- a/mytasks.py
+++ b/mytasks.py
@@ -103,7 +103,12 @@ def do_find_files(d,state):
for a in agg:
if a['ref_no'] == x['ref_no'] and x['ref_offset'] == a['ref_offset_end']:
a['ref_offset_end'] = x['ref_offset'] + 512
- a['block_list'].append((x['disk_no'], x['disk_offset']))
+ b = a['block_list'].pop()
+ if b[0] == x['disk_no'] and b[2] == x['disk_offset']:
+ a['block_list'].append( (b[0], b[1], x['disk_offset'] + 512) )
+ else:
+ a['block_list'].append(b)
+ a['block_list'].append( (x['disk_no'], x['disk_offset'], x['disk_offset'] + 512) )
x['consumed'] = True
found = True
break
@@ -114,6 +119,13 @@ def do_find_files(d,state):
if a['ref_no'] == x['ref_no'] and x['ref_offset'] + 512 == a['ref_offset_start']:
a['ref_offset_start'] = x['ref_offset']
a['block_list'].insert(0,(x['disk_no'], x['disk_offset']))
+ b = a['block_list'].pop(0)
+ if b[0] == x['disk_no'] and b[1] == x['disk_offset'] + 512:
+ b1[1] = x['disk_offset']
+ a['block_list'].insert(0, (b[0], x['disk_offset'], b[2]) )
+ else:
+ a['block_list'].append(b)
+ a['block_list'].append( (x['disk_no'], x['disk_offset'], x['disk_offset'] + 512) )
x['consumed'] = True
found = True
break
@@ -133,10 +145,7 @@ def do_find_files(d,state):
'ref_no': ref_no,
'ref_offset_start': first['ref_offset'],
'ref_offset_end': last['ref_offset'] + 512,
- 'block_list': [
- (first['disk_no'], first['disk_offset']),
- (last['disk_no'], last['disk_offset']),
- ]
+ 'block_list': [ (first['disk_no'], first['disk_offset'], last['disk_offset'] + 512) ]
}
logging.info('agg.append(%s)'%a)
agg.append(a)