line 7990 -- msio.cpp
logRecordEx(PRIORITY_RELEASE, NO_FILTERING,"MSMetaDataFwd from SE%d (0x%x) Receiving %s %s:fID %d fPos 0x"INT64X_FORMAT" fLen %d bn %u abeFlags 0x%x cNum %d IF %d CRC %d seqNum 0x%x incarn.seqn %d incarnation/XORIncarn[].seqn %d\n",
line 4660 -- mscache.cpp:
logRecordEx(PRIORITY_RELEASE, FILTER_CACHE, "WAIT_XOR: cacheWrite, rebuild master cNum %d RAID = (0x%x, ele1 %d, ele2 %d, expD 0x%x, Relem 0x%x)\n",
cacheEntry->getCacheNum(),
cacheEntry->RAID.flags, cacheEntry->RAID.rebuildList[0], cacheEntry->RAID.rebuildList[1],
expectedData, cacheEntry->RAID.recoveryElements);
line 4667 -- mscache.cpp:
// Kick the rebuild of up to two blocks
// The rebuilt blocks are required to be pushed to servers only during rebuild.
raidBlockRebuild(cacheCtl->blockProtection, cacheEntryPtrArray)
data structures:
1. meta-data AllocBlockEntry
// The in memory allocation entry (meta-data) definition. There is one of these per potential block in the system.
// The idea is to keep this as small as possible.
class AllocBlockEntry : public QueueItem
{
public:
AllocBlockParityExtension *parityExtendPtr; // Pointer to a parity extension block valid only for a parity block
MapBasisID basisID; // basis file mapping ID of this block
NodeID fileID; // 0 implies available entry
int32u fileLBN; // file's logical block number used for lookup
FILE_SEED fileSeed;
ALLOC_BLOCK allocBlock; // phys block on disk
CacheEntry *cacheBlock; // pointer to the cache block
int32u validEndRange; // ending offset for which the block is valid
LogicalUnitNumber buddyUserver; // mirror or xor server
blkIncarn_t_V2 incarnation; // client seq write # for recovery (who's got most recent copy)
int8u cgIndex; // cylinder group for block (0 <= NUMBER_OF_CYLINDER_GROUPS <= 255)
int8u blockState; // state of alloc block mirrors the on disk validity block (metaBlockState)
int8 diskIndex; // diskIndex the block actually came from ( mako 0 -> 15, pico 0 -> 2 or 4)
int8u subChunkValidity; // Bit mask of subchunks of a chunk which are currently valid, irrespective of end range
int32u flags; // Various flags that help refine the state of the block in real time
} ;
2. CacheEntry
class QueueItem
{
friend class QueueHeader;
private:
QueueItem *next;
QueueItem *prev;
QueueHeader *head;
public:
QueueItem *nextItem (void) {return next;};
QueueHeader *getQueue (void) {return head;};
void initItem (void);
};
class CacheEntry : public QueueItem // expecting this to be 64 bytes
{
public:
DiskCache *diskCache; // the disk cache we are associated with
ALLOC_BLOCK block; // allocation block number (same as cache index within DiskMap)
int32u maxSize; // max size of the cache block
AllocBlockEntry *allocBlock; // pointer for the alloc block entry
CacheControlHeader controlQueue;
FPTime dgram10gbTXInterval; // The transmission delay interval between datagrams from 10gb to 1gb or 100mb on read
int32u dataChecksum[DATA_CHECKSUM_ARRAY_SIZE]; // A payload check value (checksum or CRC) of the data per datagram offset with the cache block
int32u currentCRCincrement; // The current CRC increment used to calculate the CRC stored in dataChecksum
FPTime timeStamp; // when this block was last assigned to the inuse queue
struct _RAID
{
int32u flags; // RAID/parity/XOR flags (XOR_ACC_READ, XOR_ACC_WRITE, XOR_ACC_BACKDOOR, etc.)
int32u element; // Zero-based index of the element within a stripe.
int32u accumulator; // Used to mark cache blocks active as they are recieved when not related to recovery.
int32u rebuildList[XOR_MAXIMUM_REBUILD_ELEMENTS]; // List (array) of elements of a stripe that need to be rebuilt.
int32u recoveryElements; // Elements for which there is a cache entry on the accumulatePtr chain with the XOR_ACC_RECOVERY flag set.
int32u newElements; // Elements for which there is a cache entry on the accumulator chain written the very first time.
/*
* opSeqn is the `operating sequence number', primarily a place
* to hold a block incarn prior to the block being incorporated
* into raid6 parity. This can't be be read out of an rx ccb at
* parity construct time because the ccb is gone by then. The
* construction process is carried by the master ccb. This
* could be used in other scenarios.
*/
int16u opSeqn;
int8u XORState; // Bit flags to set/clear when reconstructing Parity
int8u accumLen; // Keep the pointer fields following this 32-bit aligned (at least relative to the start of the RAID structure)
CacheEntry *accumulatorPtr; // continuation pointer for a link list of temp cache buffers for XOR (from other servers)...
CacheEntry *accumulatorTarget; // points back to the head (if we are a temp block)
CacheEntry *accumulatorChainEndPtr; // pointer to last member on the current chain. Valid only from the RAID parity server parent perspective.
CacheEntry *ackOnDiskToClientList; // List of BACKDOOR (Secondary Path) temporary cache entries that need to kept around so
// that we can ACK the client when the write of the parity block to disk completes.
FPTime raidTimeStamp; // use this to track timeouts based on last block arrival...
FPTime raidRebuildStamp; // use this to track actual rebuild time
int32u rebuildActiveCnt; // The count of elements who can participate in the current rebuild at parity.
} RAID, *PRAID;
private:
void *memAddr; // the memory address of the cache block
int32 forwarding; // number of active transfers going to buddy userver
Boolean32 valid; // valid fs blocks within the cache block
Boolean32 partiallyValid; // Block contains partially valid data on active TX from a client.
Boolean32 dirty; // block must go to disk
Boolean32 openWriteToDisk; // The original 1k write has been queued.
Boolean32 wasRead; // A valid block was read off of disk
Boolean32 hidden; // The cache entry is hidden from lookups/searches
Boolean32 parityHold; // True means do not allocate from parity lookaside.
int32 cacheNumber;
int32 inUseCounter; // Number of potential I/Os associated with this entry.
int32 CRCinstanceCnt; // Number of active CRC compute instances on this cache entry
FosSize expectedWriteLength;// The size of the upcoming write from the pre-write perspective.
NextTXTimePerAddr nextDgramTXTime[NUM_TX_ADDRS_PER_CACHE_ENTRY]; // The next time a 10gb interface can put a 1gb client Datagram on the wire. Assumes the client can request the same cache entry on multiple interfaces.
public:
void init (void *mem, int32u size);
void deleteBlockFromCache (void);
void cacheBlockInError (void);
void computeCheckOnEntry (CacheControl *cacheCtrl);
void freeCacheBlockInError (void);
void freeTempCacheBlock (void);
void moveToInUse (void);
void moveToTempInUse (void);
void moveToDataAtParityLookaside (void);
void moveToParityPartnerLookaside (CacheControl* ccb);
void moveFromCurrentQueue (void);
void *cacheAddr (void);
int32 getCacheNum (void) { return cacheNumber; }
void setCacheNum (int32 num) { cacheNumber = num; }
int32 cacheEntryCurState (void);
FPTime age (void) { return timeStamp; }
void removeCCBentry (CacheControl *cacheCtrl, cacheMoveState action);
void incrementInUse (void) { inUseCounter++; };
void clearInUse (void) { inUseCounter = 0; };
FStatus cleanupEntry (Boolean32 forceDirtyRemoval);
void incrementCRCcnt (void);
void decrementCRCcnt (void);
void clearCRCbusy (void);
void markDirty (void);
void markValid (void);
void markPartialValid (void);
void markInvalid (void);
void markClean (void);
void markForDiskWrite (void);
void markOutOfDiskWrite (void);
void markRead (void);
void markHidden (void);
void markUnhidden (int32 action);
void clearPartialValid (void);
Boolean32 isValid (void);
Boolean32 isPartialValid (void);
Boolean32 isDirty (void);
Boolean32 isQueued (void);
Boolean32 isMarkedForDiskWrite (void);
Boolean32 isReadFromDisk (void);
Boolean32 isHidden (void);
Boolean32 isBusyForCRC (void);
Boolean32 isParityHold(void) {return parityHold;}
void setParityHold(Boolean32 val) {parityHold = val;}
Boolean32 isSeqnOnChain(int32u element, int16u seqn, Boolean32 any=FALSE);
int16u maxSeqnForElement(int32u element);
FStatus _requeueXOR(LogicalUnitNumber *group, LogicalUnitNumber *targets, int8u blockProtection, char *file, long line);
int32 removeTempBuffers (void);
void zeroAccumulator (void);
void updateAccumulatorChain (CacheEntry *childPtr);
void setExpectedWriteLength (FosSize length) { expectedWriteLength = length; };
FosSize getExpectedWriteLength (void) { return expectedWriteLength; };
void setNextDgramTXTime (int32u sendNetAddr, int32u netSendCount);
FPTime getNextDgramTXTime (int32u sendNetAddr);
void clearNextDgramTXTime (void);
} ;