Skip to content

Commit a44e4f8

Browse files
author
Kent Overstreet
committed
bcachefs: Document disk accounting keys and conuters
Signed-off-by: Kent Overstreet <[email protected]>
1 parent 9c893fa commit a44e4f8

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

fs/bcachefs/disk_accounting_format.h

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,22 +119,57 @@ enum disk_accounting_type {
119119
BCH_DISK_ACCOUNTING_TYPE_NR,
120120
};
121121

122+
/*
123+
* No subtypes - number of inodes in the entire filesystem
124+
*
125+
* XXX: perhaps we could add a per-subvolume counter?
126+
*/
122127
struct bch_acct_nr_inodes {
123128
};
124129

130+
/*
131+
* Tracks KEY_TYPE_reservation sectors, broken out by number of replicas for the
132+
* reservation:
133+
*/
125134
struct bch_acct_persistent_reserved {
126135
__u8 nr_replicas;
127136
};
128137

138+
/*
139+
* device, data type counter fields:
140+
* [
141+
* nr_buckets
142+
* live sectors (in buckets of that data type)
143+
* sectors of internal fragmentation
144+
* ]
145+
*
146+
* XXX: live sectors should've been done differently, you can have multiple data
147+
* types in the same bucket (user, stripe, cached) and this collapses them to
148+
* the bucket data type, and makes the internal fragmentation counter redundant
149+
*/
129150
struct bch_acct_dev_data_type {
130151
__u8 dev;
131152
__u8 data_type;
132153
};
133154

155+
/*
156+
* Compression type fields:
157+
* [
158+
* number of extents
159+
* uncompressed size
160+
* compressed size
161+
* ]
162+
*
163+
* Compression ratio, average extent size (fragmentation).
164+
*/
134165
struct bch_acct_compression {
135166
__u8 type;
136167
};
137168

169+
/*
170+
* On disk usage by snapshot id; counts same values as replicas counter, but
171+
* aggregated differently
172+
*/
138173
struct bch_acct_snapshot {
139174
__u32 id;
140175
} __packed;
@@ -143,10 +178,27 @@ struct bch_acct_btree {
143178
__u32 id;
144179
} __packed;
145180

181+
/*
182+
* inum counter fields:
183+
* [
184+
* number of extents
185+
* sum of extent sizes - bkey size
186+
* this field is similar to inode.bi_sectors, except here extents in
187+
* different snapshots but the same inode number are all collapsed to the
188+
* same counter
189+
* sum of on disk size - same values tracked by replicas counters
190+
* ]
191+
*
192+
* This tracks on disk fragmentation.
193+
*/
146194
struct bch_acct_inum {
147195
__u64 inum;
148196
} __packed;
149197

198+
/*
199+
* Simple counter of the amount of data (on disk sectors) rebalance needs to
200+
* move, extents counted here are also in the rebalance_work btree.
201+
*/
150202
struct bch_acct_rebalance_work {
151203
};
152204

@@ -155,7 +207,7 @@ struct disk_accounting_pos {
155207
struct {
156208
__u8 type;
157209
union {
158-
struct bch_acct_nr_inodes nr_inodes;
210+
struct bch_acct_nr_inodes nr_inodes;
159211
struct bch_acct_persistent_reserved persistent_reserved;
160212
struct bch_replicas_entry_v1 replicas;
161213
struct bch_acct_dev_data_type dev_data_type;

0 commit comments

Comments
 (0)