diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-03-28 17:38:28 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2021-03-29 00:22:38 -0400 |
commit | a2094890a90a2f865e49f94e8448deca7e5852ef (patch) | |
tree | 11bf5f426509e288b2b3482492c805a26bb1885a /libbcachefs/extents.h | |
parent | bb6eccc2ecd4728871bfc70462d3a4a20daa9d68 (diff) |
Update bcachefs sources to 18686af684 bcachefs: Inode backpointersv0.13
Diffstat (limited to 'libbcachefs/extents.h')
-rw-r--r-- | libbcachefs/extents.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libbcachefs/extents.h b/libbcachefs/extents.h index c8069dfb..ccee43a2 100644 --- a/libbcachefs/extents.h +++ b/libbcachefs/extents.h @@ -582,6 +582,24 @@ void bch2_ptr_swab(struct bkey_s); /* Generic extent code: */ +enum bch_extent_overlap { + BCH_EXTENT_OVERLAP_ALL = 0, + BCH_EXTENT_OVERLAP_BACK = 1, + BCH_EXTENT_OVERLAP_FRONT = 2, + BCH_EXTENT_OVERLAP_MIDDLE = 3, +}; + +/* Returns how k overlaps with m */ +static inline enum bch_extent_overlap bch2_extent_overlap(const struct bkey *k, + const struct bkey *m) +{ + int cmp1 = bkey_cmp(k->p, m->p) < 0; + int cmp2 = bkey_cmp(bkey_start_pos(k), + bkey_start_pos(m)) > 0; + + return (cmp1 << 1) + cmp2; +} + int bch2_cut_front_s(struct bpos, struct bkey_s); int bch2_cut_back_s(struct bpos, struct bkey_s); |