diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h index 3fa053531344..0d4a8b75ff42 100644 --- a/fs/bcachefs/bcachefs.h +++ b/fs/bcachefs/bcachefs.h @@ -718,7 +718,7 @@ struct bch_fs { struct rhashtable promote_table; mempool_t compression_bounce[2]; - mempool_t compress_workspace[BCH_COMPRESSION_NR]; + mempool_t compress_workspace[BCH_COMPRESSION_TYPE_NR]; mempool_t decompress_workspace; ZSTD_parameters zstd_params; diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h index 9b8fc265a5c0..535ba2788315 100644 --- a/fs/bcachefs/bcachefs_format.h +++ b/fs/bcachefs/bcachefs_format.h @@ -436,47 +436,6 @@ struct bch_csum { __le64 hi; } __attribute__((packed, aligned(8))); -enum bch_csum_type { - BCH_CSUM_NONE = 0, - BCH_CSUM_CRC32C_NONZERO = 1, - BCH_CSUM_CRC64_NONZERO = 2, - BCH_CSUM_CHACHA20_POLY1305_80 = 3, - BCH_CSUM_CHACHA20_POLY1305_128 = 4, - BCH_CSUM_CRC32C = 5, - BCH_CSUM_CRC64 = 6, - BCH_CSUM_NR = 7, -}; - -static const unsigned bch_crc_bytes[] = { - [BCH_CSUM_NONE] = 0, - [BCH_CSUM_CRC32C_NONZERO] = 4, - [BCH_CSUM_CRC32C] = 4, - [BCH_CSUM_CRC64_NONZERO] = 8, - [BCH_CSUM_CRC64] = 8, - [BCH_CSUM_CHACHA20_POLY1305_80] = 10, - [BCH_CSUM_CHACHA20_POLY1305_128] = 16, -}; - -static inline _Bool bch2_csum_type_is_encryption(enum bch_csum_type type) -{ - switch (type) { - case BCH_CSUM_CHACHA20_POLY1305_80: - case BCH_CSUM_CHACHA20_POLY1305_128: - return true; - default: - return false; - } -} - -enum bch_compression_type { - BCH_COMPRESSION_NONE = 0, - BCH_COMPRESSION_LZ4_OLD = 1, - BCH_COMPRESSION_GZIP = 2, - BCH_COMPRESSION_LZ4 = 3, - BCH_COMPRESSION_ZSTD = 4, - BCH_COMPRESSION_NR = 5, -}; - #define BCH_EXTENT_ENTRY_TYPES() \ x(ptr, 0) \ x(crc32, 1) \ @@ -1320,17 +1279,29 @@ LE64_BITMASK(BCH_SB_GC_RESERVE_BYTES, struct bch_sb, flags[2], 4, 64); LE64_BITMASK(BCH_SB_ERASURE_CODE, struct bch_sb, flags[3], 0, 16); -/* Features: */ -enum bch_sb_features { - BCH_FEATURE_LZ4 = 0, - BCH_FEATURE_GZIP = 1, - BCH_FEATURE_ZSTD = 2, - BCH_FEATURE_ATOMIC_NLINK = 3, /* should have gone under compat */ - BCH_FEATURE_EC = 4, - BCH_FEATURE_JOURNAL_SEQ_BLACKLIST_V3 = 5, - BCH_FEATURE_REFLINK = 6, - BCH_FEATURE_NEW_SIPHASH = 7, - BCH_FEATURE_INLINE_DATA = 8, +/* + * Features: + * + * journal_seq_blacklist_v3: gates BCH_SB_FIELD_journal_seq_blacklist + * reflink: gates KEY_TYPE_reflink + * inline_data: gates KEY_TYPE_inline_data + * new_siphash: gates BCH_STR_HASH_SIPHASH + */ +#define BCH_SB_FEATURES() \ + x(lz4, 0) \ + x(gzip, 1) \ + x(zstd, 2) \ + x(atomic_nlink, 3) \ + x(ec, 4) \ + x(journal_seq_blacklist_v3, 5) \ + x(reflink, 6) \ + x(new_siphash, 7) \ + x(inline_data, 8) + +enum bch_sb_feature { +#define x(f, n) BCH_FEATURE_##f, + BCH_SB_FEATURES() +#undef x BCH_FEATURE_NR, }; @@ -1350,13 +1321,6 @@ enum bch_error_actions { BCH_NR_ERROR_ACTIONS = 3, }; -enum bch_csum_opts { - BCH_CSUM_OPT_NONE = 0, - BCH_CSUM_OPT_CRC32C = 1, - BCH_CSUM_OPT_CRC64 = 2, - BCH_CSUM_OPT_NR = 3, -}; - enum bch_str_hash_type { BCH_STR_HASH_CRC32C = 0, BCH_STR_HASH_CRC64 = 1, @@ -1372,15 +1336,68 @@ enum bch_str_hash_opts { BCH_STR_HASH_OPT_NR = 3, }; +enum bch_csum_type { + BCH_CSUM_NONE = 0, + BCH_CSUM_CRC32C_NONZERO = 1, + BCH_CSUM_CRC64_NONZERO = 2, + BCH_CSUM_CHACHA20_POLY1305_80 = 3, + BCH_CSUM_CHACHA20_POLY1305_128 = 4, + BCH_CSUM_CRC32C = 5, + BCH_CSUM_CRC64 = 6, + BCH_CSUM_NR = 7, +}; + +static const unsigned bch_crc_bytes[] = { + [BCH_CSUM_NONE] = 0, + [BCH_CSUM_CRC32C_NONZERO] = 4, + [BCH_CSUM_CRC32C] = 4, + [BCH_CSUM_CRC64_NONZERO] = 8, + [BCH_CSUM_CRC64] = 8, + [BCH_CSUM_CHACHA20_POLY1305_80] = 10, + [BCH_CSUM_CHACHA20_POLY1305_128] = 16, +}; + +static inline _Bool bch2_csum_type_is_encryption(enum bch_csum_type type) +{ + switch (type) { + case BCH_CSUM_CHACHA20_POLY1305_80: + case BCH_CSUM_CHACHA20_POLY1305_128: + return true; + default: + return false; + } +} + +enum bch_csum_opts { + BCH_CSUM_OPT_NONE = 0, + BCH_CSUM_OPT_CRC32C = 1, + BCH_CSUM_OPT_CRC64 = 2, + BCH_CSUM_OPT_NR = 3, +}; + #define BCH_COMPRESSION_TYPES() \ - x(NONE) \ - x(LZ4) \ - x(GZIP) \ - x(ZSTD) + x(none, 0) \ + x(lz4_old, 1) \ + x(gzip, 2) \ + x(lz4, 3) \ + x(zstd, 4) + +enum bch_compression_type { +#define x(t, n) BCH_COMPRESSION_TYPE_##t, + BCH_COMPRESSION_TYPES() +#undef x + BCH_COMPRESSION_TYPE_NR +}; + +#define BCH_COMPRESSION_OPTS() \ + x(none, 0) \ + x(lz4, 1) \ + x(gzip, 2) \ + x(zstd, 3) enum bch_compression_opts { -#define x(t) BCH_COMPRESSION_OPT_##t, - BCH_COMPRESSION_TYPES() +#define x(t, n) BCH_COMPRESSION_OPT_##t, + BCH_COMPRESSION_OPTS() #undef x BCH_COMPRESSION_OPT_NR }; diff --git a/fs/bcachefs/checksum.h b/fs/bcachefs/checksum.h index b84e81bac8ff..ca9e45906dc8 100644 --- a/fs/bcachefs/checksum.h +++ b/fs/bcachefs/checksum.h @@ -108,8 +108,8 @@ static inline enum bch_csum_type bch2_meta_checksum_type(struct bch_fs *c) } static const unsigned bch2_compression_opt_to_type[] = { -#define x(t) [BCH_COMPRESSION_OPT_##t] = BCH_COMPRESSION_##t, - BCH_COMPRESSION_TYPES() +#define x(t, n) [BCH_COMPRESSION_OPT_##t] = BCH_COMPRESSION_TYPE_##t, + BCH_COMPRESSION_OPTS() #undef x }; diff --git a/fs/bcachefs/compress.c b/fs/bcachefs/compress.c index d350d917a8d4..091958d1ea04 100644 --- a/fs/bcachefs/compress.c +++ b/fs/bcachefs/compress.c @@ -158,14 +158,14 @@ static int __bio_uncompress(struct bch_fs *c, struct bio *src, src_data = bio_map_or_bounce(c, src, READ); switch (crc.compression_type) { - case BCH_COMPRESSION_LZ4_OLD: - case BCH_COMPRESSION_LZ4: + case BCH_COMPRESSION_TYPE_lz4_old: + case BCH_COMPRESSION_TYPE_lz4: ret = LZ4_decompress_safe_partial(src_data.b, dst_data, src_len, dst_len, dst_len); if (ret != dst_len) goto err; break; - case BCH_COMPRESSION_GZIP: { + case BCH_COMPRESSION_TYPE_gzip: { z_stream strm = { .next_in = src_data.b, .avail_in = src_len, @@ -185,7 +185,7 @@ static int __bio_uncompress(struct bch_fs *c, struct bio *src, goto err; break; } - case BCH_COMPRESSION_ZSTD: { + case BCH_COMPRESSION_TYPE_zstd: { ZSTD_DCtx *ctx; size_t len; @@ -290,10 +290,10 @@ static int attempt_compress(struct bch_fs *c, void *workspace, void *dst, size_t dst_len, void *src, size_t src_len, - unsigned compression_type) + enum bch_compression_type compression_type) { switch (compression_type) { - case BCH_COMPRESSION_LZ4: { + case BCH_COMPRESSION_TYPE_lz4: { int len = src_len; int ret = LZ4_compress_destSize( src, dst, @@ -305,7 +305,7 @@ static int attempt_compress(struct bch_fs *c, return ret; } - case BCH_COMPRESSION_GZIP: { + case BCH_COMPRESSION_TYPE_gzip: { z_stream strm = { .next_in = src, .avail_in = src_len, @@ -326,7 +326,7 @@ static int attempt_compress(struct bch_fs *c, return strm.total_out; } - case BCH_COMPRESSION_ZSTD: { + case BCH_COMPRESSION_TYPE_zstd: { ZSTD_CCtx *ctx = zstd_init_cctx(workspace, zstd_cctx_workspace_bound(&c->zstd_params.cParams)); @@ -348,14 +348,14 @@ static int attempt_compress(struct bch_fs *c, static unsigned __bio_compress(struct bch_fs *c, struct bio *dst, size_t *dst_len, struct bio *src, size_t *src_len, - unsigned compression_type) + enum bch_compression_type compression_type) { struct bbuf src_data = { NULL }, dst_data = { NULL }; void *workspace; unsigned pad; int ret = 0; - BUG_ON(compression_type >= BCH_COMPRESSION_NR); + BUG_ON(compression_type >= BCH_COMPRESSION_TYPE_NR); BUG_ON(!mempool_initialized(&c->compress_workspace[compression_type])); /* If it's only one block, don't bother trying to compress: */ @@ -452,8 +452,8 @@ unsigned bch2_bio_compress(struct bch_fs *c, /* Don't generate a bigger output than input: */ dst->bi_iter.bi_size = min(dst->bi_iter.bi_size, src->bi_iter.bi_size); - if (compression_type == BCH_COMPRESSION_LZ4_OLD) - compression_type = BCH_COMPRESSION_LZ4; + if (compression_type == BCH_COMPRESSION_TYPE_lz4_old) + compression_type = BCH_COMPRESSION_TYPE_lz4; compression_type = __bio_compress(c, dst, dst_len, src, src_len, compression_type); @@ -465,15 +465,15 @@ unsigned bch2_bio_compress(struct bch_fs *c, static int __bch2_fs_compress_init(struct bch_fs *, u64); -#define BCH_FEATURE_NONE 0 +#define BCH_FEATURE_none 0 static const unsigned bch2_compression_opt_to_feature[] = { -#define x(t) [BCH_COMPRESSION_OPT_##t] = BCH_FEATURE_##t, - BCH_COMPRESSION_TYPES() +#define x(t, n) [BCH_COMPRESSION_OPT_##t] = BCH_FEATURE_##t, + BCH_COMPRESSION_OPTS() #undef x }; -#undef BCH_FEATURE_NONE +#undef BCH_FEATURE_none static int __bch2_check_set_has_compressed_data(struct bch_fs *c, u64 f) { @@ -537,11 +537,11 @@ static int __bch2_fs_compress_init(struct bch_fs *c, u64 features) size_t compress_workspace; size_t decompress_workspace; } compression_types[] = { - { BCH_FEATURE_LZ4, BCH_COMPRESSION_LZ4, LZ4_MEM_COMPRESS, 0 }, - { BCH_FEATURE_GZIP, BCH_COMPRESSION_GZIP, + { BCH_FEATURE_lz4, BCH_COMPRESSION_TYPE_lz4, LZ4_MEM_COMPRESS, 0 }, + { BCH_FEATURE_gzip, BCH_COMPRESSION_TYPE_gzip, zlib_deflate_workspacesize(MAX_WBITS, DEF_MEM_LEVEL), zlib_inflate_workspacesize(), }, - { BCH_FEATURE_ZSTD, BCH_COMPRESSION_ZSTD, + { BCH_FEATURE_zstd, BCH_COMPRESSION_TYPE_zstd, zstd_cctx_workspace_bound(¶ms.cParams), zstd_dctx_workspace_bound() }, }, *i; diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c index b85056440ac3..8322b043bdff 100644 --- a/fs/bcachefs/extents.c +++ b/fs/bcachefs/extents.c @@ -613,7 +613,7 @@ unsigned bch2_bkey_nr_ptrs_fully_allocated(struct bkey_s_c k) bkey_for_each_ptr_decode(k.k, ptrs, p, entry) ret += !p.ptr.cached && - p.crc.compression_type == BCH_COMPRESSION_NONE; + p.crc.compression_type == BCH_COMPRESSION_TYPE_none; } return ret; @@ -628,7 +628,7 @@ unsigned bch2_bkey_sectors_compressed(struct bkey_s_c k) bkey_for_each_ptr_decode(k.k, ptrs, p, entry) if (!p.ptr.cached && - p.crc.compression_type != BCH_COMPRESSION_NONE) + p.crc.compression_type != BCH_COMPRESSION_TYPE_none) ret += p.crc.compressed_size; return ret; @@ -1053,7 +1053,7 @@ const char *bch2_bkey_ptrs_invalid(const struct bch_fs *c, struct bkey_s_c k) if (!bch2_checksum_type_valid(c, crc.csum_type)) return "invalid checksum type"; - if (crc.compression_type >= BCH_COMPRESSION_NR) + if (crc.compression_type >= BCH_COMPRESSION_TYPE_NR) return "invalid compression type"; if (bch2_csum_type_is_encryption(crc.csum_type)) { diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c index cd230dc10984..e25f064706ad 100644 --- a/fs/bcachefs/fsck.c +++ b/fs/bcachefs/fsck.c @@ -1124,7 +1124,7 @@ static int check_inode_nlink(struct bch_fs *c, if (!link->count && !(u->bi_flags & BCH_INODE_UNLINKED) && - (c->sb.features & (1 << BCH_FEATURE_ATOMIC_NLINK))) { + (c->sb.features & (1 << BCH_FEATURE_atomic_nlink))) { if (fsck_err(c, "unreachable inode %llu not marked as unlinked (type %u)", u->bi_inum, mode_to_type(u->bi_mode)) == FSCK_ERR_IGNORE) @@ -1159,7 +1159,7 @@ static int check_inode_nlink(struct bch_fs *c, } if (i_nlink != real_i_nlink && - (c->sb.features & (1 << BCH_FEATURE_ATOMIC_NLINK))) { + (c->sb.features & (1 << BCH_FEATURE_atomic_nlink))) { if (fsck_err(c, "inode %llu has wrong i_nlink " "(type %u i_nlink %u, should be %u)", u->bi_inum, mode_to_type(u->bi_mode), diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c index dd8f356f3ef0..ba79b35a130f 100644 --- a/fs/bcachefs/io.c +++ b/fs/bcachefs/io.c @@ -1141,7 +1141,7 @@ static void bch2_write_data_inline(struct bch_write_op *op, unsigned data_len) unsigned sectors; int ret; - bch2_check_set_feature(op->c, BCH_FEATURE_INLINE_DATA); + bch2_check_set_feature(op->c, BCH_FEATURE_inline_data); ret = bch2_keylist_realloc(&op->insert_keys, op->inline_keys, ARRAY_SIZE(op->inline_keys), @@ -1788,7 +1788,7 @@ static void __bch2_read_endio(struct work_struct *work) crc.offset += rbio->offset_into_extent; crc.live_size = bvec_iter_sectors(rbio->bvec_iter); - if (crc.compression_type != BCH_COMPRESSION_NONE) { + if (crc.compression_type != BCH_COMPRESSION_TYPE_none) { bch2_encrypt_bio(c, crc.csum_type, nonce, src); if (bch2_bio_uncompress(c, src, dst, dst_iter, crc)) goto decompression_err; @@ -1996,7 +1996,7 @@ int __bch2_read_extent(struct bch_fs *c, struct bch_read_bio *orig, EBUG_ON(offset_into_extent + bvec_iter_sectors(iter) > k.k->size); - if (pick.crc.compression_type != BCH_COMPRESSION_NONE || + if (pick.crc.compression_type != BCH_COMPRESSION_TYPE_none || (pick.crc.csum_type != BCH_CSUM_NONE && (bvec_iter_sectors(iter) != pick.crc.uncompressed_size || (bch2_csum_type_is_encryption(pick.crc.csum_type) && diff --git a/fs/bcachefs/journal_seq_blacklist.c b/fs/bcachefs/journal_seq_blacklist.c index 787d9f7638d0..a21de0088753 100644 --- a/fs/bcachefs/journal_seq_blacklist.c +++ b/fs/bcachefs/journal_seq_blacklist.c @@ -121,7 +121,7 @@ int bch2_journal_seq_blacklist_add(struct bch_fs *c, u64 start, u64 end) bl->start[nr].end = cpu_to_le64(end); out_write_sb: c->disk_sb.sb->features[0] |= - 1ULL << BCH_FEATURE_JOURNAL_SEQ_BLACKLIST_V3; + 1ULL << BCH_FEATURE_journal_seq_blacklist_v3; ret = bch2_write_super(c); out: @@ -309,7 +309,7 @@ void bch2_blacklist_entries_gc(struct work_struct *work) if (!new_nr) c->disk_sb.sb->features[0] &= - ~(1ULL << BCH_FEATURE_JOURNAL_SEQ_BLACKLIST_V3); + ~(1ULL << BCH_FEATURE_journal_seq_blacklist_v3); bch2_write_super(c); } diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c index 261e465341cd..cb7bb751b7b5 100644 --- a/fs/bcachefs/move.c +++ b/fs/bcachefs/move.c @@ -271,7 +271,7 @@ int bch2_migrate_write_init(struct bch_fs *c, struct migrate_write *m, bkey_for_each_ptr_decode(k.k, ptrs, p, entry) if (!p.ptr.cached && - p.crc.compression_type != BCH_COMPRESSION_NONE && + p.crc.compression_type != BCH_COMPRESSION_TYPE_none && bch2_dev_in_target(c, p.ptr.dev, data_opts.target)) compressed_sectors += p.crc.compressed_size; diff --git a/fs/bcachefs/opts.c b/fs/bcachefs/opts.c index cbacd2f36799..94d6c044a27d 100644 --- a/fs/bcachefs/opts.c +++ b/fs/bcachefs/opts.c @@ -16,18 +16,24 @@ const char * const bch2_error_actions[] = { NULL }; -const char * const bch2_csum_types[] = { +const char * const bch2_sb_features[] = { +#define x(f, n) #f, + BCH_SB_FEATURES() +#undef x + NULL +}; + +const char * const bch2_csum_opts[] = { "none", "crc32c", "crc64", NULL }; -const char * const bch2_compression_types[] = { - "none", - "lz4", - "gzip", - "zstd", +const char * const bch2_compression_opts[] = { +#define x(t, n) #t, + BCH_COMPRESSION_OPTS() +#undef x NULL }; @@ -300,7 +306,7 @@ int bch2_opt_check_may_set(struct bch_fs *c, int id, u64 v) break; case Opt_erasure_code: if (v) - bch2_check_set_feature(c, BCH_FEATURE_EC); + bch2_check_set_feature(c, BCH_FEATURE_ec); break; } diff --git a/fs/bcachefs/opts.h b/fs/bcachefs/opts.h index 92a9b7e0f47f..59c7b3685745 100644 --- a/fs/bcachefs/opts.h +++ b/fs/bcachefs/opts.h @@ -9,8 +9,9 @@ #include "bcachefs_format.h" extern const char * const bch2_error_actions[]; -extern const char * const bch2_csum_types[]; -extern const char * const bch2_compression_types[]; +extern const char * const bch2_sb_features[]; +extern const char * const bch2_csum_opts[]; +extern const char * const bch2_compression_opts[]; extern const char * const bch2_str_hash_types[]; extern const char * const bch2_data_types[]; extern const char * const bch2_cache_replacement_policies[]; @@ -112,23 +113,23 @@ enum opt_type { "#", NULL) \ x(metadata_checksum, u8, \ OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME, \ - OPT_STR(bch2_csum_types), \ + OPT_STR(bch2_csum_opts), \ BCH_SB_META_CSUM_TYPE, BCH_CSUM_OPT_CRC32C, \ NULL, NULL) \ x(data_checksum, u8, \ OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME|OPT_INODE, \ - OPT_STR(bch2_csum_types), \ + OPT_STR(bch2_csum_opts), \ BCH_SB_DATA_CSUM_TYPE, BCH_CSUM_OPT_CRC32C, \ NULL, NULL) \ x(compression, u8, \ OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME|OPT_INODE, \ - OPT_STR(bch2_compression_types), \ - BCH_SB_COMPRESSION_TYPE, BCH_COMPRESSION_OPT_NONE, \ + OPT_STR(bch2_compression_opts), \ + BCH_SB_COMPRESSION_TYPE, BCH_COMPRESSION_OPT_none, \ NULL, NULL) \ x(background_compression, u8, \ OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME|OPT_INODE, \ - OPT_STR(bch2_compression_types), \ - BCH_SB_BACKGROUND_COMPRESSION_TYPE,BCH_COMPRESSION_OPT_NONE, \ + OPT_STR(bch2_compression_opts), \ + BCH_SB_BACKGROUND_COMPRESSION_TYPE,BCH_COMPRESSION_OPT_none, \ NULL, NULL) \ x(str_hash, u8, \ OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME, \ diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c index 9c90d2bbb7cc..97b367252e82 100644 --- a/fs/bcachefs/recovery.c +++ b/fs/bcachefs/recovery.c @@ -866,7 +866,7 @@ int bch2_fs_recovery(struct bch_fs *c) } if (!c->sb.clean) { - if (!(c->sb.features & (1 << BCH_FEATURE_ATOMIC_NLINK))) { + if (!(c->sb.features & (1 << BCH_FEATURE_atomic_nlink))) { bch_info(c, "checking inode link counts"); err = "error in recovery"; ret = bch2_fsck_inode_nlink(c); @@ -907,6 +907,7 @@ int bch2_fs_recovery(struct bch_fs *c) c->disk_sb.sb->version_min = le16_to_cpu(bcachefs_metadata_version_min); c->disk_sb.sb->version = le16_to_cpu(bcachefs_metadata_version_current); + c->disk_sb.sb->features[0] |= 1ULL << BCH_FEATURE_new_siphash; write_sb = true; } @@ -917,7 +918,7 @@ int bch2_fs_recovery(struct bch_fs *c) if (c->opts.fsck && !test_bit(BCH_FS_ERROR, &c->flags)) { - c->disk_sb.sb->features[0] |= 1ULL << BCH_FEATURE_ATOMIC_NLINK; + c->disk_sb.sb->features[0] |= 1ULL << BCH_FEATURE_atomic_nlink; SET_BCH_SB_HAS_ERRORS(c->disk_sb.sb, 0); write_sb = true; } @@ -1024,7 +1025,8 @@ int bch2_fs_initialize(struct bch_fs *c) mutex_lock(&c->sb_lock); c->disk_sb.sb->version = c->disk_sb.sb->version_min = le16_to_cpu(bcachefs_metadata_version_current); - c->disk_sb.sb->features[0] |= 1ULL << BCH_FEATURE_ATOMIC_NLINK; + c->disk_sb.sb->features[0] |= 1ULL << BCH_FEATURE_atomic_nlink; + c->disk_sb.sb->features[0] |= 1ULL << BCH_FEATURE_new_siphash; SET_BCH_SB_INITIALIZED(c->disk_sb.sb, true); SET_BCH_SB_CLEAN(c->disk_sb.sb, false); diff --git a/fs/bcachefs/reflink.c b/fs/bcachefs/reflink.c index 5cad39fe031f..2bf003ba3bd8 100644 --- a/fs/bcachefs/reflink.c +++ b/fs/bcachefs/reflink.c @@ -171,7 +171,7 @@ s64 bch2_remap_range(struct bch_fs *c, if (!percpu_ref_tryget(&c->writes)) return -EROFS; - bch2_check_set_feature(c, BCH_FEATURE_REFLINK); + bch2_check_set_feature(c, BCH_FEATURE_reflink); dst_end.offset += remap_sectors; src_end.offset += remap_sectors; diff --git a/fs/bcachefs/str_hash.h b/fs/bcachefs/str_hash.h index 7be4a8e50eaa..3870df2d58ce 100644 --- a/fs/bcachefs/str_hash.h +++ b/fs/bcachefs/str_hash.h @@ -23,7 +23,7 @@ bch2_str_hash_opt_to_type(struct bch_fs *c, enum bch_str_hash_opts opt) case BCH_STR_HASH_OPT_CRC64: return BCH_STR_HASH_CRC64; case BCH_STR_HASH_OPT_SIPHASH: - return c->sb.features & (1ULL << BCH_FEATURE_NEW_SIPHASH) + return c->sb.features & (1ULL << BCH_FEATURE_new_siphash) ? BCH_STR_HASH_SIPHASH : BCH_STR_HASH_SIPHASH_OLD; default: diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c index 767fd7bed2d0..d3713db317ce 100644 --- a/fs/bcachefs/sysfs.c +++ b/fs/bcachefs/sysfs.c @@ -276,7 +276,7 @@ static ssize_t bch2_compression_stats(struct bch_fs *c, char *buf) struct extent_ptr_decoded p; extent_for_each_ptr_decode(e, p, entry) { - if (p.crc.compression_type == BCH_COMPRESSION_NONE) { + if (p.crc.compression_type == BCH_COMPRESSION_TYPE_none) { nr_uncompressed_extents++; uncompressed_sectors += e.k->size; } else {