diff options
author | Joel Becker <joel.becker@oracle.com> | 2009-01-06 17:57:08 -0500 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2009-06-03 22:15:36 -0400 |
commit | 73be192b17e43b6dc4f492dab41d70ab5b9d2908 (patch) | |
tree | 9482070421cda81f490036b28033d4f300a58a94 /fs/ocfs2/blockcheck.h | |
parent | 15633a220ffe74fc61bc8117e6a89a494011ea3d (diff) |
ocfs2: Add statistics for the checksum and ecc operations.
It would be nice to know how often we get checksum failures. Even
better, how many of them we can fix with the single bit ecc. So, we add
a statistics structure. The structure can be installed into debugfs
wherever the user wants.
For ocfs2, we'll put it in the superblock-specific debugfs directory and
pass it down from our higher-level functions. The stats are only
registered with debugfs when the filesystem supports metadata ecc.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/blockcheck.h')
-rw-r--r-- | fs/ocfs2/blockcheck.h | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/fs/ocfs2/blockcheck.h b/fs/ocfs2/blockcheck.h index 70ec3feda32f..d4b69febf70a 100644 --- a/fs/ocfs2/blockcheck.h +++ b/fs/ocfs2/blockcheck.h | |||
@@ -21,6 +21,24 @@ | |||
21 | #define OCFS2_BLOCKCHECK_H | 21 | #define OCFS2_BLOCKCHECK_H |
22 | 22 | ||
23 | 23 | ||
24 | /* Count errors and error correction from blockcheck.c */ | ||
25 | struct ocfs2_blockcheck_stats { | ||
26 | spinlock_t b_lock; | ||
27 | u64 b_check_count; /* Number of blocks we've checked */ | ||
28 | u64 b_failure_count; /* Number of failed checksums */ | ||
29 | u64 b_recover_count; /* Number of blocks fixed by ecc */ | ||
30 | |||
31 | /* | ||
32 | * debugfs entries, used if this is passed to | ||
33 | * ocfs2_blockcheck_stats_debugfs_install() | ||
34 | */ | ||
35 | struct dentry *b_debug_dir; /* Parent of the debugfs files */ | ||
36 | struct dentry *b_debug_check; /* Exposes b_check_count */ | ||
37 | struct dentry *b_debug_failure; /* Exposes b_failure_count */ | ||
38 | struct dentry *b_debug_recover; /* Exposes b_recover_count */ | ||
39 | }; | ||
40 | |||
41 | |||
24 | /* High level block API */ | 42 | /* High level block API */ |
25 | void ocfs2_compute_meta_ecc(struct super_block *sb, void *data, | 43 | void ocfs2_compute_meta_ecc(struct super_block *sb, void *data, |
26 | struct ocfs2_block_check *bc); | 44 | struct ocfs2_block_check *bc); |
@@ -37,11 +55,18 @@ int ocfs2_validate_meta_ecc_bhs(struct super_block *sb, | |||
37 | void ocfs2_block_check_compute(void *data, size_t blocksize, | 55 | void ocfs2_block_check_compute(void *data, size_t blocksize, |
38 | struct ocfs2_block_check *bc); | 56 | struct ocfs2_block_check *bc); |
39 | int ocfs2_block_check_validate(void *data, size_t blocksize, | 57 | int ocfs2_block_check_validate(void *data, size_t blocksize, |
40 | struct ocfs2_block_check *bc); | 58 | struct ocfs2_block_check *bc, |
59 | struct ocfs2_blockcheck_stats *stats); | ||
41 | void ocfs2_block_check_compute_bhs(struct buffer_head **bhs, int nr, | 60 | void ocfs2_block_check_compute_bhs(struct buffer_head **bhs, int nr, |
42 | struct ocfs2_block_check *bc); | 61 | struct ocfs2_block_check *bc); |
43 | int ocfs2_block_check_validate_bhs(struct buffer_head **bhs, int nr, | 62 | int ocfs2_block_check_validate_bhs(struct buffer_head **bhs, int nr, |
44 | struct ocfs2_block_check *bc); | 63 | struct ocfs2_block_check *bc, |
64 | struct ocfs2_blockcheck_stats *stats); | ||
65 | |||
66 | /* Debug Initialization */ | ||
67 | int ocfs2_blockcheck_stats_debugfs_install(struct ocfs2_blockcheck_stats *stats, | ||
68 | struct dentry *parent); | ||
69 | void ocfs2_blockcheck_stats_debugfs_remove(struct ocfs2_blockcheck_stats *stats); | ||
45 | 70 | ||
46 | /* | 71 | /* |
47 | * Hamming code functions | 72 | * Hamming code functions |