diff options
author | Steve Slaven <bpk@hoopajoo.net> | 2009-07-29 05:52:17 (GMT) |
---|---|---|
committer | Steve Slaven <bpk@hoopajoo.net> | 2009-07-29 05:52:17 (GMT) |
commit | 614720058d96957be369769e6add7f556f642dc8 (patch) | |
tree | 4f290d855f9d3a55fc802caf7c2f1bb07432394b | |
parent | 8c91367a60e68dea764dee457fac5570f9f0111b (diff) | |
download | fusearchive-614720058d96957be369769e6add7f556f642dc8.zip fusearchive-614720058d96957be369769e6add7f556f642dc8.tar.gz fusearchive-614720058d96957be369769e6add7f556f642dc8.tar.bz2 |
Be more explicit about saving chunks, since some other parts of the code
look at len(self.chunks) and this is NOT extended until we do a _save_chunk
-rwxr-xr-x | fusearchive.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fusearchive.py b/fusearchive.py index 9a06c92..e86a774 100755 --- a/fusearchive.py +++ b/fusearchive.py @@ -674,19 +674,22 @@ class FuseArchive(Fuse): logging.debug( "This chunk falls on index: " + str( index ) + " rest: " + str( rest ) ) logging.debug( "We have " + str( len( self.chunks ) ) + " chunks" ) + logging.debug( "File size is: " + str( self.size ) ) # If index is higher than the number of blocks we current have it's a seek hole, so we need to extend our blocks out # We know these need to essentially be zeroed up to this size since if len( self.chunks ) - 1 < index: logging.debug( "Not enough chunks " + str( len( self.chunks ) ) + ", need " + - str( index ) + ", extending" ) + str( index + 1 ) + ", extending" ) this_index = 0 while this_index < index: self._load_chunk( this_index ) fill_null = self.chunk_size - len(self.chunk) logging.debug( "Filling this chunk with null, bytes: " + str( fill_null ) ) self.chunk += "\0" * fill_null + logging.debug( "Chunk is now: " + str( len( self.chunk) ) + " bytes" ) self.chunk_modified = True + self._save_chunk() this_index += 1 self._load_chunk( index ) @@ -697,6 +700,7 @@ class FuseArchive(Fuse): logging.debug( "Filling final chunk with null, bytes: " + str( fill_null ) ) self.chunk += "\0" * fill_null self.chunk_modified = True + self._save_chunk() buf_offset = 0 buf_len = len(buf) @@ -746,12 +750,14 @@ class FuseArchive(Fuse): index += 1 self.chunk_modified = True + self._save_chunk() self.modified = True if offset + len(buf) > self.size: self.size = offset + len(buf) - logging.debug( "Chunk size is now: " + str(len(self.chunk)) ) + logging.debug( "This chunk size is now: " + str(len(self.chunk)) ) logging.debug( "File size is now: " + str(self.size) ) + logging.debug( "Num Chunks: " + str( len( self.chunks ) ) ) # Mark us in the dirty cache dirty_cache[ self.orig_path ] = self |