1 ext4: add debugging counters for crypto allocations
3 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 fs/ext4/counter_debug_list.h | 3 +++
6 fs/ext4/ext4.h | 6 ++++++
7 fs/ext4/page-io.c | 2 ++
8 fs/ext4/sysfs.c | 19 +++++++++++++++++++
9 4 files changed, 30 insertions(+)
11 diff --git a/fs/ext4/counter_debug_list.h b/fs/ext4/counter_debug_list.h
13 index 0000000..a0eb6d2
15 +++ b/fs/ext4/counter_debug_list.h
17 +EXT4_COUNTER_DEBUG(pageio_bio_submit)
18 +EXT4_COUNTER_DEBUG(pageio_bio_finish)
20 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
21 index 766b7f7..e4990ac 100644
25 #define ext4_debug(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
28 +#define EXT4_DEBUG_COUNTER(x) atomic_inc(&ext4_##x)
30 +#define EXT4_COUNTER_DEBUG(x) extern atomic_t ext4_##x;
31 +#include "counter_debug_list.h"
32 +#undef EXT4_COUNTER_DEBUG
35 * Turn on EXT_DEBUG to get lots of info about extents operations.
37 diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
38 index 17fbe38..29b5d61 100644
39 --- a/fs/ext4/page-io.c
40 +++ b/fs/ext4/page-io.c
41 @@ -63,6 +63,7 @@ static void ext4_finish_bio(struct bio *bio)
45 + EXT4_DEBUG_COUNTER(pageio_bio_finish);
46 bio_for_each_segment_all(bvec, bio, i) {
47 struct page *page = bvec->bv_page;
48 #ifdef CONFIG_EXT4_FS_ENCRYPTION
49 @@ -358,6 +359,7 @@ void ext4_io_submit(struct ext4_io_submit *io)
52 submit_bio(io_op, io->io_bio);
53 + EXT4_DEBUG_COUNTER(pageio_bio_submit);
57 diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
58 index 62bef0f..12aa1bd 100644
61 @@ -233,6 +233,24 @@ static struct attribute *ext4_feat_attrs[] = {
65 +#define EXT4_ATTR_DEBUG_COUNTER(_name) \
66 + EXT4_ATTR_PTR(_name, 0444, pointer_atomic, &ext4_##_name)
68 +#define EXT4_COUNTER_DEBUG(x) atomic_t ext4_##x;
69 +#include "counter_debug_list.h"
70 +#undef EXT4_COUNTER_DEBUG
72 +#define EXT4_COUNTER_DEBUG(x) EXT4_ATTR_DEBUG_COUNTER(x);
73 +#include "counter_debug_list.h"
74 +#undef EXT4_COUNTER_DEBUG
76 +#define EXT4_COUNTER_DEBUG(x) ATTR_LIST(x),
77 +static struct attribute *ext4_global_attrs[] = {
78 +#include "counter_debug_list.h"
81 +#undef EXT4_COUNTER_DEBUG
83 static void *calc_ptr(struct ext4_attr *a, struct ext4_sb_info *sbi)
85 switch (a->attr_ptr) {
86 @@ -334,6 +352,7 @@ static struct kobj_type ext4_sb_ktype = {
89 static struct kobj_type ext4_ktype = {
90 + .default_attrs = ext4_global_attrs,
91 .sysfs_ops = &ext4_attr_ops,