MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / WriteBlockCached

Method WriteBlockCached

Kernel/src/fs/ext2.cpp:417–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

415 }
416
417 int Ext2Volume::WriteBlockCached(uint32_t block, void* buffer){
418 if(block > super.blockCount)
419 return -1;
420
421 #ifndef EXT2_NO_CACHE
422 uint8_t* cachedBlock = nullptr;
423 if((cachedBlock = blockCache.get(block))){
424 memcpy(cachedBlock, buffer, blocksize);
425 }
426 #endif
427
428 if(int e = part->WriteBlock(BlockToLBA(block), blocksize, buffer)){
429 Log::Error("[Ext2] Disk error (%d) reading block %d (blocksize: %d)", e, block, blocksize);
430 return e;
431 }
432
433 return 0;
434 }
435
436 uint32_t Ext2Volume::AllocateBlock(){
437 for(unsigned i = 0; i < blockGroupCount; i++){

Callers

nothing calls this directly

Calls 4

memcpyFunction · 0.85
ErrorFunction · 0.85
getMethod · 0.45
WriteBlockMethod · 0.45

Tested by

no test coverage detected