bcachefs: merge BCH_INODE_FIELDS_INHERIT/BCH_INODE_OPTS

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2018-12-13 08:24:21 -05:00 committed by Kent Overstreet
parent a3e70fb287
commit d42dd4ad6d
3 changed files with 17 additions and 23 deletions

View File

@ -716,16 +716,17 @@ struct bch_inode_generation {
x(bi_background_target, 16) \
x(bi_erasure_code, 16)
#define BCH_INODE_FIELDS_INHERIT() \
x(bi_data_checksum) \
x(bi_compression) \
x(bi_project) \
x(bi_background_compression) \
x(bi_data_replicas) \
x(bi_promote_target) \
x(bi_foreground_target) \
x(bi_background_target) \
x(bi_erasure_code)
/* subset of BCH_INODE_FIELDS */
#define BCH_INODE_OPTS() \
x(data_checksum, 8) \
x(compression, 8) \
x(project, 32) \
x(background_compression, 8) \
x(data_replicas, 8) \
x(promote_target, 16) \
x(foreground_target, 16) \
x(background_target, 16) \
x(erasure_code, 16)
enum {
/*

View File

@ -265,8 +265,8 @@ void bch2_inode_init(struct bch_fs *c, struct bch_inode_unpacked *inode_u,
inode_u->bi_otime = now;
if (parent) {
#define x(_name) inode_u->_name = parent->_name;
BCH_INODE_FIELDS_INHERIT()
#define x(_name, ...) inode_u->bi_##_name = parent->bi_##_name;
BCH_INODE_OPTS()
#undef x
}
}

View File

@ -188,7 +188,10 @@ enum opt_type {
NO_SB_OPT, false) \
BCH_OPT(version_upgrade, u8, OPT_MOUNT, \
OPT_BOOL(), \
NO_SB_OPT, false)
NO_SB_OPT, false) \
BCH_OPT(project, u8, OPT_INTERNAL, \
OPT_BOOL(), \
NO_SB_OPT, false) \
struct bch_opts {
#define BCH_OPT(_name, _bits, ...) unsigned _name##_defined:1;
@ -281,16 +284,6 @@ int bch2_parse_mount_opts(struct bch_opts *, char *);
/* inode opts: */
#define BCH_INODE_OPTS() \
x(data_checksum, 8) \
x(compression, 8) \
x(background_compression, 8) \
x(data_replicas, 8) \
x(promote_target, 16) \
x(foreground_target, 16) \
x(background_target, 16) \
x(erasure_code, 16)
struct bch_io_opts {
#define x(_name, _bits) unsigned _name##_defined:1;
BCH_INODE_OPTS()