Load new page only on buffered devices.
[bertos.git] / bertos / io / kblock.c
index 9c21f56659b6e34a9f92c53bd8e35755395aba32..117c3e9b48ef3b9b51b43f134778580c87ea2df6 100644 (file)
@@ -153,8 +153,11 @@ int kblock_trim(struct KBlock *b, block_idx_t start, block_idx_t count)
 {
        ASSERT(start + count <= b->blk_cnt);
 
-       if (!kblock_loadPage(b, start))
-               return EOF;
+       if (kblock_buffered(b))
+       {
+               if (!kblock_loadPage(b, start))
+                       return EOF;
+       }
 
        b->priv.blk_start += start;
        b->priv.curr_blk = 0; // adjust logical address