Skip to content

Commit 1a9e219

Browse files
author
Kent Overstreet
committed
bcachefs: improve bch2_dev_usage_to_text()
Add a line for capacity Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 077e473 commit 1a9e219

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

fs/bcachefs/alloc_foreground.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,7 @@ void bch2_dev_alloc_debug_to_text(struct printbuf *out, struct bch_dev *ca)
17401740
printbuf_tabstop_push(out, 16);
17411741
printbuf_tabstop_push(out, 16);
17421742

1743-
bch2_dev_usage_to_text(out, &stats);
1743+
bch2_dev_usage_to_text(out, ca, &stats);
17441744

17451745
prt_newline(out);
17461746

fs/bcachefs/buckets.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,21 @@ bch2_fs_usage_read_short(struct bch_fs *c)
7171
return ret;
7272
}
7373

74-
void bch2_dev_usage_to_text(struct printbuf *out, struct bch_dev_usage *usage)
74+
void bch2_dev_usage_to_text(struct printbuf *out,
75+
struct bch_dev *ca,
76+
struct bch_dev_usage *usage)
7577
{
7678
prt_printf(out, "\tbuckets\rsectors\rfragmented\r\n");
7779

7880
for (unsigned i = 0; i < BCH_DATA_NR; i++) {
7981
bch2_prt_data_type(out, i);
8082
prt_printf(out, "\t%llu\r%llu\r%llu\r\n",
81-
usage->d[i].buckets,
82-
usage->d[i].sectors,
83-
usage->d[i].fragmented);
83+
usage->d[i].buckets,
84+
usage->d[i].sectors,
85+
usage->d[i].fragmented);
8486
}
87+
88+
prt_printf(out, "capacity\t%llu\r\n", ca->mi.nbuckets);
8589
}
8690

8791
static int bch2_check_fix_ptr(struct btree_trans *trans,

fs/bcachefs/buckets.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static inline struct bch_dev_usage bch2_dev_usage_read(struct bch_dev *ca)
212212
return ret;
213213
}
214214

215-
void bch2_dev_usage_to_text(struct printbuf *, struct bch_dev_usage *);
215+
void bch2_dev_usage_to_text(struct printbuf *, struct bch_dev *, struct bch_dev_usage *);
216216

217217
static inline u64 bch2_dev_buckets_reserved(struct bch_dev *ca, enum bch_watermark watermark)
218218
{

0 commit comments

Comments
 (0)