diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-04-01 01:29:59 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:30 -0400 |
commit | 822835ffeae411bbc8af104da9331fdf63a7bc12 (patch) | |
tree | 57d2b7fd487fc05d58464ea179d435ff4d149bc9 /fs/bcachefs/sysfs.c | |
parent | 8058ea64c31c8700eaab48c38a143d1c3817f1de (diff) | |
download | linux-822835ffeae411bbc8af104da9331fdf63a7bc12.tar.gz linux-822835ffeae411bbc8af104da9331fdf63a7bc12.tar.bz2 linux-822835ffeae411bbc8af104da9331fdf63a7bc12.zip |
bcachefs: Fold bucket_state in to BCH_DATA_TYPES()
Previously, we were missing accounting for buckets in need_gc_gens and
need_discard states. This matters because buckets in those states need
other btree operations done before they can be used, so they can't be
conuted when checking current number of free buckets against the
allocation watermark.
Also, we weren't directly counting free buckets at all. Now, data type 0
== BCH_DATA_free, and free buckets are counted; this means we can get
rid of the separate (poorly defined) count of unavailable buckets.
This is a new on disk format version, with upgrade and fsck required for
the accounting changes.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/sysfs.c')
-rw-r--r-- | fs/bcachefs/sysfs.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c index 872d7bed7b6b..c0cc6e9a3e05 100644 --- a/fs/bcachefs/sysfs.c +++ b/fs/bcachefs/sysfs.c @@ -724,18 +724,17 @@ static void dev_alloc_debug_to_text(struct printbuf *out, struct bch_dev *ca) nr[c->open_buckets[i].data_type]++; pr_buf(out, - "\t\t buckets\t sectors fragmented\n" - "capacity%16llu\n", + "\t\t\t buckets\t sectors fragmented\n" + "capacity\t%16llu\n", ca->mi.nbuckets - ca->mi.first_bucket); - for (i = 1; i < BCH_DATA_NR; i++) - pr_buf(out, "%-8s%16llu%16llu%16llu\n", + for (i = 0; i < BCH_DATA_NR; i++) + pr_buf(out, "%-16s%16llu%16llu%16llu\n", bch2_data_types[i], stats.d[i].buckets, stats.d[i].sectors, stats.d[i].fragmented); pr_buf(out, - "ec\t%16llu\n" - "available%15llu\n" + "ec\t\t%16llu\n" "\n" "freelist_wait\t\t%s\n" "open buckets allocated\t%u\n" @@ -746,7 +745,6 @@ static void dev_alloc_debug_to_text(struct printbuf *out, struct bch_dev *ca) "open_buckets_user\t%u\n" "btree reserve cache\t%u\n", stats.buckets_ec, - __dev_buckets_available(ca, stats, RESERVE_none), c->freelist_wait.list.first ? "waiting" : "empty", OPEN_BUCKETS_COUNT - c->open_buckets_nr_free, ca->nr_open_buckets, |