mirror of
https://github.com/torvalds/linux.git
synced 2026-09-25 04:43:52 -04:00
bcachefs: bch2_dev_usage_to_text()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
@@ -277,6 +277,36 @@ void bch2_dev_usage_init(struct bch_dev *ca)
|
||||
ca->usage_base->d[BCH_DATA_free].buckets = ca->mi.nbuckets - ca->mi.first_bucket;
|
||||
}
|
||||
|
||||
void bch2_dev_usage_to_text(struct printbuf *out, struct bch_dev_usage *usage)
|
||||
{
|
||||
prt_tab(out);
|
||||
prt_str(out, "buckets");
|
||||
prt_tab_rjust(out);
|
||||
prt_str(out, "sectors");
|
||||
prt_tab_rjust(out);
|
||||
prt_str(out, "fragmented");
|
||||
prt_tab_rjust(out);
|
||||
prt_newline(out);
|
||||
|
||||
for (unsigned i = 0; i < BCH_DATA_NR; i++) {
|
||||
prt_str(out, bch2_data_types[i]);
|
||||
prt_tab(out);
|
||||
prt_u64(out, usage->d[i].buckets);
|
||||
prt_tab_rjust(out);
|
||||
prt_u64(out, usage->d[i].sectors);
|
||||
prt_tab_rjust(out);
|
||||
prt_u64(out, usage->d[i].fragmented);
|
||||
prt_tab_rjust(out);
|
||||
prt_newline(out);
|
||||
}
|
||||
|
||||
prt_str(out, "ec");
|
||||
prt_tab(out);
|
||||
prt_u64(out, usage->buckets_ec);
|
||||
prt_tab_rjust(out);
|
||||
prt_newline(out);
|
||||
}
|
||||
|
||||
static void bch2_dev_usage_update(struct bch_fs *c, struct bch_dev *ca,
|
||||
struct bch_alloc_v4 old,
|
||||
struct bch_alloc_v4 new,
|
||||
|
||||
@@ -203,6 +203,7 @@ static inline struct bch_dev_usage bch2_dev_usage_read(struct bch_dev *ca)
|
||||
}
|
||||
|
||||
void bch2_dev_usage_init(struct bch_dev *);
|
||||
void bch2_dev_usage_to_text(struct printbuf *, struct bch_dev_usage *);
|
||||
|
||||
static inline u64 bch2_dev_buckets_reserved(struct bch_dev *ca, enum bch_watermark watermark)
|
||||
{
|
||||
|
||||
@@ -786,32 +786,7 @@ static void dev_alloc_debug_to_text(struct printbuf *out, struct bch_dev *ca)
|
||||
printbuf_tabstop_push(out, 16);
|
||||
printbuf_tabstop_push(out, 16);
|
||||
|
||||
prt_tab(out);
|
||||
prt_str(out, "buckets");
|
||||
prt_tab_rjust(out);
|
||||
prt_str(out, "sectors");
|
||||
prt_tab_rjust(out);
|
||||
prt_str(out, "fragmented");
|
||||
prt_tab_rjust(out);
|
||||
prt_newline(out);
|
||||
|
||||
for (i = 0; i < BCH_DATA_NR; i++) {
|
||||
prt_str(out, bch2_data_types[i]);
|
||||
prt_tab(out);
|
||||
prt_u64(out, stats.d[i].buckets);
|
||||
prt_tab_rjust(out);
|
||||
prt_u64(out, stats.d[i].sectors);
|
||||
prt_tab_rjust(out);
|
||||
prt_u64(out, stats.d[i].fragmented);
|
||||
prt_tab_rjust(out);
|
||||
prt_newline(out);
|
||||
}
|
||||
|
||||
prt_str(out, "ec");
|
||||
prt_tab(out);
|
||||
prt_u64(out, stats.buckets_ec);
|
||||
prt_tab_rjust(out);
|
||||
prt_newline(out);
|
||||
bch2_dev_usage_to_text(out, &stats);
|
||||
|
||||
prt_newline(out);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user