Skip to content

Commit 2499805

Browse files
author
Kent Overstreet
committed
bcachefs: Split out replicas_format.h
Signed-off-by: Kent Overstreet <[email protected]>
1 parent 1cdcc6e commit 2499805

File tree

2 files changed

+36
-32
lines changed

2 files changed

+36
-32
lines changed

fs/bcachefs/bcachefs_format.h

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -503,19 +503,20 @@ struct bch_sb_field {
503503

504504
#include "alloc_background_format.h"
505505
#include "extents_format.h"
506-
#include "reflink_format.h"
507506
#include "ec_format.h"
508-
#include "inode_format.h"
509507
#include "dirent_format.h"
510508
#include "disk_groups_format.h"
511-
#include "xattr_format.h"
512-
#include "quota_format.h"
509+
#include "inode_format.h"
513510
#include "logged_ops_format.h"
511+
#include "quota_format.h"
512+
#include "reflink_format.h"
513+
#include "replicas_format.h"
514514
#include "snapshot_format.h"
515515
#include "subvolume_format.h"
516516
#include "sb-counters_format.h"
517517
#include "sb-downgrade_format.h"
518518
#include "sb-members_format.h"
519+
#include "xattr_format.h"
519520

520521
enum bch_sb_field_type {
521522
#define x(f, nr) BCH_SB_FIELD_##f = nr,
@@ -596,8 +597,6 @@ LE64_BITMASK(BCH_KDF_SCRYPT_N, struct bch_sb_field_crypt, kdf_flags, 0, 16);
596597
LE64_BITMASK(BCH_KDF_SCRYPT_R, struct bch_sb_field_crypt, kdf_flags, 16, 32);
597598
LE64_BITMASK(BCH_KDF_SCRYPT_P, struct bch_sb_field_crypt, kdf_flags, 32, 48);
598599

599-
/* BCH_SB_FIELD_replicas: */
600-
601600
#define BCH_DATA_TYPES() \
602601
x(free, 0) \
603602
x(sb, 1) \
@@ -640,32 +639,6 @@ static inline bool data_type_is_hidden(enum bch_data_type type)
640639
}
641640
}
642641

643-
struct bch_replicas_entry_v0 {
644-
__u8 data_type;
645-
__u8 nr_devs;
646-
__u8 devs[];
647-
} __packed;
648-
649-
struct bch_sb_field_replicas_v0 {
650-
struct bch_sb_field field;
651-
struct bch_replicas_entry_v0 entries[];
652-
} __packed __aligned(8);
653-
654-
struct bch_replicas_entry_v1 {
655-
__u8 data_type;
656-
__u8 nr_devs;
657-
__u8 nr_required;
658-
__u8 devs[];
659-
} __packed;
660-
661-
#define replicas_entry_bytes(_i) \
662-
(offsetof(typeof(*(_i)), devs) + (_i)->nr_devs)
663-
664-
struct bch_sb_field_replicas {
665-
struct bch_sb_field field;
666-
struct bch_replicas_entry_v1 entries[];
667-
} __packed __aligned(8);
668-
669642
/*
670643
* On clean shutdown, store btree roots and current journal sequence number in
671644
* the superblock:

fs/bcachefs/replicas_format.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _BCACHEFS_REPLICAS_FORMAT_H
3+
#define _BCACHEFS_REPLICAS_FORMAT_H
4+
5+
struct bch_replicas_entry_v0 {
6+
__u8 data_type;
7+
__u8 nr_devs;
8+
__u8 devs[];
9+
} __packed;
10+
11+
struct bch_sb_field_replicas_v0 {
12+
struct bch_sb_field field;
13+
struct bch_replicas_entry_v0 entries[];
14+
} __packed __aligned(8);
15+
16+
struct bch_replicas_entry_v1 {
17+
__u8 data_type;
18+
__u8 nr_devs;
19+
__u8 nr_required;
20+
__u8 devs[];
21+
} __packed;
22+
23+
struct bch_sb_field_replicas {
24+
struct bch_sb_field field;
25+
struct bch_replicas_entry_v1 entries[];
26+
} __packed __aligned(8);
27+
28+
#define replicas_entry_bytes(_i) \
29+
(offsetof(typeof(*(_i)), devs) + (_i)->nr_devs)
30+
31+
#endif /* _BCACHEFS_REPLICAS_FORMAT_H */

0 commit comments

Comments
 (0)