Commit 42550953 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

ole32: Store the location of all blocks in a big block chain in memory.

A big block chain is a linked list, and we pretty much need random access to them. This should theoretically make accessing a random point in the chain O(log2 n) instead of O(n) (with disk access scaling based on the size of the read/write, not its location). It theoretically takes O(n) memory based on the size, but it can do better if the chain isn't very fragmented (which I believe will generally be the case for long chains). It also involves fetching all the big block locations when we open the chain, but we already do that anyway (and it should be faster to read it all in one go than piecemeal).
parent 93cc582a
......@@ -513,13 +513,22 @@ void StorageUtl_CopyDirEntryToSTATSTG(StorageBaseImpl *storage,STATSTG* destinat
* The BlockChainStream class is a utility class that is used to create an
* abstraction of the big block chains in the storage file.
*/
struct BlockChainRun
{
/* This represents a range of blocks that happen reside in consecutive sectors. */
ULONG firstSector;
ULONG firstOffset;
ULONG lastOffset;
};
struct BlockChainStream
{
StorageImpl* parentStorage;
ULONG* headOfStreamPlaceHolder;
DirRef ownerDirEntry;
ULONG lastBlockNoInSequence;
ULONG lastBlockNoInSequenceIndex;
struct BlockChainRun* indexCache;
ULONG indexCacheLen;
ULONG indexCacheSize;
ULONG tailIndex;
ULONG numBlocks;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment