From 128369396677f4480166e12d5e14d2a578336f3f Mon Sep 17 00:00:00 2001 From: "rvargas@google.com" Date: Fri, 17 Jul 2009 20:17:29 +0000 Subject: Disk cache: Add support for having a sparse entry block that is not totally filled. This is required to allow two consecutive writes to fill a given range without caring about the actual start offset of the second one (as long as it is right where the first one ended). This CL also takes care of all pending TODOs of the sparse disk cache. Sparse disk cache support is now feature complete. BUG=12258 TEST=unittests Review URL: http://codereview.chromium.org/155590 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20988 0039d316-1c4b-4281-b951-d872f2087c98 --- net/disk_cache/disk_format.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'net/disk_cache/disk_format.h') diff --git a/net/disk_cache/disk_format.h b/net/disk_cache/disk_format.h index c98fc34..8f0843d 100644 --- a/net/disk_cache/disk_format.h +++ b/net/disk_cache/disk_format.h @@ -233,11 +233,16 @@ COMPILE_ASSERT(sizeof(BlockFileHeader) == kBlockHeaderSize, bad_header); // This structure contains the control information for parent and child entries. // It is stored at offset 0 of the data stream with index 2. +// It is possible to write to a child entry in a way that causes the last block +// to be only partialy filled. In that case, last_block and last_block_len will +// keep track of that block. struct SparseHeader { int64 signature; // The parent and children signature. uint32 magic; // Structure identifier (equal to kIndexMagic). int32 parent_key_len; // Key length for the parent entry. - int32 dummy[4]; + int32 last_block; // Index of the last written block. + int32 last_block_len; // Lenght of the last written block. + int32 dummy[10]; }; // The SparseHeader will be followed by a bitmap, as described by this -- cgit v1.1