shithub: lwext4

Download patch

ref: dcbc722c722a79f8f08c538ef21f5126f5f763db
parent: 1105a2798417c31322a705ed9d2e8d3f956a4c0b
author: gkostka <kostka.grzegorz@gmail.com>
date: Thu Dec 31 07:02:24 EST 2015

ext4_bcache: add max cache depth watermark

--- a/fs_test/common/test_lwext4.c
+++ b/fs_test/common/test_lwext4.c
@@ -130,9 +130,9 @@
 	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");
 
--- a/lwext4/ext4_bcache.c
+++ b/lwext4/ext4_bcache.c
@@ -239,6 +239,11 @@
 	/* 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*/