bcachefs: merge BCH_INODE_FIELDS_INHERIT/BCH_INODE_OPTS
authorKent Overstreet <kent.overstreet@gmail.com>
Thu, 13 Dec 2018 13:24:21 +0000 (08:24 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:13 +0000 (17:08 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/bcachefs_format.h
fs/bcachefs/inode.c
fs/bcachefs/opts.h

index 2e048d25d3a91000948084f641eef07fb25e6f5f..19d05a1a0224487bbbdd5e0a5d20906bfec4acdc 100644 (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 {
        /*
index f967029584a7c3f49c41aa15b373357ca89bae06..a85b7a683a3a9075c64e8d6bd196c5bf0faa716f 100644 (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
        }
 }
index 222c130c2054b9d1557d37cc7041270838b54028..faa2a72c8c3bd29aa8dab5647d59c495237bca53 100644 (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()