#include <linux/proc_fs.h>
static int counter_val(struct xfsstats __percpu *stats, int idx)
for_each_possible_cpu(cpu)
val += *(((__u32 *)per_cpu_ptr(stats, cpu) + idx));
int xfs_stats_format(struct xfsstats __percpu *stats, char *buf)
uint64_t xs_xstrat_bytes = 0;
uint64_t xs_write_bytes = 0;
uint64_t xs_read_bytes = 0;
static const struct xstats_entry {
{ "extent_alloc", xfsstats_offset(xs_abt_lookup) },
{ "abt", xfsstats_offset(xs_blk_mapr) },
{ "blk_map", xfsstats_offset(xs_bmbt_lookup) },
{ "bmbt", xfsstats_offset(xs_dir_lookup) },
{ "dir", xfsstats_offset(xs_trans_sync) },
{ "trans", xfsstats_offset(xs_ig_attempts) },
{ "ig", xfsstats_offset(xs_log_writes) },
{ "log", xfsstats_offset(xs_try_logspace)},
{ "push_ail", xfsstats_offset(xs_xstrat_quick)},
{ "xstrat", xfsstats_offset(xs_write_calls) },
{ "rw", xfsstats_offset(xs_attr_get) },
{ "attr", xfsstats_offset(xs_iflush_count)},
{ "icluster", xfsstats_offset(vn_active) },
{ "vnodes", xfsstats_offset(xb_get) },
{ "buf", xfsstats_offset(xs_abtb_2) },
{ "abtb2", xfsstats_offset(xs_abtc_2) },
{ "abtc2", xfsstats_offset(xs_bmbt_2) },
{ "bmbt2", xfsstats_offset(xs_ibt_2) },
{ "ibt2", xfsstats_offset(xs_fibt_2) },
{ "fibt2", xfsstats_offset(xs_rmap_2) },
{ "rmapbt", xfsstats_offset(xs_refcbt_2) },
{ "refcntbt", xfsstats_offset(xs_qm_dqreclaims)},
{ "qm", xfsstats_offset(xs_xstrat_bytes)},
for (i = j = 0; i < ARRAY_SIZE(xstats); i++) {
len += snprintf(buf + len, PATH_MAX - len, "%s",