ext4_bcache: add max cache depth watermark
authorgkostka <kostka.grzegorz@gmail.com>
Thu, 31 Dec 2015 11:02:24 +0000 (12:02 +0100)
committergkostka <kostka.grzegorz@gmail.com>
Thu, 31 Dec 2015 11:08:50 +0000 (12:08 +0100)
fs_test/common/test_lwext4.c
lwext4/ext4_bcache.c

index 949fa5359a4c2d508cd4ccc12dfe21c49dc693df..b31d0feee092f6cca44506518402a07967711397 100644 (file)
@@ -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");
 
index c1da95d1152f0b30f0596d64ba6634c3d5c544c9..bb51b2808e919513cd28cdd29f9e9f149fcb3b10 100644 (file)
@@ -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*/