+ if (!kblock_buffered(b))
+ return 0;
+
if (kblock_cacheDirty(b))
{
LOG_INFO("flushing block %d\n", b->priv.curr_blk);
if (kblock_cacheDirty(b))
{
LOG_INFO("flushing block %d\n", b->priv.curr_blk);
ASSERT(offset + size <= b->blk_size);
LOG_INFO("blk_idx %d, offset %d, size %d\n", idx, offset, size);
ASSERT(offset + size <= b->blk_size);
LOG_INFO("blk_idx %d, offset %d, size %d\n", idx, offset, size);
if (kblock_buffered(b))
{
if (!kblock_loadPage(b, idx))
if (kblock_buffered(b))
{
if (!kblock_loadPage(b, idx))
-int kblock_copy(struct KBlock *b, block_idx_t idx1, block_idx_t idx2)
+int kblock_copy(struct KBlock *b, block_idx_t src, block_idx_t dest)
- ASSERT(idx1 < b->blk_cnt);
- ASSERT(idx2 < b->blk_cnt);
+ ASSERT(src < b->blk_cnt);
+ ASSERT(dest < b->blk_cnt);
ASSERT(kblock_buffered(b));
ASSERT(kblock_buffered(b));
- if (!kblock_loadPage(b, idx1))
+ if (!kblock_loadPage(b, src))
- b->priv.curr_blk = idx2;
+ b->priv.curr_blk = dest;
kblock_setDirty(b, true);
return 0;
}
kblock_setDirty(b, true);
return 0;
}
{
ASSERT(buf);
ASSERT(offset + size <= b->blk_size);
{
ASSERT(buf);
ASSERT(offset + size <= b->blk_size);
memcpy(buf, (uint8_t *)b->priv.buf + offset, size);
return size;
}
memcpy(buf, (uint8_t *)b->priv.buf + offset, size);
return size;
}