
For dentry leases, only count the hit/miss info triggered from the vfs calls. For the cases like request reply handling and ceph_trim_dentries, ignore them. For now, these are only viewable using debugfs. Future patches will allow the client to send the stats to the MDS. The output looks like: item total miss hit ------------------------------------------------- d_lease 11 7 141 URL: https://tracker.ceph.com/issues/43215 Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
36 lines
645 B
C
36 lines
645 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/percpu_counter.h>
|
|
|
|
#include "metric.h"
|
|
|
|
int ceph_metric_init(struct ceph_client_metric *m)
|
|
{
|
|
int ret;
|
|
|
|
if (!m)
|
|
return -EINVAL;
|
|
|
|
atomic64_set(&m->total_dentries, 0);
|
|
ret = percpu_counter_init(&m->d_lease_hit, 0, GFP_KERNEL);
|
|
if (ret)
|
|
return ret;
|
|
ret = percpu_counter_init(&m->d_lease_mis, 0, GFP_KERNEL);
|
|
if (ret) {
|
|
percpu_counter_destroy(&m->d_lease_hit);
|
|
return ret;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
void ceph_metric_destroy(struct ceph_client_metric *m)
|
|
{
|
|
if (!m)
|
|
return;
|
|
|
|
percpu_counter_destroy(&m->d_lease_mis);
|
|
percpu_counter_destroy(&m->d_lease_hit);
|
|
}
|