summaryrefslogtreecommitdiff
path: root/libbcachefs/extents.h
diff options
context:
space:
mode:
Diffstat (limited to 'libbcachefs/extents.h')
-rw-r--r--libbcachefs/extents.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/libbcachefs/extents.h b/libbcachefs/extents.h
index 224df172..84737af6 100644
--- a/libbcachefs/extents.h
+++ b/libbcachefs/extents.h
@@ -510,6 +510,23 @@ static inline bool bkey_extent_is_allocation(const struct bkey *k)
}
}
+static inline bool bkey_extent_is_unwritten(struct bkey_s_c k)
+{
+ struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k);
+ const struct bch_extent_ptr *ptr;
+
+ bkey_for_each_ptr(ptrs, ptr)
+ if (ptr->unwritten)
+ return true;
+ return false;
+}
+
+static inline bool bkey_extent_is_reservation(struct bkey_s_c k)
+{
+ return k.k->type == KEY_TYPE_reservation ||
+ bkey_extent_is_unwritten(k);
+}
+
static inline struct bch_devs_list bch2_bkey_devs(struct bkey_s_c k)
{
struct bch_devs_list ret = (struct bch_devs_list) { 0 };
@@ -579,6 +596,7 @@ bool bch2_bkey_is_incompressible(struct bkey_s_c);
unsigned bch2_bkey_sectors_compressed(struct bkey_s_c);
unsigned bch2_bkey_replicas(struct bch_fs *, struct bkey_s_c);
+unsigned bch2_extent_ptr_durability(struct bch_fs *, struct extent_ptr_decoded *);
unsigned bch2_bkey_durability(struct bch_fs *, struct bkey_s_c);
void bch2_bkey_extent_entry_drop(struct bkey_i *, union bch_extent_entry *);