alloc_background.h (b962552eabd59f0026dcc21c14775b9d78336baf) alloc_background.h (a10195764901e0a41e64d596de57a957e7f982f0)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _BCACHEFS_ALLOC_BACKGROUND_H
3#define _BCACHEFS_ALLOC_BACKGROUND_H
4
5#include "bcachefs.h"
6#include "alloc_types.h"
7#include "buckets.h"
8#include "debug.h"

--- 73 unchanged lines hidden (view full) ---

82
83int bch2_alloc_v1_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *);
84int bch2_alloc_v2_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *);
85int bch2_alloc_v3_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *);
86int bch2_alloc_v4_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *);
87void bch2_alloc_v4_swab(struct bkey_s);
88void bch2_alloc_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
89
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _BCACHEFS_ALLOC_BACKGROUND_H
3#define _BCACHEFS_ALLOC_BACKGROUND_H
4
5#include "bcachefs.h"
6#include "alloc_types.h"
7#include "buckets.h"
8#include "debug.h"

--- 73 unchanged lines hidden (view full) ---

82
83int bch2_alloc_v1_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *);
84int bch2_alloc_v2_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *);
85int bch2_alloc_v3_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *);
86int bch2_alloc_v4_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *);
87void bch2_alloc_v4_swab(struct bkey_s);
88void bch2_alloc_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
89
90#define bch2_bkey_ops_alloc (struct bkey_ops) { \
90#define bch2_bkey_ops_alloc ((struct bkey_ops) { \
91 .key_invalid = bch2_alloc_v1_invalid, \
92 .val_to_text = bch2_alloc_to_text, \
93 .trans_trigger = bch2_trans_mark_alloc, \
94 .atomic_trigger = bch2_mark_alloc, \
91 .key_invalid = bch2_alloc_v1_invalid, \
92 .val_to_text = bch2_alloc_to_text, \
93 .trans_trigger = bch2_trans_mark_alloc, \
94 .atomic_trigger = bch2_mark_alloc, \
95}
95})
96
96
97#define bch2_bkey_ops_alloc_v2 (struct bkey_ops) { \
97#define bch2_bkey_ops_alloc_v2 ((struct bkey_ops) { \
98 .key_invalid = bch2_alloc_v2_invalid, \
99 .val_to_text = bch2_alloc_to_text, \
100 .trans_trigger = bch2_trans_mark_alloc, \
101 .atomic_trigger = bch2_mark_alloc, \
98 .key_invalid = bch2_alloc_v2_invalid, \
99 .val_to_text = bch2_alloc_to_text, \
100 .trans_trigger = bch2_trans_mark_alloc, \
101 .atomic_trigger = bch2_mark_alloc, \
102}
102})
103
103
104#define bch2_bkey_ops_alloc_v3 (struct bkey_ops) { \
104#define bch2_bkey_ops_alloc_v3 ((struct bkey_ops) { \
105 .key_invalid = bch2_alloc_v3_invalid, \
106 .val_to_text = bch2_alloc_to_text, \
107 .trans_trigger = bch2_trans_mark_alloc, \
108 .atomic_trigger = bch2_mark_alloc, \
105 .key_invalid = bch2_alloc_v3_invalid, \
106 .val_to_text = bch2_alloc_to_text, \
107 .trans_trigger = bch2_trans_mark_alloc, \
108 .atomic_trigger = bch2_mark_alloc, \
109}
109})
110
110
111#define bch2_bkey_ops_alloc_v4 (struct bkey_ops) { \
111#define bch2_bkey_ops_alloc_v4 ((struct bkey_ops) { \
112 .key_invalid = bch2_alloc_v4_invalid, \
113 .val_to_text = bch2_alloc_to_text, \
114 .swab = bch2_alloc_v4_swab, \
115 .trans_trigger = bch2_trans_mark_alloc, \
116 .atomic_trigger = bch2_mark_alloc, \
112 .key_invalid = bch2_alloc_v4_invalid, \
113 .val_to_text = bch2_alloc_to_text, \
114 .swab = bch2_alloc_v4_swab, \
115 .trans_trigger = bch2_trans_mark_alloc, \
116 .atomic_trigger = bch2_mark_alloc, \
117}
117})
118
119static inline bool bkey_is_alloc(const struct bkey *k)
120{
121 return k->type == KEY_TYPE_alloc ||
122 k->type == KEY_TYPE_alloc_v2 ||
123 k->type == KEY_TYPE_alloc_v3;
124}
125

--- 32 unchanged lines hidden ---
118
119static inline bool bkey_is_alloc(const struct bkey *k)
120{
121 return k->type == KEY_TYPE_alloc ||
122 k->type == KEY_TYPE_alloc_v2 ||
123 k->type == KEY_TYPE_alloc_v3;
124}
125

--- 32 unchanged lines hidden ---