summaryrefslogtreecommitdiff
path: root/libbcachefs/replicas.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2018-11-03 20:11:29 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2018-11-03 20:19:25 -0400
commit2ab2ab0f781ae750473763e8a042c900a982d399 (patch)
tree2d76ee40a4cf6b6a54c180a9100216cc45c26f91 /libbcachefs/replicas.h
parente288c9f1de8a1b21a77cbfb80dfec37f2515e33c (diff)
Update bcachefs sources to b12d1535f3 bcachefs: fix bounds checks in bch2_bio_map()
Diffstat (limited to 'libbcachefs/replicas.h')
-rw-r--r--libbcachefs/replicas.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/libbcachefs/replicas.h b/libbcachefs/replicas.h
index 49f114b0..640fe5b2 100644
--- a/libbcachefs/replicas.h
+++ b/libbcachefs/replicas.h
@@ -1,13 +1,15 @@
#ifndef _BCACHEFS_REPLICAS_H
#define _BCACHEFS_REPLICAS_H
+#include "replicas_types.h"
+
bool bch2_replicas_marked(struct bch_fs *, enum bch_data_type,
struct bch_devs_list);
-bool bch2_bkey_replicas_marked(struct bch_fs *, enum bch_data_type,
+bool bch2_bkey_replicas_marked(struct bch_fs *, enum bkey_type,
struct bkey_s_c);
int bch2_mark_replicas(struct bch_fs *, enum bch_data_type,
struct bch_devs_list);
-int bch2_mark_bkey_replicas(struct bch_fs *, enum bch_data_type,
+int bch2_mark_bkey_replicas(struct bch_fs *, enum bkey_type,
struct bkey_s_c);
int bch2_cpu_replicas_to_text(struct bch_replicas_cpu *, char *, size_t);
@@ -33,11 +35,11 @@ int bch2_replicas_gc_start(struct bch_fs *, unsigned);
/* iterate over superblock replicas - used by userspace tools: */
-static inline struct bch_replicas_entry *
-replicas_entry_next(struct bch_replicas_entry *i)
-{
- return (void *) i + offsetof(struct bch_replicas_entry, devs) + i->nr;
-}
+#define replicas_entry_bytes(_i) \
+ (offsetof(typeof(*(_i)), devs) + (_i)->nr_devs)
+
+#define replicas_entry_next(_i) \
+ ((typeof(_i)) ((void *) (_i) + replicas_entry_bytes(_i)))
#define for_each_replicas_entry(_r, _i) \
for (_i = (_r)->entries; \