diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-01-21 15:32:13 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:14 -0400 |
commit | 7ef2a73a5881323d53453cc3be7261fe1a49af1d (patch) | |
tree | 85e8d67b00a6c28dd8691e79d1674c111e8a1328 /fs/bcachefs/sysfs.c | |
parent | dbaee468461bfa82e6453ca0e009e9661cc570da (diff) |
bcachefs: Fix check for if extent update is allocating
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/sysfs.c')
-rw-r--r-- | fs/bcachefs/sysfs.c | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c index 27fd6dfe83f5..424636310bbf 100644 --- a/fs/bcachefs/sysfs.c +++ b/fs/bcachefs/sysfs.c @@ -234,33 +234,45 @@ static size_t bch2_btree_cache_size(struct bch_fs *c) static ssize_t show_fs_alloc_debug(struct bch_fs *c, char *buf) { struct printbuf out = _PBUF(buf, PAGE_SIZE); - struct bch_fs_usage stats = bch2_fs_usage_read(c); - unsigned replicas, type; + struct bch_fs_usage *fs_usage = bch2_fs_usage_read(c); + unsigned i; - pr_buf(&out, "capacity:\t\t%llu\n", c->capacity); + if (!fs_usage) + return -ENOMEM; - for (replicas = 0; replicas < ARRAY_SIZE(stats.replicas); replicas++) { - pr_buf(&out, "%u replicas:\n", replicas + 1); + pr_buf(&out, "capacity:\t\t%llu\n", c->capacity); + for (i = 0; + i < ARRAY_SIZE(fs_usage->persistent_reserved); + i++) { + pr_buf(&out, "%u replicas:\n", i + 1); +#if 0 for (type = BCH_DATA_SB; type < BCH_DATA_NR; type++) pr_buf(&out, "\t%s:\t\t%llu\n", bch2_data_types[type], stats.replicas[replicas].data[type]); pr_buf(&out, "\terasure coded:\t%llu\n", stats.replicas[replicas].ec_data); +#endif pr_buf(&out, "\treserved:\t%llu\n", - stats.replicas[replicas].persistent_reserved); + fs_usage->persistent_reserved[i]); } - pr_buf(&out, "bucket usage\n"); + pr_buf(&out, "online reserved:\t%llu\n", + fs_usage->s.online_reserved); - for (type = BCH_DATA_SB; type < BCH_DATA_NR; type++) - pr_buf(&out, "\t%s:\t\t%llu\n", - bch2_data_types[type], - stats.buckets[type]); + for (i = 0; i < c->replicas.nr; i++) { + struct bch_replicas_entry *e = + cpu_replicas_entry(&c->replicas, i); - pr_buf(&out, "online reserved:\t%llu\n", - stats.s.online_reserved); + pr_buf(&out, "\t"); + bch2_replicas_entry_to_text(&out, e); + pr_buf(&out, ":\t%llu\n", fs_usage->data[i]); + } + + percpu_up_read(&c->mark_lock); + + kfree(fs_usage); return out.pos - buf; } |