From 0028794b08c1deba0554d4a90bbace69cde599ca Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sun, 19 Jul 2015 14:22:33 +0200 Subject: find_files: block list aggregated. May have some bogus offset on ref_offset_end --- mytasks.py | 19 ++++++++++++++----- 1 file 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) -- cgit v1.2.3