diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2018-07-21 23:36:11 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:12 -0400 |
commit | 90541a741d74373b8cca2bcd56c469927d093064 (patch) | |
tree | 9cfaebc73ea36399eb97b0abe23c71b98756c69f /fs/bcachefs/bcachefs_format.h | |
parent | 3636ed489ac05e61d59be29b8e69111ef781d528 (diff) |
bcachefs: Add new alloc fields
prep work for persistent alloc info
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bcachefs_format.h')
-rw-r--r-- | fs/bcachefs/bcachefs_format.h | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h index 801156b74335..162a0a307f1b 100644 --- a/fs/bcachefs/bcachefs_format.h +++ b/fs/bcachefs/bcachefs_format.h @@ -807,11 +807,6 @@ struct bch_xattr { /* Bucket/allocation information: */ -enum { - BCH_ALLOC_FIELD_READ_TIME = 0, - BCH_ALLOC_FIELD_WRITE_TIME = 1, -}; - struct bch_alloc { struct bch_val v; __u8 fields; @@ -819,6 +814,32 @@ struct bch_alloc { __u8 data[]; } __attribute__((packed, aligned(8))); +#define BCH_ALLOC_FIELDS() \ + x(read_time, 2) \ + x(write_time, 2) \ + x(data_type, 1) \ + x(dirty_sectors, 2) \ + x(cached_sectors, 2) + +enum { +#define x(name, bytes) BCH_ALLOC_FIELD_##name, + BCH_ALLOC_FIELDS() +#undef x + BCH_ALLOC_FIELD_NR +}; + +static const unsigned BCH_ALLOC_FIELD_BYTES[] = { +#define x(name, bytes) [BCH_ALLOC_FIELD_##name] = bytes, + BCH_ALLOC_FIELDS() +#undef x +}; + +#define x(name, bytes) + bytes +static const unsigned BKEY_ALLOC_VAL_U64s_MAX = + DIV_ROUND_UP(offsetof(struct bch_alloc, data) + BCH_ALLOC_FIELDS(), sizeof(u64)); +#undef x + /* Quotas: */ enum quota_types { |