This patch adds counters to each of the rbtrees so that we can tell
how large they are growing for a given workload.  These counters
will be exported by tracepoints in the next patch.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
 
 struct preftree {
        struct rb_root root;
+       unsigned int count;
 };
 
-#define PREFTREE_INIT  { .root = RB_ROOT }
+#define PREFTREE_INIT  { .root = RB_ROOT, .count = 0 }
 
 struct preftrees {
        struct preftree direct;    /* BTRFS_SHARED_[DATA|BLOCK]_REF_KEY */
                }
        }
 
+       preftree->count++;
        rb_link_node(&newref->rbnode, parent, p);
        rb_insert_color(&newref->rbnode, root);
 }
                free_pref(ref);
 
        preftree->root = RB_ROOT;
+       preftree->count = 0;
 }
 
 /*
                }
 
                rb_erase(&ref->rbnode, &preftrees->indirect.root);
+               preftrees->indirect.count--;
 
                if (ref->count == 0) {
                        free_pref(ref);