summaryrefslogtreecommitdiff
path: root/libbcachefs/replicas.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-01-23 15:49:44 -0500
committerKent Overstreet <kent.overstreet@gmail.com>2019-01-23 15:53:32 -0500
commit35fca2f044d375b1590f499cfd34bef38ca0f8f1 (patch)
treec3906079fe4de190de30690bd2725e4bb0a28b0a /libbcachefs/replicas.h
parent1c50d258e3462cd0e0f76570685092910fc11873 (diff)
Update bcachefs sources to 99750eab4d bcachefs: Persist stripe blocks_used
Diffstat (limited to 'libbcachefs/replicas.h')
-rw-r--r--libbcachefs/replicas.h32
1 files changed, 27 insertions, 5 deletions
diff --git a/libbcachefs/replicas.h b/libbcachefs/replicas.h
index fc833653..0ac2b8e0 100644
--- a/libbcachefs/replicas.h
+++ b/libbcachefs/replicas.h
@@ -4,17 +4,39 @@
#include "eytzinger.h"
#include "replicas_types.h"
+void bch2_replicas_entry_to_text(struct printbuf *,
+ struct bch_replicas_entry *);
+void bch2_cpu_replicas_to_text(struct printbuf *, struct bch_replicas_cpu *);
+
+static inline struct bch_replicas_entry *
+cpu_replicas_entry(struct bch_replicas_cpu *r, unsigned i)
+{
+ return (void *) r->entries + r->entry_size * i;
+}
+
int bch2_replicas_entry_idx(struct bch_fs *,
struct bch_replicas_entry *);
-bool bch2_replicas_marked(struct bch_fs *, enum bch_data_type,
- struct bch_devs_list, bool);
+
+void bch2_devlist_to_replicas(struct bch_replicas_entry *,
+ enum bch_data_type,
+ struct bch_devs_list);
+bool bch2_replicas_marked(struct bch_fs *,
+ struct bch_replicas_entry *, bool);
+int bch2_mark_replicas(struct bch_fs *,
+ struct bch_replicas_entry *);
+
bool bch2_bkey_replicas_marked(struct bch_fs *,
struct bkey_s_c, bool);
-int bch2_mark_replicas(struct bch_fs *, enum bch_data_type,
- struct bch_devs_list);
int bch2_mark_bkey_replicas(struct bch_fs *, struct bkey_s_c);
-void bch2_cpu_replicas_to_text(struct printbuf *, struct bch_replicas_cpu *);
+static inline void bch2_replicas_entry_cached(struct bch_replicas_entry *e,
+ unsigned dev)
+{
+ e->data_type = BCH_DATA_CACHED;
+ e->nr_devs = 1;
+ e->nr_required = 1;
+ e->devs[0] = dev;
+}
struct replicas_status {
struct {