From dcbc722c722a79f8f08c538ef21f5126f5f763db Mon Sep 17 00:00:00 2001 From: gkostka Date: Thu, 31 Dec 2015 12:02:24 +0100 Subject: [PATCH] ext4_bcache: add max cache depth watermark --- fs_test/common/test_lwext4.c | 6 +++--- lwext4/ext4_bcache.c | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fs_test/common/test_lwext4.c b/fs_test/common/test_lwext4.c index 949fa53..b31d0fe 100644 --- a/fs_test/common/test_lwext4.c +++ b/fs_test/common/test_lwext4.c @@ -130,9 +130,9 @@ void test_lwext4_block_stats(void) printf("bdev->bread_ctr = %" PRIu32 "\n", bd->bdif->bread_ctr); printf("bdev->bwrite_ctr = %" PRIu32 "\n", bd->bdif->bwrite_ctr); - printf("bcache->ref_blocks = %" PRIu32 "\n", bc->ref_blocks); - printf("bcache->max_ref_blocks = %" PRIu32 "\n", bc->max_ref_blocks); - printf("bcache->lru_ctr = %" PRIu32 "\n", bc->lru_ctr); + printf("bcache->ref_blocks = %" PRIu32 "\n", bd->bc->ref_blocks); + printf("bcache->max_ref_blocks = %" PRIu32 "\n", bd->bc->max_ref_blocks); + printf("bcache->lru_ctr = %" PRIu32 "\n", bd->bc->lru_ctr); printf("\n"); diff --git a/lwext4/ext4_bcache.c b/lwext4/ext4_bcache.c index c1da95d..bb51b28 100644 --- a/lwext4/ext4_bcache.c +++ b/lwext4/ext4_bcache.c @@ -239,6 +239,11 @@ int ext4_bcache_alloc(struct ext4_bcache *bc, struct ext4_block *b, /* One more buffer in bcache now. :-) */ bc->ref_blocks++; + /*Calc ref blocks max depth*/ + if (bc->max_ref_blocks < bc->ref_blocks) + bc->max_ref_blocks = bc->ref_blocks; + + ext4_bcache_inc_ref(buf); /* Assign new value to LRU id and increment LRU counter * by 1*/ -- 2.30.2