summaryrefslogtreecommitdiffstats
path: root/lib/objagg.c
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2019-02-07 11:22:47 +0000
committerDavid S. Miller <davem@davemloft.net>2019-02-08 15:02:49 -0800
commit204f6a8c413ec41a7ec5e3f0f0590d4318f7a1f2 (patch)
tree7887c648d28055f222883582e78669bbe2ff78cd /lib/objagg.c
parent9069a3817d82b01b3a55da382c774e3575946130 (diff)
downloadlinux-204f6a8c413ec41a7ec5e3f0f0590d4318f7a1f2.tar.gz
linux-204f6a8c413ec41a7ec5e3f0f0590d4318f7a1f2.tar.bz2
linux-204f6a8c413ec41a7ec5e3f0f0590d4318f7a1f2.zip
lib: objagg: add root count to stats
Count number of roots and add it to stats. It is handy for the library user to have this stats available as it can act upon it without counting roots itself. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'lib/objagg.c')
-rw-r--r--lib/objagg.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/objagg.c b/lib/objagg.c
index befe8a47d080..781f41c3c47d 100644
--- a/lib/objagg.c
+++ b/lib/objagg.c
@@ -621,6 +621,8 @@ const struct objagg_stats *objagg_stats_get(struct objagg *objagg)
objagg_stats->stats_info[i].objagg_obj = objagg_obj;
objagg_stats->stats_info[i].is_root =
objagg_obj_is_root(objagg_obj);
+ if (objagg_stats->stats_info[i].is_root)
+ objagg_stats->root_count++;
i++;
}
objagg_stats->stats_info_count = i;
@@ -1031,6 +1033,8 @@ objagg_hints_stats_get(struct objagg_hints *objagg_hints)
list_for_each_entry(hnode, &objagg_hints->node_list, list) {
memcpy(&objagg_stats->stats_info[i], &hnode->stats_info,
sizeof(objagg_stats->stats_info[0]));
+ if (objagg_stats->stats_info[i].is_root)
+ objagg_stats->root_count++;
i++;
}
objagg_stats->stats_info_count = i;