Skip to content

Commit 4331480

Browse files
author
Kent Overstreet
committed
bcachefs: sb-counters_format.h
bcachefs_format.h has gotten too big; let's do some organizing. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 3a58dfb commit 4331480

File tree

2 files changed

+100
-95
lines changed

2 files changed

+100
-95
lines changed

fs/bcachefs/bcachefs_format.h

Lines changed: 2 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,6 +1234,8 @@ struct bch_sb_field {
12341234
x(ext, 13) \
12351235
x(downgrade, 14)
12361236

1237+
#include "sb-counters_format.h"
1238+
12371239
enum bch_sb_field_type {
12381240
#define x(f, nr) BCH_SB_FIELD_##f = nr,
12391241
BCH_SB_FIELDS()
@@ -1504,101 +1506,6 @@ struct bch_sb_field_disk_groups {
15041506
struct bch_disk_group entries[];
15051507
} __packed __aligned(8);
15061508

1507-
/* BCH_SB_FIELD_counters */
1508-
1509-
#define BCH_PERSISTENT_COUNTERS() \
1510-
x(io_read, 0) \
1511-
x(io_write, 1) \
1512-
x(io_move, 2) \
1513-
x(bucket_invalidate, 3) \
1514-
x(bucket_discard, 4) \
1515-
x(bucket_alloc, 5) \
1516-
x(bucket_alloc_fail, 6) \
1517-
x(btree_cache_scan, 7) \
1518-
x(btree_cache_reap, 8) \
1519-
x(btree_cache_cannibalize, 9) \
1520-
x(btree_cache_cannibalize_lock, 10) \
1521-
x(btree_cache_cannibalize_lock_fail, 11) \
1522-
x(btree_cache_cannibalize_unlock, 12) \
1523-
x(btree_node_write, 13) \
1524-
x(btree_node_read, 14) \
1525-
x(btree_node_compact, 15) \
1526-
x(btree_node_merge, 16) \
1527-
x(btree_node_split, 17) \
1528-
x(btree_node_rewrite, 18) \
1529-
x(btree_node_alloc, 19) \
1530-
x(btree_node_free, 20) \
1531-
x(btree_node_set_root, 21) \
1532-
x(btree_path_relock_fail, 22) \
1533-
x(btree_path_upgrade_fail, 23) \
1534-
x(btree_reserve_get_fail, 24) \
1535-
x(journal_entry_full, 25) \
1536-
x(journal_full, 26) \
1537-
x(journal_reclaim_finish, 27) \
1538-
x(journal_reclaim_start, 28) \
1539-
x(journal_write, 29) \
1540-
x(read_promote, 30) \
1541-
x(read_bounce, 31) \
1542-
x(read_split, 33) \
1543-
x(read_retry, 32) \
1544-
x(read_reuse_race, 34) \
1545-
x(move_extent_read, 35) \
1546-
x(move_extent_write, 36) \
1547-
x(move_extent_finish, 37) \
1548-
x(move_extent_fail, 38) \
1549-
x(move_extent_start_fail, 39) \
1550-
x(copygc, 40) \
1551-
x(copygc_wait, 41) \
1552-
x(gc_gens_end, 42) \
1553-
x(gc_gens_start, 43) \
1554-
x(trans_blocked_journal_reclaim, 44) \
1555-
x(trans_restart_btree_node_reused, 45) \
1556-
x(trans_restart_btree_node_split, 46) \
1557-
x(trans_restart_fault_inject, 47) \
1558-
x(trans_restart_iter_upgrade, 48) \
1559-
x(trans_restart_journal_preres_get, 49) \
1560-
x(trans_restart_journal_reclaim, 50) \
1561-
x(trans_restart_journal_res_get, 51) \
1562-
x(trans_restart_key_cache_key_realloced, 52) \
1563-
x(trans_restart_key_cache_raced, 53) \
1564-
x(trans_restart_mark_replicas, 54) \
1565-
x(trans_restart_mem_realloced, 55) \
1566-
x(trans_restart_memory_allocation_failure, 56) \
1567-
x(trans_restart_relock, 57) \
1568-
x(trans_restart_relock_after_fill, 58) \
1569-
x(trans_restart_relock_key_cache_fill, 59) \
1570-
x(trans_restart_relock_next_node, 60) \
1571-
x(trans_restart_relock_parent_for_fill, 61) \
1572-
x(trans_restart_relock_path, 62) \
1573-
x(trans_restart_relock_path_intent, 63) \
1574-
x(trans_restart_too_many_iters, 64) \
1575-
x(trans_restart_traverse, 65) \
1576-
x(trans_restart_upgrade, 66) \
1577-
x(trans_restart_would_deadlock, 67) \
1578-
x(trans_restart_would_deadlock_write, 68) \
1579-
x(trans_restart_injected, 69) \
1580-
x(trans_restart_key_cache_upgrade, 70) \
1581-
x(trans_traverse_all, 71) \
1582-
x(transaction_commit, 72) \
1583-
x(write_super, 73) \
1584-
x(trans_restart_would_deadlock_recursion_limit, 74) \
1585-
x(trans_restart_write_buffer_flush, 75) \
1586-
x(trans_restart_split_race, 76) \
1587-
x(write_buffer_flush_slowpath, 77) \
1588-
x(write_buffer_flush_sync, 78)
1589-
1590-
enum bch_persistent_counters {
1591-
#define x(t, n, ...) BCH_COUNTER_##t,
1592-
BCH_PERSISTENT_COUNTERS()
1593-
#undef x
1594-
BCH_COUNTER_NR
1595-
};
1596-
1597-
struct bch_sb_field_counters {
1598-
struct bch_sb_field field;
1599-
__le64 d[];
1600-
};
1601-
16021509
/*
16031510
* On clean shutdown, store btree roots and current journal sequence number in
16041511
* the superblock:

fs/bcachefs/sb-counters_format.h

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _BCACHEFS_SB_COUNTERS_FORMAT_H
3+
#define _BCACHEFS_SB_COUNTERS_FORMAT_H
4+
5+
#define BCH_PERSISTENT_COUNTERS() \
6+
x(io_read, 0) \
7+
x(io_write, 1) \
8+
x(io_move, 2) \
9+
x(bucket_invalidate, 3) \
10+
x(bucket_discard, 4) \
11+
x(bucket_alloc, 5) \
12+
x(bucket_alloc_fail, 6) \
13+
x(btree_cache_scan, 7) \
14+
x(btree_cache_reap, 8) \
15+
x(btree_cache_cannibalize, 9) \
16+
x(btree_cache_cannibalize_lock, 10) \
17+
x(btree_cache_cannibalize_lock_fail, 11) \
18+
x(btree_cache_cannibalize_unlock, 12) \
19+
x(btree_node_write, 13) \
20+
x(btree_node_read, 14) \
21+
x(btree_node_compact, 15) \
22+
x(btree_node_merge, 16) \
23+
x(btree_node_split, 17) \
24+
x(btree_node_rewrite, 18) \
25+
x(btree_node_alloc, 19) \
26+
x(btree_node_free, 20) \
27+
x(btree_node_set_root, 21) \
28+
x(btree_path_relock_fail, 22) \
29+
x(btree_path_upgrade_fail, 23) \
30+
x(btree_reserve_get_fail, 24) \
31+
x(journal_entry_full, 25) \
32+
x(journal_full, 26) \
33+
x(journal_reclaim_finish, 27) \
34+
x(journal_reclaim_start, 28) \
35+
x(journal_write, 29) \
36+
x(read_promote, 30) \
37+
x(read_bounce, 31) \
38+
x(read_split, 33) \
39+
x(read_retry, 32) \
40+
x(read_reuse_race, 34) \
41+
x(move_extent_read, 35) \
42+
x(move_extent_write, 36) \
43+
x(move_extent_finish, 37) \
44+
x(move_extent_fail, 38) \
45+
x(move_extent_start_fail, 39) \
46+
x(copygc, 40) \
47+
x(copygc_wait, 41) \
48+
x(gc_gens_end, 42) \
49+
x(gc_gens_start, 43) \
50+
x(trans_blocked_journal_reclaim, 44) \
51+
x(trans_restart_btree_node_reused, 45) \
52+
x(trans_restart_btree_node_split, 46) \
53+
x(trans_restart_fault_inject, 47) \
54+
x(trans_restart_iter_upgrade, 48) \
55+
x(trans_restart_journal_preres_get, 49) \
56+
x(trans_restart_journal_reclaim, 50) \
57+
x(trans_restart_journal_res_get, 51) \
58+
x(trans_restart_key_cache_key_realloced, 52) \
59+
x(trans_restart_key_cache_raced, 53) \
60+
x(trans_restart_mark_replicas, 54) \
61+
x(trans_restart_mem_realloced, 55) \
62+
x(trans_restart_memory_allocation_failure, 56) \
63+
x(trans_restart_relock, 57) \
64+
x(trans_restart_relock_after_fill, 58) \
65+
x(trans_restart_relock_key_cache_fill, 59) \
66+
x(trans_restart_relock_next_node, 60) \
67+
x(trans_restart_relock_parent_for_fill, 61) \
68+
x(trans_restart_relock_path, 62) \
69+
x(trans_restart_relock_path_intent, 63) \
70+
x(trans_restart_too_many_iters, 64) \
71+
x(trans_restart_traverse, 65) \
72+
x(trans_restart_upgrade, 66) \
73+
x(trans_restart_would_deadlock, 67) \
74+
x(trans_restart_would_deadlock_write, 68) \
75+
x(trans_restart_injected, 69) \
76+
x(trans_restart_key_cache_upgrade, 70) \
77+
x(trans_traverse_all, 71) \
78+
x(transaction_commit, 72) \
79+
x(write_super, 73) \
80+
x(trans_restart_would_deadlock_recursion_limit, 74) \
81+
x(trans_restart_write_buffer_flush, 75) \
82+
x(trans_restart_split_race, 76) \
83+
x(write_buffer_flush_slowpath, 77) \
84+
x(write_buffer_flush_sync, 78)
85+
86+
enum bch_persistent_counters {
87+
#define x(t, n, ...) BCH_COUNTER_##t,
88+
BCH_PERSISTENT_COUNTERS()
89+
#undef x
90+
BCH_COUNTER_NR
91+
};
92+
93+
struct bch_sb_field_counters {
94+
struct bch_sb_field field;
95+
__le64 d[];
96+
};
97+
98+
#endif /* _BCACHEFS_SB_COUNTERS_FORMAT_H */

0 commit comments

Comments
 (0)