summaryrefslogtreecommitdiff
path: root/fs/bcachefs/logged_ops.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-08-27 18:27:41 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:10:12 -0400
commitaaad530ac6b1c836de4a29d227ab68be97e39a73 (patch)
tree0055c4852c1d71ad2ef96e36ed0c691aa1d24a8f /fs/bcachefs/logged_ops.h
parent5902cc283c060f0a006ee9b2f2a64855a09399b4 (diff)
downloadlwn-aaad530ac6b1c836de4a29d227ab68be97e39a73.tar.gz
lwn-aaad530ac6b1c836de4a29d227ab68be97e39a73.zip
bcachefs: BTREE_ID_logged_ops
Add a new btree for long running logged operations - i.e. for logging operations that we can't do within a single btree transaction, so that they can be resumed if we crash. Keys in the logged operations btree will represent operations in progress, with the state of the operation stored in the value. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/logged_ops.h')
-rw-r--r--fs/bcachefs/logged_ops.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/bcachefs/logged_ops.h b/fs/bcachefs/logged_ops.h
new file mode 100644
index 000000000000..9b758008c6bd
--- /dev/null
+++ b/fs/bcachefs/logged_ops.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _BCACHEFS_LOGGED_OPS_H
+#define _BCACHEFS_LOGGED_OPS_H
+
+#include "bkey.h"
+
+#define BCH_LOGGED_OPS()
+
+static inline int bch2_logged_op_update(struct btree_trans *trans, struct bkey_i *op)
+{
+ return bch2_btree_insert_nonextent(trans, BTREE_ID_logged_ops, op, 0);
+}
+
+int bch2_resume_logged_ops(struct bch_fs *);
+int bch2_logged_op_start(struct btree_trans *, struct bkey_i *);
+void bch2_logged_op_finish(struct btree_trans *, struct bkey_i *);
+
+#endif /* _BCACHEFS_LOGGED_OPS_H */