mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 10:45:49 +00:00
bcachefs: Rename bch_sb_field_members -> bch_sb_field_members_v1
Signed-off-by: Hunter Shaffer <huntershaffer182456@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
3f7b9713da
commit
9af26120f0
@ -1222,7 +1222,7 @@ struct bch_sb_field {
|
||||
|
||||
#define BCH_SB_FIELDS() \
|
||||
x(journal, 0) \
|
||||
x(members, 1) \
|
||||
x(members_v1, 1) \
|
||||
x(crypt, 2) \
|
||||
x(replicas_v0, 3) \
|
||||
x(quota, 4) \
|
||||
@ -1265,7 +1265,7 @@ struct bch_sb_field_journal_v2 {
|
||||
} d[];
|
||||
};
|
||||
|
||||
/* BCH_SB_FIELD_members: */
|
||||
/* BCH_SB_FIELD_members_v1: */
|
||||
|
||||
#define BCH_MIN_NR_NBUCKETS (1 << 6)
|
||||
|
||||
@ -1309,7 +1309,7 @@ enum bch_member_state {
|
||||
BCH_MEMBER_STATE_NR
|
||||
};
|
||||
|
||||
struct bch_sb_field_members {
|
||||
struct bch_sb_field_members_v1 {
|
||||
struct bch_sb_field field;
|
||||
struct bch_member _members[]; //Members are now variable size
|
||||
};
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "sb-members.h"
|
||||
#include "super-io.h"
|
||||
|
||||
/* Code for bch_sb_field_members: */
|
||||
/* Code for bch_sb_field_members_v1: */
|
||||
|
||||
static struct bch_member *members_v2_get_mut(struct bch_sb_field_members_v2 *mi, int i)
|
||||
{
|
||||
@ -26,12 +26,12 @@ static struct bch_member members_v2_get(struct bch_sb_field_members_v2 *mi, int
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct bch_member *members_v1_get_mut(struct bch_sb_field_members *mi, int i)
|
||||
static struct bch_member *members_v1_get_mut(struct bch_sb_field_members_v1 *mi, int i)
|
||||
{
|
||||
return (void *) mi->_members + (i * BCH_MEMBER_V1_BYTES);
|
||||
}
|
||||
|
||||
static struct bch_member members_v1_get(struct bch_sb_field_members *mi, int i)
|
||||
static struct bch_member members_v1_get(struct bch_sb_field_members_v1 *mi, int i)
|
||||
{
|
||||
struct bch_member ret, *p = members_v1_get_mut(mi, i);
|
||||
memset(&ret, 0, sizeof(ret));
|
||||
@ -43,7 +43,7 @@ struct bch_member bch2_sb_member_get(struct bch_sb *sb, int i)
|
||||
struct bch_sb_field_members_v2 *mi2 = bch2_sb_get_members_v2(sb);
|
||||
if (mi2)
|
||||
return members_v2_get(mi2, i);
|
||||
struct bch_sb_field_members *mi1 = bch2_sb_get_members(sb);
|
||||
struct bch_sb_field_members_v1 *mi1 = bch2_sb_get_members_v1(sb);
|
||||
return members_v1_get(mi1, i);
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ static int sb_members_v2_resize_entries(struct bch_fs *c)
|
||||
|
||||
int bch2_members_v2_init(struct bch_fs *c)
|
||||
{
|
||||
struct bch_sb_field_members *mi1;
|
||||
struct bch_sb_field_members_v1 *mi1;
|
||||
struct bch_sb_field_members_v2 *mi2;
|
||||
|
||||
if (!bch2_sb_get_members_v2(c->disk_sb.sb)) {
|
||||
@ -80,7 +80,7 @@ int bch2_members_v2_init(struct bch_fs *c)
|
||||
DIV_ROUND_UP(sizeof(*mi2) +
|
||||
sizeof(struct bch_member) * c->sb.nr_devices,
|
||||
sizeof(u64)));
|
||||
mi1 = bch2_sb_get_members(c->disk_sb.sb);
|
||||
mi1 = bch2_sb_get_members_v1(c->disk_sb.sb);
|
||||
memcpy(&mi2->_members[0], &mi1->_members[0],
|
||||
BCH_MEMBER_V1_BYTES * c->sb.nr_devices);
|
||||
memset(&mi2->pad[0], 0, sizeof(mi2->pad));
|
||||
@ -92,10 +92,10 @@ int bch2_members_v2_init(struct bch_fs *c)
|
||||
|
||||
int bch_members_cpy_v2_v1(struct bch_sb_handle *disk_sb)
|
||||
{
|
||||
struct bch_sb_field_members *mi1;
|
||||
struct bch_sb_field_members_v1 *mi1;
|
||||
struct bch_sb_field_members_v2 *mi2;
|
||||
|
||||
mi1 = bch2_sb_resize_members(disk_sb,
|
||||
mi1 = bch2_sb_resize_members_v1(disk_sb,
|
||||
DIV_ROUND_UP(sizeof(*mi1) + BCH_MEMBER_V1_BYTES *
|
||||
disk_sb->sb->nr_devices, sizeof(u64)));
|
||||
if (!mi1)
|
||||
@ -251,7 +251,7 @@ static int bch2_sb_members_v1_validate(struct bch_sb *sb,
|
||||
struct bch_sb_field *f,
|
||||
struct printbuf *err)
|
||||
{
|
||||
struct bch_sb_field_members *mi = field_to_type(f, members);
|
||||
struct bch_sb_field_members_v1 *mi = field_to_type(f, members_v1);
|
||||
unsigned i;
|
||||
|
||||
if ((void *) members_v1_get_mut(mi, sb->nr_devices) >
|
||||
@ -274,7 +274,7 @@ static int bch2_sb_members_v1_validate(struct bch_sb *sb,
|
||||
static void bch2_sb_members_v1_to_text(struct printbuf *out, struct bch_sb *sb,
|
||||
struct bch_sb_field *f)
|
||||
{
|
||||
struct bch_sb_field_members *mi = field_to_type(f, members);
|
||||
struct bch_sb_field_members_v1 *mi = field_to_type(f, members_v1);
|
||||
struct bch_sb_field_disk_groups *gi = bch2_sb_get_disk_groups(sb);
|
||||
unsigned i;
|
||||
|
||||
@ -284,7 +284,7 @@ static void bch2_sb_members_v1_to_text(struct printbuf *out, struct bch_sb *sb,
|
||||
}
|
||||
}
|
||||
|
||||
const struct bch_sb_field_ops bch_sb_field_ops_members = {
|
||||
const struct bch_sb_field_ops bch_sb_field_ops_members_v1 = {
|
||||
.validate = bch2_sb_members_v1_validate,
|
||||
.to_text = bch2_sb_members_v1_to_text,
|
||||
};
|
||||
|
@ -176,8 +176,7 @@ static inline struct bch_devs_mask bch2_online_devs(struct bch_fs *c)
|
||||
return devs;
|
||||
}
|
||||
|
||||
extern const struct bch_sb_field_ops bch_sb_field_ops_members_v1;
|
||||
extern const struct bch_sb_field_ops bch_sb_field_ops_members_v2;
|
||||
|
||||
extern const struct bch_sb_field_ops bch_sb_field_ops_members;
|
||||
|
||||
#endif /* _BCACHEFS_SB_MEMBERS_H */
|
||||
|
@ -355,7 +355,7 @@ static int bch2_sb_validate(struct bch_sb_handle *disk_sb, struct printbuf *out,
|
||||
{
|
||||
struct bch_sb *sb = disk_sb->sb;
|
||||
struct bch_sb_field *f;
|
||||
struct bch_sb_field_members *mi;
|
||||
struct bch_sb_field_members_v1 *mi;
|
||||
enum bch_opt_id opt_id;
|
||||
u16 block_size;
|
||||
int ret;
|
||||
@ -458,7 +458,7 @@ static int bch2_sb_validate(struct bch_sb_handle *disk_sb, struct printbuf *out,
|
||||
}
|
||||
|
||||
/* members must be validated first: */
|
||||
mi = bch2_sb_get_members(sb);
|
||||
mi = bch2_sb_get_members_v1(sb);
|
||||
if (!mi) {
|
||||
prt_printf(out, "Invalid superblock: member info area missing");
|
||||
return -BCH_ERR_invalid_sb_members_missing;
|
||||
@ -469,7 +469,7 @@ static int bch2_sb_validate(struct bch_sb_handle *disk_sb, struct printbuf *out,
|
||||
return ret;
|
||||
|
||||
vstruct_for_each(sb, f) {
|
||||
if (le32_to_cpu(f->type) == BCH_SB_FIELD_members)
|
||||
if (le32_to_cpu(f->type) == BCH_SB_FIELD_members_v1)
|
||||
continue;
|
||||
|
||||
ret = bch2_sb_field_validate(sb, f, out);
|
||||
|
@ -90,7 +90,7 @@ static inline void bch2_check_set_feature(struct bch_fs *c, unsigned feat)
|
||||
__bch2_check_set_feature(c, feat);
|
||||
}
|
||||
|
||||
/* BCH_SB_FIELD_members: */
|
||||
/* BCH_SB_FIELD_members_v1: */
|
||||
|
||||
static inline bool bch2_member_exists(struct bch_member *m)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user