Load new page only on buffered devices.
authorbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 3 Feb 2011 18:19:43 +0000 (18:19 +0000)
committerbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 3 Feb 2011 18:19:43 +0000 (18:19 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4677 38d2e660-2303-0410-9eaa-f027e97ec537

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