Commit 9fb3036f authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Move btree_updates to debugfs

sysfs is limited to PAGE_SIZE, and when we're debugging strange
deadlocks/priority inversions we need to see the full list.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent be42e4a6
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "btree_iter.h" #include "btree_iter.h"
#include "btree_locking.h" #include "btree_locking.h"
#include "btree_update.h" #include "btree_update.h"
#include "btree_update_interior.h"
#include "buckets.h" #include "buckets.h"
#include "debug.h" #include "debug.h"
#include "error.h" #include "error.h"
...@@ -668,7 +669,7 @@ static ssize_t bch2_journal_pins_read(struct file *file, char __user *buf, ...@@ -668,7 +669,7 @@ static ssize_t bch2_journal_pins_read(struct file *file, char __user *buf,
i->size = size; i->size = size;
i->ret = 0; i->ret = 0;
do { while (1) {
err = flush_buf(i); err = flush_buf(i);
if (err) if (err)
return err; return err;
...@@ -676,9 +677,12 @@ static ssize_t bch2_journal_pins_read(struct file *file, char __user *buf, ...@@ -676,9 +677,12 @@ static ssize_t bch2_journal_pins_read(struct file *file, char __user *buf,
if (!i->size) if (!i->size)
break; break;
if (done)
break;
done = bch2_journal_seq_pins_to_text(&i->buf, &c->journal, &i->iter); done = bch2_journal_seq_pins_to_text(&i->buf, &c->journal, &i->iter);
i->iter++; i->iter++;
} while (!done); }
if (i->buf.allocation_failure) if (i->buf.allocation_failure)
return -ENOMEM; return -ENOMEM;
...@@ -693,13 +697,45 @@ static const struct file_operations journal_pins_ops = { ...@@ -693,13 +697,45 @@ static const struct file_operations journal_pins_ops = {
.read = bch2_journal_pins_read, .read = bch2_journal_pins_read,
}; };
static ssize_t bch2_btree_updates_read(struct file *file, char __user *buf,
size_t size, loff_t *ppos)
{
struct dump_iter *i = file->private_data;
struct bch_fs *c = i->c;
int err;
i->ubuf = buf;
i->size = size;
i->ret = 0;
if (!i->iter) {
bch2_btree_updates_to_text(&i->buf, c);
i->iter++;
}
err = flush_buf(i);
if (err)
return err;
if (i->buf.allocation_failure)
return -ENOMEM;
return i->ret;
}
static const struct file_operations btree_updates_ops = {
.owner = THIS_MODULE,
.open = bch2_dump_open,
.release = bch2_dump_release,
.read = bch2_btree_updates_read,
};
static int btree_transaction_stats_open(struct inode *inode, struct file *file) static int btree_transaction_stats_open(struct inode *inode, struct file *file)
{ {
struct bch_fs *c = inode->i_private; struct bch_fs *c = inode->i_private;
struct dump_iter *i; struct dump_iter *i;
i = kzalloc(sizeof(struct dump_iter), GFP_KERNEL); i = kzalloc(sizeof(struct dump_iter), GFP_KERNEL);
if (!i) if (!i)
return -ENOMEM; return -ENOMEM;
...@@ -902,6 +938,9 @@ void bch2_fs_debug_init(struct bch_fs *c) ...@@ -902,6 +938,9 @@ void bch2_fs_debug_init(struct bch_fs *c)
debugfs_create_file("journal_pins", 0400, c->fs_debug_dir, debugfs_create_file("journal_pins", 0400, c->fs_debug_dir,
c->btree_debug, &journal_pins_ops); c->btree_debug, &journal_pins_ops);
debugfs_create_file("btree_updates", 0400, c->fs_debug_dir,
c->btree_debug, &btree_updates_ops);
debugfs_create_file("btree_transaction_stats", 0400, c->fs_debug_dir, debugfs_create_file("btree_transaction_stats", 0400, c->fs_debug_dir,
c, &btree_transaction_stats_op); c, &btree_transaction_stats_op);
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "btree_iter.h" #include "btree_iter.h"
#include "btree_key_cache.h" #include "btree_key_cache.h"
#include "btree_update.h" #include "btree_update.h"
#include "btree_update_interior.h"
#include "btree_gc.h" #include "btree_gc.h"
#include "buckets.h" #include "buckets.h"
#include "clock.h" #include "clock.h"
...@@ -166,7 +165,6 @@ read_attribute(btree_write_stats); ...@@ -166,7 +165,6 @@ read_attribute(btree_write_stats);
read_attribute(btree_cache_size); read_attribute(btree_cache_size);
read_attribute(compression_stats); read_attribute(compression_stats);
read_attribute(journal_debug); read_attribute(journal_debug);
read_attribute(btree_updates);
read_attribute(btree_cache); read_attribute(btree_cache);
read_attribute(btree_key_cache); read_attribute(btree_key_cache);
read_attribute(stripes_heap); read_attribute(stripes_heap);
...@@ -415,9 +413,6 @@ SHOW(bch2_fs) ...@@ -415,9 +413,6 @@ SHOW(bch2_fs)
if (attr == &sysfs_journal_debug) if (attr == &sysfs_journal_debug)
bch2_journal_debug_to_text(out, &c->journal); bch2_journal_debug_to_text(out, &c->journal);
if (attr == &sysfs_btree_updates)
bch2_btree_updates_to_text(out, c);
if (attr == &sysfs_btree_cache) if (attr == &sysfs_btree_cache)
bch2_btree_cache_to_text(out, c); bch2_btree_cache_to_text(out, c);
...@@ -639,7 +634,6 @@ SYSFS_OPS(bch2_fs_internal); ...@@ -639,7 +634,6 @@ SYSFS_OPS(bch2_fs_internal);
struct attribute *bch2_fs_internal_files[] = { struct attribute *bch2_fs_internal_files[] = {
&sysfs_flags, &sysfs_flags,
&sysfs_journal_debug, &sysfs_journal_debug,
&sysfs_btree_updates,
&sysfs_btree_cache, &sysfs_btree_cache,
&sysfs_btree_key_cache, &sysfs_btree_key_cache,
&sysfs_new_stripes, &sysfs_new_stripes,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment