aboutsummaryrefslogtreecommitdiffstats
path: root/FuseArchive/ChunkFile.py
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2009-08-07 22:48:45 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2009-08-07 22:48:45 (GMT)
commitb99008d2a0a097fd2d07a78b3a9052b83489736c (patch)
tree52a5ea8946c04a42ace3fdac86b3204bc9f45804 /FuseArchive/ChunkFile.py
parentbc30ead661de95b2bba2a6e0f0187ff84e1af06a (diff)
downloadfusearchive-b99008d2a0a097fd2d07a78b3a9052b83489736c.zip
fusearchive-b99008d2a0a097fd2d07a78b3a9052b83489736c.tar.gz
fusearchive-b99008d2a0a097fd2d07a78b3a9052b83489736c.tar.bz2
Don't re-read the entire file in case we are extending it when we don't
have enough blocks, just start from the last block. This increases performace significantly for large files
Diffstat (limited to 'FuseArchive/ChunkFile.py')
-rw-r--r--FuseArchive/ChunkFile.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/FuseArchive/ChunkFile.py b/FuseArchive/ChunkFile.py
index e19a9fb..b9f114f 100644
--- a/FuseArchive/ChunkFile.py
+++ b/FuseArchive/ChunkFile.py
@@ -217,7 +217,7 @@ class ChunkFile(object):
self.chunks[ self.chunk_index ] = self.chunk
# Flush if we have too many dirty chunks
- if self.dirty_chunks > dirty_flush:
+ if self.dirty_chunks >= dirty_flush:
self._flush_chunks()
# This flushes any cached chunks
@@ -288,7 +288,12 @@ class ChunkFile(object):
if len( self.chunks ) - 1 < index:
logging.debug( "Not enough chunks %d, need %d, extending" %
( len( self.chunks ), index + 1 ) )
- this_index = 0
+
+ # Start with our last block, in case we need to null pad it out
+ this_index = len( self.chunks ) - 1
+ if this_index < 0:
+ this_index = 0
+
while this_index < index:
self._load_chunk( this_index )
fill_null = self.chunk_size - len(self.chunk)