#include "kblock.h"
+
+#define LOG_LEVEL LOG_LVL_ERR
+#define LOG_FORMAT LOG_FMT_VERBOSE
+
#include <cfg/log.h>
INLINE size_t kblock_readDirect(struct KBlock *b, block_idx_t index, void *buf, size_t offset, size_t size)
{
KB_ASSERT_METHOD(b, readDirect);
- return b->priv.vt->readDirect(b, index, buf, offset, size);
+ return b->priv.vt->readDirect(b, b->priv.blk_start + index, buf, offset, size);
}
INLINE size_t kblock_readBuf(struct KBlock *b, void *buf, size_t offset, size_t size)
KB_ASSERT_METHOD(b, load);
ASSERT(index < b->blk_cnt);
+ LOG_INFO("index %d\n", index);
return b->priv.vt->load(b, b->priv.blk_start + index);
}
KB_ASSERT_METHOD(b, store);
ASSERT(index < b->blk_cnt);
+ LOG_INFO("index %d\n", index);
return b->priv.vt->store(b, b->priv.blk_start + index);
}
ASSERT(b);
ASSERT(buf);
+ LOG_INFO("blk_idx %d, offset %d, size %d\n", idx, offset, size);
while (size)
{
if (b->priv.cache_dirty)
{
+ LOG_INFO("flushing block %d\n", b->priv.curr_blk);
if (kblock_store(b, b->priv.curr_blk) == 0)
b->priv.cache_dirty = false;
else
if (idx != b->priv.curr_blk)
{
+ LOG_INFO("loading block %d\n", idx);
if (kblock_flush(b) != 0 || kblock_load(b, idx) != 0)
return false;
ASSERT(b);
ASSERT(buf);
+ LOG_INFO("blk_idx %d, offset %d, size %d\n", idx, offset, size);
while (size)
{
size_t len = MIN(size, b->blk_size - offset);