aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/sys.c')
-rw-r--r--fs/gfs2/sys.c74
1 files changed, 6 insertions, 68 deletions
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index c5984351e4d8..f87df8ec041e 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -319,85 +319,23 @@ struct counters_attr {
319 ssize_t (*show)(struct gfs2_sbd *, char *); 319 ssize_t (*show)(struct gfs2_sbd *, char *);
320}; 320};
321 321
322#define COUNTERS_ATTR_GENERAL(name, fmt, val) \ 322#define COUNTERS_ATTR(name, fmt) \
323static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \ 323static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
324{ \ 324{ \
325 return sprintf(buf, fmt, val); \ 325 return sprintf(buf, fmt, (unsigned int)atomic_read(&sdp->sd_##name)); \
326} \ 326} \
327static struct counters_attr counters_attr_##name = __ATTR_RO(name) 327static struct counters_attr counters_attr_##name = __ATTR_RO(name)
328 328
329#define COUNTERS_ATTR_SIMPLE(name, fmt) \ 329COUNTERS_ATTR(glock_count, "%u\n");
330 COUNTERS_ATTR_GENERAL(name, fmt, sdp->sd_##name) 330COUNTERS_ATTR(glock_held_count, "%u\n");
331 331COUNTERS_ATTR(inode_count, "%u\n");
332#define COUNTERS_ATTR_ATOMIC(name, fmt) \ 332COUNTERS_ATTR(reclaimed, "%u\n");
333 COUNTERS_ATTR_GENERAL(name, fmt, (unsigned int)atomic_read(&sdp->sd_##name))
334
335COUNTERS_ATTR_ATOMIC(glock_count, "%u\n");
336COUNTERS_ATTR_ATOMIC(glock_held_count, "%u\n");
337COUNTERS_ATTR_ATOMIC(inode_count, "%u\n");
338COUNTERS_ATTR_ATOMIC(bufdata_count, "%u\n");
339COUNTERS_ATTR_ATOMIC(unlinked_count, "%u\n");
340COUNTERS_ATTR_ATOMIC(quota_count, "%u\n");
341COUNTERS_ATTR_SIMPLE(log_num_gl, "%u\n");
342COUNTERS_ATTR_SIMPLE(log_num_buf, "%u\n");
343COUNTERS_ATTR_SIMPLE(log_num_revoke, "%u\n");
344COUNTERS_ATTR_SIMPLE(log_num_rg, "%u\n");
345COUNTERS_ATTR_SIMPLE(log_num_databuf, "%u\n");
346COUNTERS_ATTR_SIMPLE(log_blks_free, "%u\n");
347COUNTERS_ATTR_GENERAL(jd_blocks, "%u\n", sdp->sd_jdesc->jd_blocks);
348COUNTERS_ATTR_ATOMIC(reclaim_count, "%u\n");
349COUNTERS_ATTR_SIMPLE(log_wraps, "%llu\n");
350COUNTERS_ATTR_ATOMIC(fh2dentry_misses, "%u\n");
351COUNTERS_ATTR_ATOMIC(reclaimed, "%u\n");
352COUNTERS_ATTR_ATOMIC(log_flush_incore, "%u\n");
353COUNTERS_ATTR_ATOMIC(log_flush_ondisk, "%u\n");
354COUNTERS_ATTR_ATOMIC(glock_nq_calls, "%u\n");
355COUNTERS_ATTR_ATOMIC(glock_dq_calls, "%u\n");
356COUNTERS_ATTR_ATOMIC(glock_prefetch_calls, "%u\n");
357COUNTERS_ATTR_ATOMIC(lm_lock_calls, "%u\n");
358COUNTERS_ATTR_ATOMIC(lm_unlock_calls, "%u\n");
359COUNTERS_ATTR_ATOMIC(lm_callbacks, "%u\n");
360COUNTERS_ATTR_ATOMIC(ops_address, "%u\n");
361COUNTERS_ATTR_ATOMIC(ops_dentry, "%u\n");
362COUNTERS_ATTR_ATOMIC(ops_export, "%u\n");
363COUNTERS_ATTR_ATOMIC(ops_file, "%u\n");
364COUNTERS_ATTR_ATOMIC(ops_inode, "%u\n");
365COUNTERS_ATTR_ATOMIC(ops_super, "%u\n");
366COUNTERS_ATTR_ATOMIC(ops_vm, "%u\n");
367 333
368static struct attribute *counters_attrs[] = { 334static struct attribute *counters_attrs[] = {
369 &counters_attr_glock_count.attr, 335 &counters_attr_glock_count.attr,
370 &counters_attr_glock_held_count.attr, 336 &counters_attr_glock_held_count.attr,
371 &counters_attr_inode_count.attr, 337 &counters_attr_inode_count.attr,
372 &counters_attr_bufdata_count.attr,
373 &counters_attr_unlinked_count.attr,
374 &counters_attr_quota_count.attr,
375 &counters_attr_log_num_gl.attr,
376 &counters_attr_log_num_buf.attr,
377 &counters_attr_log_num_revoke.attr,
378 &counters_attr_log_num_rg.attr,
379 &counters_attr_log_num_databuf.attr,
380 &counters_attr_log_blks_free.attr,
381 &counters_attr_jd_blocks.attr,
382 &counters_attr_reclaim_count.attr,
383 &counters_attr_log_wraps.attr,
384 &counters_attr_fh2dentry_misses.attr,
385 &counters_attr_reclaimed.attr, 338 &counters_attr_reclaimed.attr,
386 &counters_attr_log_flush_incore.attr,
387 &counters_attr_log_flush_ondisk.attr,
388 &counters_attr_glock_nq_calls.attr,
389 &counters_attr_glock_dq_calls.attr,
390 &counters_attr_glock_prefetch_calls.attr,
391 &counters_attr_lm_lock_calls.attr,
392 &counters_attr_lm_unlock_calls.attr,
393 &counters_attr_lm_callbacks.attr,
394 &counters_attr_ops_address.attr,
395 &counters_attr_ops_dentry.attr,
396 &counters_attr_ops_export.attr,
397 &counters_attr_ops_file.attr,
398 &counters_attr_ops_inode.attr,
399 &counters_attr_ops_super.attr,
400 &counters_attr_ops_vm.attr,
401 NULL 339 NULL
402}; 340};
403 341