summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/progress.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-02-06 15:59:28 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2025-03-14 21:02:12 -0400
commitbaabeb499758706a9093c610c5d97cf6de5f649a (patch)
tree46047c07c28a8a6bd3d60395b9c3303144cb26cc /fs/bcachefs/progress.h
parentbcachefs: bch2_inum_offset_err_msg_trans() no longer handles transaction rest... (diff)
downloadlinux-baabeb499758706a9093c610c5d97cf6de5f649a.tar.gz
linux-baabeb499758706a9093c610c5d97cf6de5f649a.zip
bcachefs: Factor out progress.[ch]
the backpointers code has progress indicators; these aren't great, since they print to the dmesg console and we much prefer to have progress indicators reporting to a specific userspace program so they're not spamming the system console. But not all codepaths that need progress indicators support that yet, and we don't want users to think "this is hung". Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/progress.h')
-rw-r--r--fs/bcachefs/progress.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/fs/bcachefs/progress.h b/fs/bcachefs/progress.h
new file mode 100644
index 000000000000..23fb1811f943
--- /dev/null
+++ b/fs/bcachefs/progress.h
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _BCACHEFS_PROGRESS_H
+#define _BCACHEFS_PROGRESS_H
+
+/*
+ * Lame progress indicators
+ *
+ * We don't like to use these because they print to the dmesg console, which is
+ * spammy - we much prefer to be wired up to a userspace programm (e.g. via
+ * thread_with_file) and have it print the progress indicator.
+ *
+ * But some code is old and doesn't support that, or runs in a context where
+ * that's not yet practical (mount).
+ */
+
+struct progress_indicator_state {
+ unsigned long next_print;
+ u64 nodes_seen;
+ u64 nodes_total;
+ struct btree *last_node;
+};
+
+void bch2_progress_init(struct progress_indicator_state *, struct bch_fs *, u64);
+void bch2_progress_update_iter(struct btree_trans *,
+ struct progress_indicator_state *,
+ struct btree_iter *,
+ const char *);
+
+#endif /* _BCACHEFS_PROGRESS_H */