Commit 2766876d authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: struct bch_extent_rebalance

This adds the extent entry for extents that rebalance needs to do
something with.

We're adding this ahead of the main rebalance_work patchset, because
adding new extent entries can't be done in a forwards-compatible way.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 4e1430a7
...@@ -488,8 +488,9 @@ struct bch_csum { ...@@ -488,8 +488,9 @@ struct bch_csum {
x(crc32, 1) \ x(crc32, 1) \
x(crc64, 2) \ x(crc64, 2) \
x(crc128, 3) \ x(crc128, 3) \
x(stripe_ptr, 4) x(stripe_ptr, 4) \
#define BCH_EXTENT_ENTRY_MAX 5 x(rebalance, 5)
#define BCH_EXTENT_ENTRY_MAX 6
enum bch_extent_entry_type { enum bch_extent_entry_type {
#define x(f, n) BCH_EXTENT_ENTRY_##f = n, #define x(f, n) BCH_EXTENT_ENTRY_##f = n,
...@@ -624,6 +625,20 @@ struct bch_extent_reservation { ...@@ -624,6 +625,20 @@ struct bch_extent_reservation {
#endif #endif
}; };
struct bch_extent_rebalance {
#if defined(__LITTLE_ENDIAN_BITFIELD)
__u64 type:7,
unused:33,
compression:8,
target:16;
#elif defined (__BIG_ENDIAN_BITFIELD)
__u64 target:16,
compression:8,
unused:33,
type:7;
#endif
};
union bch_extent_entry { union bch_extent_entry {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ || __BITS_PER_LONG == 64 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ || __BITS_PER_LONG == 64
unsigned long type; unsigned long type;
......
...@@ -1202,6 +1202,8 @@ int bch2_bkey_ptrs_invalid(const struct bch_fs *c, struct bkey_s_c k, ...@@ -1202,6 +1202,8 @@ int bch2_bkey_ptrs_invalid(const struct bch_fs *c, struct bkey_s_c k,
} }
have_ec = true; have_ec = true;
break; break;
case BCH_EXTENT_ENTRY_rebalance:
break;
} }
} }
...@@ -1260,6 +1262,8 @@ void bch2_ptr_swab(struct bkey_s k) ...@@ -1260,6 +1262,8 @@ void bch2_ptr_swab(struct bkey_s k)
break; break;
case BCH_EXTENT_ENTRY_stripe_ptr: case BCH_EXTENT_ENTRY_stripe_ptr:
break; break;
case BCH_EXTENT_ENTRY_rebalance:
break;
} }
} }
} }
...@@ -1310,6 +1314,8 @@ int bch2_cut_front_s(struct bpos where, struct bkey_s k) ...@@ -1310,6 +1314,8 @@ int bch2_cut_front_s(struct bpos where, struct bkey_s k)
break; break;
case BCH_EXTENT_ENTRY_stripe_ptr: case BCH_EXTENT_ENTRY_stripe_ptr:
break; break;
case BCH_EXTENT_ENTRY_rebalance:
break;
} }
if (extent_entry_is_crc(entry)) if (extent_entry_is_crc(entry))
......
...@@ -318,6 +318,9 @@ static inline struct bkey_ptrs bch2_bkey_ptrs(struct bkey_s k) ...@@ -318,6 +318,9 @@ static inline struct bkey_ptrs bch2_bkey_ptrs(struct bkey_s k)
(_ptr).ec = _entry->stripe_ptr; \ (_ptr).ec = _entry->stripe_ptr; \
(_ptr).has_ec = true; \ (_ptr).has_ec = true; \
break; \ break; \
default: \
/* nothing */ \
break; \
} \ } \
out: \ out: \
_entry < (_end); \ _entry < (_end); \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment