HAMMER - Add live_dedup_cache_size sysctl
authorIlya Dryomov <idryomov@gmail.com>
Tue, 4 Jan 2011 16:15:48 +0000 (18:15 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 4 Jan 2011 19:39:57 +0000 (21:39 +0200)
* There is now a hammer_live_dedup_cache_size variable which can be
  set via sysctl vfs.hammer.live_dedup_cache_size.  The default is 4096.

* A better solution is to make it scale automatically according to
  nbufs or a number of vnodes.

sys/vfs/hammer/hammer.h
sys/vfs/hammer/hammer_dedup.c
sys/vfs/hammer/hammer_vfsops.c

index e327bca..fa4d62c 100644 (file)
@@ -1048,6 +1048,7 @@ extern int hammer_limit_running_io;
 extern int hammer_limit_recs;
 extern int hammer_limit_inode_recs;
 extern int hammer_limit_reclaim;
+extern int hammer_live_dedup_cache_size;
 extern int hammer_limit_redo;
 extern int hammer_bio_count;
 extern int hammer_verify_zone;
index 1bc125f..3baf203 100644 (file)
@@ -309,7 +309,7 @@ hammer_dedup_cache_add(hammer_inode_t ip, hammer_btree_leaf_elm_t leaf)
                goto populate;
        }
 
-       if (hmp->dedup_cache_count < DEDUP_CACHE_SIZE) {
+       if (hmp->dedup_cache_count < hammer_live_dedup_cache_size) {
                dcp = hmp->dedup_free_cache;
                hmp->dedup_free_cache = NULL;
                ++hmp->dedup_cache_count;
index 2cdf79a..66f6c8d 100644 (file)
@@ -106,6 +106,7 @@ int hammer_limit_running_io;                /* per-mount */
 int hammer_limit_recs;                 /* as a whole XXX */
 int hammer_limit_inode_recs = 1024;    /* per inode */
 int hammer_limit_reclaim = HAMMER_RECLAIM_WAIT;
+int hammer_live_dedup_cache_size = DEDUP_CACHE_SIZE;
 int hammer_limit_redo = 4096 * 1024;   /* per inode */
 int hammer_autoflush = 2000;           /* auto flush */
 int hammer_bio_count;
@@ -171,6 +172,8 @@ SYSCTL_INT(_vfs_hammer, OID_AUTO, limit_inode_recs, CTLFLAG_RW,
           &hammer_limit_inode_recs, 0, "");
 SYSCTL_INT(_vfs_hammer, OID_AUTO, limit_reclaim, CTLFLAG_RW,
           &hammer_limit_reclaim, 0, "");
+SYSCTL_INT(_vfs_hammer, OID_AUTO, live_dedup_cache_size, CTLFLAG_RW,
+          &hammer_live_dedup_cache_size, 0, "");
 SYSCTL_INT(_vfs_hammer, OID_AUTO, limit_redo, CTLFLAG_RW,
           &hammer_limit_redo, 0, "");