mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-12-07 00:00:12 +03:00
Update bcachefs sources to a8d89eb264e0 bcachefs: Allow CONFIG_UNICODE=m
Some checks failed
build / bcachefs-tools-deb (ubuntu-22.04) (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
Nix Flake actions / nix-matrix (push) Has been cancelled
Nix Flake actions / ${{ matrix.name }} (${{ matrix.system }}) (push) Has been cancelled
Some checks failed
build / bcachefs-tools-deb (ubuntu-22.04) (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
Nix Flake actions / nix-matrix (push) Has been cancelled
Nix Flake actions / ${{ matrix.name }} (${{ matrix.system }}) (push) Has been cancelled
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
7e570195d4
commit
802903c8cf
@ -1 +1 @@
|
||||
b0a446bcc860810cb8b52e9d69a8b9bbd054ff79
|
||||
a8d89eb264e00f606f7490b8024016708cefdf0d
|
||||
|
||||
@ -43,7 +43,7 @@ as-instr = $(call try-run,\
|
||||
# __cc-option
|
||||
# Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586)
|
||||
__cc-option = $(call try-run,\
|
||||
$(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4))
|
||||
$(1) -Werror $(2) $(3:-Wno-%=-W%) -c -x c /dev/null -o "$$TMP",$(3),$(4))
|
||||
|
||||
# cc-option
|
||||
# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
|
||||
@ -57,10 +57,10 @@ cc-option-yn = $(if $(call cc-option,$1),y,n)
|
||||
|
||||
# cc-disable-warning
|
||||
# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
|
||||
cc-disable-warning = $(if $(call cc-option,-W$(strip $1)),-Wno-$(strip $1))
|
||||
cc-disable-warning = $(call cc-option,-Wno-$(strip $1))
|
||||
|
||||
# gcc-min-version
|
||||
# Usage: cflags-$(call gcc-min-version, 70100) += -foo
|
||||
# Usage: cflags-$(call gcc-min-version, 110100) += -foo
|
||||
gcc-min-version = $(call test-ge, $(CONFIG_GCC_VERSION), $1)
|
||||
|
||||
# clang-min-version
|
||||
|
||||
@ -12,7 +12,13 @@
|
||||
#define CHACHA_IV_SIZE 16
|
||||
#define CHACHA_KEY_SIZE 32
|
||||
#define CHACHA_BLOCK_SIZE 64
|
||||
#define CHACHA_STATE_WORDS (CHACHA_BLOCK_SIZE / sizeof(u32))
|
||||
|
||||
#define CHACHA_KEY_WORDS 8
|
||||
#define CHACHA_STATE_WORDS 16
|
||||
|
||||
struct chacha_state {
|
||||
u32 x[CHACHA_STATE_WORDS];
|
||||
};
|
||||
|
||||
enum chacha_constants { /* expand 32-byte k */
|
||||
CHACHA_CONSTANT_EXPA = 0x61707865U,
|
||||
@ -21,38 +27,40 @@ enum chacha_constants { /* expand 32-byte k */
|
||||
CHACHA_CONSTANT_TE_K = 0x6b206574U
|
||||
};
|
||||
|
||||
static inline void chacha_init_consts(u32 *state)
|
||||
static inline void chacha_init_consts(struct chacha_state *state)
|
||||
{
|
||||
state[0] = CHACHA_CONSTANT_EXPA;
|
||||
state[1] = CHACHA_CONSTANT_ND_3;
|
||||
state[2] = CHACHA_CONSTANT_2_BY;
|
||||
state[3] = CHACHA_CONSTANT_TE_K;
|
||||
state->x[0] = CHACHA_CONSTANT_EXPA;
|
||||
state->x[1] = CHACHA_CONSTANT_ND_3;
|
||||
state->x[2] = CHACHA_CONSTANT_2_BY;
|
||||
state->x[3] = CHACHA_CONSTANT_TE_K;
|
||||
}
|
||||
|
||||
static inline void chacha_init(u32 *state, const u32 *key, const u8 *iv)
|
||||
static inline void chacha_init(struct chacha_state *state,
|
||||
const u32 key[CHACHA_KEY_WORDS],
|
||||
const u8 iv[CHACHA_IV_SIZE])
|
||||
{
|
||||
chacha_init_consts(state);
|
||||
state[4] = key[0];
|
||||
state[5] = key[1];
|
||||
state[6] = key[2];
|
||||
state[7] = key[3];
|
||||
state[8] = key[4];
|
||||
state[9] = key[5];
|
||||
state[10] = key[6];
|
||||
state[11] = key[7];
|
||||
state[12] = get_unaligned_le32(iv + 0);
|
||||
state[13] = get_unaligned_le32(iv + 4);
|
||||
state[14] = get_unaligned_le32(iv + 8);
|
||||
state[15] = get_unaligned_le32(iv + 12);
|
||||
state->x[4] = key[0];
|
||||
state->x[5] = key[1];
|
||||
state->x[6] = key[2];
|
||||
state->x[7] = key[3];
|
||||
state->x[8] = key[4];
|
||||
state->x[9] = key[5];
|
||||
state->x[10] = key[6];
|
||||
state->x[11] = key[7];
|
||||
state->x[12] = get_unaligned_le32(iv + 0);
|
||||
state->x[13] = get_unaligned_le32(iv + 4);
|
||||
state->x[14] = get_unaligned_le32(iv + 8);
|
||||
state->x[15] = get_unaligned_le32(iv + 12);
|
||||
}
|
||||
|
||||
#include <sodium/crypto_stream_chacha20.h>
|
||||
|
||||
static inline void chacha20_crypt(u32 *state, u8 *dst, const u8 *src,
|
||||
static inline void chacha20_crypt(struct chacha_state *state, u8 *dst, const u8 *src,
|
||||
unsigned int bytes)
|
||||
{
|
||||
u32 *key = state + 4;
|
||||
u32 *iv = state + 12;
|
||||
u32 *key = state->x + 4;
|
||||
u32 *iv = state->x + 12;
|
||||
int ret = crypto_stream_chacha20_xor_ic(dst, src, bytes,
|
||||
(void *) &iv[2],
|
||||
iv[0] | ((u64) iv[1] << 32),
|
||||
@ -60,4 +68,9 @@ static inline void chacha20_crypt(u32 *state, u8 *dst, const u8 *src,
|
||||
BUG_ON(ret);
|
||||
}
|
||||
|
||||
static inline void chacha_zeroize_state(struct chacha_state *state)
|
||||
{
|
||||
memzero_explicit(state, sizeof(*state));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -70,6 +70,10 @@
|
||||
#define KEY_DESTROY 0xbd
|
||||
|
||||
/********** net/core/page_pool.c **********/
|
||||
/*
|
||||
* page_pool uses additional free bits within this value to store data, see the
|
||||
* definition of PP_DMA_INDEX_MASK in mm.h
|
||||
*/
|
||||
#define PP_SIGNATURE (0x40 + POISON_POINTER_DELTA)
|
||||
|
||||
/********** net/core/skbuff.c **********/
|
||||
|
||||
@ -4,6 +4,16 @@
|
||||
#include <stdlib.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
/**
|
||||
* cmp_int - perform a three-way comparison of the arguments
|
||||
* @l: the left argument
|
||||
* @r: the right argument
|
||||
*
|
||||
* Return: 1 if the left argument is greater than the right one; 0 if the
|
||||
* arguments are equal; -1 if the left argument is less than the right one.
|
||||
*/
|
||||
#define cmp_int(l, r) (((l) > (r)) - ((l) < (r)))
|
||||
|
||||
void sort_r(void *base, size_t num, size_t size,
|
||||
cmp_r_func_t cmp_func,
|
||||
swap_r_func_t swap_func,
|
||||
|
||||
@ -862,7 +862,7 @@ struct bch_fs {
|
||||
DARRAY(enum bcachefs_metadata_version)
|
||||
incompat_versions_requested;
|
||||
|
||||
#ifdef CONFIG_UNICODE
|
||||
#if IS_ENABLED(CONFIG_UNICODE)
|
||||
struct unicode_map *cf_encoding;
|
||||
#endif
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ static void bch2_checksum_update(struct bch2_checksum_state *state, const void *
|
||||
}
|
||||
}
|
||||
|
||||
static void bch2_chacha20_init(u32 state[CHACHA_STATE_WORDS],
|
||||
static void bch2_chacha20_init(struct chacha_state *state,
|
||||
const struct bch_key *key, struct nonce nonce)
|
||||
{
|
||||
u32 key_words[CHACHA_KEY_SIZE / sizeof(u32)];
|
||||
@ -109,11 +109,11 @@ static void bch2_chacha20_init(u32 state[CHACHA_STATE_WORDS],
|
||||
void bch2_chacha20(const struct bch_key *key, struct nonce nonce,
|
||||
void *data, size_t len)
|
||||
{
|
||||
u32 state[CHACHA_STATE_WORDS];
|
||||
struct chacha_state state;
|
||||
|
||||
bch2_chacha20_init(state, key, nonce);
|
||||
chacha20_crypt(state, data, data, len);
|
||||
memzero_explicit(state, sizeof(state));
|
||||
bch2_chacha20_init(&state, key, nonce);
|
||||
chacha20_crypt(&state, data, data, len);
|
||||
chacha_zeroize_state(&state);
|
||||
}
|
||||
|
||||
static void bch2_poly1305_init(struct poly1305_desc_ctx *desc,
|
||||
@ -257,14 +257,14 @@ int __bch2_encrypt_bio(struct bch_fs *c, unsigned type,
|
||||
{
|
||||
struct bio_vec bv;
|
||||
struct bvec_iter iter;
|
||||
u32 chacha_state[CHACHA_STATE_WORDS];
|
||||
struct chacha_state chacha_state;
|
||||
int ret = 0;
|
||||
|
||||
if (bch2_fs_inconsistent_on(!c->chacha20_key_set,
|
||||
c, "attempting to encrypt without encryption key"))
|
||||
return bch_err_throw(c, no_encryption_key);
|
||||
|
||||
bch2_chacha20_init(chacha_state, &c->chacha20_key, nonce);
|
||||
bch2_chacha20_init(&chacha_state, &c->chacha20_key, nonce);
|
||||
|
||||
bio_for_each_segment(bv, bio, iter) {
|
||||
void *p;
|
||||
@ -280,10 +280,10 @@ int __bch2_encrypt_bio(struct bch_fs *c, unsigned type,
|
||||
}
|
||||
|
||||
p = bvec_kmap_local(&bv);
|
||||
chacha20_crypt(chacha_state, p, p, bv.bv_len);
|
||||
chacha20_crypt(&chacha_state, p, p, bv.bv_len);
|
||||
kunmap_local(p);
|
||||
}
|
||||
memzero_explicit(chacha_state, sizeof(chacha_state));
|
||||
chacha_zeroize_state(&chacha_state);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ int bch2_casefold(struct btree_trans *trans, const struct bch_hash_info *info,
|
||||
{
|
||||
*out_cf = (struct qstr) QSTR_INIT(NULL, 0);
|
||||
|
||||
#ifdef CONFIG_UNICODE
|
||||
#if IS_ENABLED(CONFIG_UNICODE)
|
||||
unsigned char *buf = bch2_trans_kmalloc(trans, BCH_NAME_MAX + 1);
|
||||
int ret = PTR_ERR_OR_ZERO(buf);
|
||||
if (ret)
|
||||
|
||||
@ -618,7 +618,9 @@ int bch2_gc_accounting_done(struct bch_fs *c)
|
||||
for (unsigned j = 0; j < nr; j++)
|
||||
src_v[j] -= dst_v[j];
|
||||
|
||||
if (fsck_err(trans, accounting_mismatch, "%s", buf.buf)) {
|
||||
bch2_trans_unlock_long(trans);
|
||||
|
||||
if (fsck_err(c, accounting_mismatch, "%s", buf.buf)) {
|
||||
percpu_up_write(&c->mark_lock);
|
||||
ret = commit_do(trans, NULL, NULL, 0,
|
||||
bch2_disk_accounting_mod(trans, &acc_k, src_v, nr, false));
|
||||
|
||||
@ -722,7 +722,7 @@ static struct dentry *bch2_lookup(struct inode *vdir, struct dentry *dentry,
|
||||
if (IS_ERR(inode))
|
||||
inode = NULL;
|
||||
|
||||
#ifdef CONFIG_UNICODE
|
||||
#if IS_ENABLED(CONFIG_UNICODE)
|
||||
if (!inode && IS_CASEFOLDED(vdir)) {
|
||||
/*
|
||||
* Do not cache a negative dentry in casefolded directories
|
||||
@ -2564,7 +2564,7 @@ got_sb:
|
||||
|
||||
sb->s_shrink->seeks = 0;
|
||||
|
||||
#ifdef CONFIG_UNICODE
|
||||
#if IS_ENABLED(CONFIG_UNICODE)
|
||||
sb->s_encoding = c->cf_encoding;
|
||||
#endif
|
||||
generic_set_sb_d_ops(sb);
|
||||
|
||||
@ -2184,7 +2184,7 @@ static int check_dirent(struct btree_trans *trans, struct btree_iter *iter,
|
||||
*hash_info = bch2_hash_info_init(c, &i->inode);
|
||||
dir->first_this_inode = false;
|
||||
|
||||
#ifdef CONFIG_UNICODE
|
||||
#if IS_ENABLED(CONFIG_UNICODE)
|
||||
hash_info->cf_encoding = bch2_inode_casefold(c, &i->inode) ? c->cf_encoding : NULL;
|
||||
#endif
|
||||
|
||||
|
||||
@ -1265,7 +1265,7 @@ int bch2_inode_set_casefold(struct btree_trans *trans, subvol_inum inum,
|
||||
{
|
||||
struct bch_fs *c = trans->c;
|
||||
|
||||
#ifdef CONFIG_UNICODE
|
||||
#if IS_ENABLED(CONFIG_UNICODE)
|
||||
int ret = 0;
|
||||
/* Not supported on individual files. */
|
||||
if (!S_ISDIR(bi->bi_mode))
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
#include <linux/wait.h>
|
||||
|
||||
struct buckets_in_flight {
|
||||
struct rhashtable table;
|
||||
struct rhashtable *table;
|
||||
struct move_bucket *first;
|
||||
struct move_bucket *last;
|
||||
size_t nr;
|
||||
@ -98,7 +98,7 @@ out:
|
||||
static void move_bucket_free(struct buckets_in_flight *list,
|
||||
struct move_bucket *b)
|
||||
{
|
||||
int ret = rhashtable_remove_fast(&list->table, &b->hash,
|
||||
int ret = rhashtable_remove_fast(list->table, &b->hash,
|
||||
bch_move_bucket_params);
|
||||
BUG_ON(ret);
|
||||
kfree(b);
|
||||
@ -133,7 +133,7 @@ static void move_buckets_wait(struct moving_context *ctxt,
|
||||
static bool bucket_in_flight(struct buckets_in_flight *list,
|
||||
struct move_bucket_key k)
|
||||
{
|
||||
return rhashtable_lookup_fast(&list->table, &k, bch_move_bucket_params);
|
||||
return rhashtable_lookup_fast(list->table, &k, bch_move_bucket_params);
|
||||
}
|
||||
|
||||
static int bch2_copygc_get_buckets(struct moving_context *ctxt,
|
||||
@ -154,12 +154,6 @@ static int bch2_copygc_get_buckets(struct moving_context *ctxt,
|
||||
if (bch2_fs_fatal_err_on(ret, c, "%s: from bch2_btree_write_buffer_tryflush()", bch2_err_str(ret)))
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* we might be in a transaction restart from write buffer flush, start a
|
||||
* new transaction before iter_init -> path_get
|
||||
*/
|
||||
bch2_trans_begin(trans);
|
||||
|
||||
ret = for_each_btree_key_max(trans, iter, BTREE_ID_lru,
|
||||
lru_pos(BCH_LRU_BUCKET_FRAGMENTATION, 0, 0),
|
||||
lru_pos(BCH_LRU_BUCKET_FRAGMENTATION, U64_MAX, LRU_TIME_MAX),
|
||||
@ -191,7 +185,7 @@ static int bch2_copygc_get_buckets(struct moving_context *ctxt,
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret2 = rhashtable_lookup_insert_fast(&buckets_in_flight->table, &b_i->hash,
|
||||
ret2 = rhashtable_lookup_insert_fast(buckets_in_flight->table, &b_i->hash,
|
||||
bch_move_bucket_params);
|
||||
BUG_ON(ret2);
|
||||
|
||||
@ -356,10 +350,13 @@ static int bch2_copygc_thread(void *arg)
|
||||
struct buckets_in_flight buckets = {};
|
||||
u64 last, wait;
|
||||
|
||||
int ret = rhashtable_init(&buckets.table, &bch_move_bucket_params);
|
||||
buckets.table = kzalloc(sizeof(*buckets.table), GFP_KERNEL);
|
||||
int ret = !buckets.table
|
||||
? -ENOMEM
|
||||
: rhashtable_init(buckets.table, &bch_move_bucket_params);
|
||||
bch_err_msg(c, ret, "allocating copygc buckets in flight");
|
||||
if (ret)
|
||||
return ret;
|
||||
goto err;
|
||||
|
||||
set_freezable();
|
||||
|
||||
@ -427,11 +424,12 @@ static int bch2_copygc_thread(void *arg)
|
||||
}
|
||||
|
||||
move_buckets_wait(&ctxt, &buckets, true);
|
||||
rhashtable_destroy(&buckets.table);
|
||||
rhashtable_destroy(buckets.table);
|
||||
bch2_moving_ctxt_exit(&ctxt);
|
||||
bch2_move_stats_exit(&move_stats, c);
|
||||
|
||||
return 0;
|
||||
err:
|
||||
kfree(buckets.table);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void bch2_copygc_stop(struct bch_fs *c)
|
||||
|
||||
@ -182,11 +182,6 @@ static inline void kfree_bulk(size_t nr, void ** p)
|
||||
while (nr--)
|
||||
kfree(*p);
|
||||
}
|
||||
|
||||
#define local_irq_save(flags) \
|
||||
do { \
|
||||
flags = 0; \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
static noinline void __process_finished_items(struct rcu_pending *pending,
|
||||
@ -429,9 +424,15 @@ __rcu_pending_enqueue(struct rcu_pending *pending, struct rcu_head *head,
|
||||
|
||||
BUG_ON((ptr != NULL) != (pending->process == RCU_PENDING_KVFREE_FN));
|
||||
|
||||
local_irq_save(flags);
|
||||
p = this_cpu_ptr(pending->p);
|
||||
spin_lock(&p->lock);
|
||||
/* We could technically be scheduled before taking the lock and end up
|
||||
* using a different cpu's rcu_pending_pcpu: that's ok, it needs a lock
|
||||
* anyways
|
||||
*
|
||||
* And we have to do it this way to avoid breaking PREEMPT_RT, which
|
||||
* redefines how spinlocks work:
|
||||
*/
|
||||
p = raw_cpu_ptr(pending->p);
|
||||
spin_lock_irqsave(&p->lock, flags);
|
||||
rcu_gp_poll_state_t seq = __get_state_synchronize_rcu(pending->srcu);
|
||||
restart:
|
||||
if (may_sleep &&
|
||||
@ -520,9 +521,8 @@ check_expired:
|
||||
goto free_node;
|
||||
}
|
||||
|
||||
local_irq_save(flags);
|
||||
p = this_cpu_ptr(pending->p);
|
||||
spin_lock(&p->lock);
|
||||
p = raw_cpu_ptr(pending->p);
|
||||
spin_lock_irqsave(&p->lock, flags);
|
||||
goto restart;
|
||||
}
|
||||
|
||||
|
||||
@ -1108,9 +1108,6 @@ use_clean:
|
||||
out:
|
||||
bch2_flush_fsck_errs(c);
|
||||
|
||||
if (!IS_ERR(clean))
|
||||
kfree(clean);
|
||||
|
||||
if (!ret &&
|
||||
test_bit(BCH_FS_need_delete_dead_snapshots, &c->flags) &&
|
||||
!c->opts.nochanges) {
|
||||
@ -1119,6 +1116,9 @@ out:
|
||||
}
|
||||
|
||||
bch_err_fn(c, ret);
|
||||
final_out:
|
||||
if (!IS_ERR(clean))
|
||||
kfree(clean);
|
||||
return ret;
|
||||
err:
|
||||
fsck_err:
|
||||
@ -1132,7 +1132,7 @@ fsck_err:
|
||||
bch2_print_str(c, KERN_ERR, buf.buf);
|
||||
printbuf_exit(&buf);
|
||||
}
|
||||
return ret;
|
||||
goto final_out;
|
||||
}
|
||||
|
||||
int bch2_fs_initialize(struct bch_fs *c)
|
||||
|
||||
@ -253,6 +253,7 @@ DOWNGRADE_TABLE()
|
||||
|
||||
static int downgrade_table_extra(struct bch_fs *c, darray_char *table)
|
||||
{
|
||||
unsigned dst_offset = table->nr;
|
||||
struct bch_sb_field_downgrade_entry *dst = (void *) &darray_top(*table);
|
||||
unsigned bytes = sizeof(*dst) + sizeof(dst->errors[0]) * le16_to_cpu(dst->nr_errors);
|
||||
int ret = 0;
|
||||
@ -268,6 +269,9 @@ static int downgrade_table_extra(struct bch_fs *c, darray_char *table)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
dst = (void *) &table->data[dst_offset];
|
||||
dst->nr_errors = cpu_to_le16(nr_errors + 1);
|
||||
|
||||
/* open coded __set_bit_le64, as dst is packed and
|
||||
* dst->recovery_passes is misaligned */
|
||||
unsigned b = BCH_RECOVERY_PASS_STABLE_check_allocations;
|
||||
@ -278,7 +282,6 @@ static int downgrade_table_extra(struct bch_fs *c, darray_char *table)
|
||||
break;
|
||||
}
|
||||
|
||||
dst->nr_errors = cpu_to_le16(nr_errors);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -165,7 +165,7 @@ enum bch_fsck_flags {
|
||||
x(ptr_to_missing_replicas_entry, 149, FSCK_AUTOFIX) \
|
||||
x(ptr_to_missing_stripe, 150, 0) \
|
||||
x(ptr_to_incorrect_stripe, 151, 0) \
|
||||
x(ptr_gen_newer_than_bucket_gen, 152, 0) \
|
||||
x(ptr_gen_newer_than_bucket_gen, 152, FSCK_AUTOFIX) \
|
||||
x(ptr_too_stale, 153, 0) \
|
||||
x(stale_dirty_ptr, 154, FSCK_AUTOFIX) \
|
||||
x(ptr_bucket_data_type_mismatch, 155, 0) \
|
||||
|
||||
@ -325,9 +325,12 @@ static void bch2_sb_members_v1_to_text(struct printbuf *out, struct bch_sb *sb,
|
||||
{
|
||||
struct bch_sb_field_members_v1 *mi = field_to_type(f, members_v1);
|
||||
struct bch_sb_field_disk_groups *gi = bch2_sb_field_get(sb, disk_groups);
|
||||
unsigned i;
|
||||
int nr = (vstruct_end(&mi->field) - (void *) &gi->entries[0]) / sizeof(gi->entries[0]);
|
||||
|
||||
for (i = 0; i < sb->nr_devices; i++)
|
||||
if (nr != sb->nr_devices)
|
||||
prt_printf(out, "nr_devices mismatch: have %i entries, should be %u", nr, sb->nr_devices);
|
||||
|
||||
for (int i = 0; i < nr; i++)
|
||||
member_to_text(out, members_v1_get(mi, i), gi, sb, i);
|
||||
}
|
||||
|
||||
@ -341,9 +344,17 @@ static void bch2_sb_members_v2_to_text(struct printbuf *out, struct bch_sb *sb,
|
||||
{
|
||||
struct bch_sb_field_members_v2 *mi = field_to_type(f, members_v2);
|
||||
struct bch_sb_field_disk_groups *gi = bch2_sb_field_get(sb, disk_groups);
|
||||
unsigned i;
|
||||
int nr = (vstruct_end(&mi->field) - (void *) &gi->entries[0]) / le16_to_cpu(mi->member_bytes);
|
||||
|
||||
for (i = 0; i < sb->nr_devices; i++)
|
||||
if (nr != sb->nr_devices)
|
||||
prt_printf(out, "nr_devices mismatch: have %i entries, should be %u", nr, sb->nr_devices);
|
||||
|
||||
/*
|
||||
* We call to_text() on superblock sections that haven't passed
|
||||
* validate, so we can't trust sb->nr_devices.
|
||||
*/
|
||||
|
||||
for (int i = 0; i < nr; i++)
|
||||
member_to_text(out, members_v2_get(mi, i), gi, sb, i);
|
||||
}
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ bch2_hash_info_init(struct bch_fs *c, const struct bch_inode_unpacked *bi)
|
||||
struct bch_hash_info info = {
|
||||
.inum_snapshot = bi->bi_snapshot,
|
||||
.type = INODE_STR_HASH(bi),
|
||||
#ifdef CONFIG_UNICODE
|
||||
#if IS_ENABLED(CONFIG_UNICODE)
|
||||
.cf_encoding = bch2_inode_casefold(c, bi) ? c->cf_encoding : NULL,
|
||||
#endif
|
||||
.siphash_key = { .k0 = bi->bi_hash_seed }
|
||||
|
||||
@ -586,7 +586,7 @@ static void __bch2_fs_free(struct bch_fs *c)
|
||||
for (unsigned i = 0; i < BCH_TIME_STAT_NR; i++)
|
||||
bch2_time_stats_exit(&c->times[i]);
|
||||
|
||||
#ifdef CONFIG_UNICODE
|
||||
#if IS_ENABLED(CONFIG_UNICODE)
|
||||
utf8_unload(c->cf_encoding);
|
||||
#endif
|
||||
|
||||
@ -1015,7 +1015,7 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts *opts,
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
#ifdef CONFIG_UNICODE
|
||||
#if IS_ENABLED(CONFIG_UNICODE)
|
||||
/* Default encoding until we can potentially have more as an option. */
|
||||
c->cf_encoding = utf8_load(BCH_FS_DEFAULT_UTF8_ENCODING);
|
||||
if (IS_ERR(c->cf_encoding)) {
|
||||
@ -1143,12 +1143,11 @@ int bch2_fs_start(struct bch_fs *c)
|
||||
|
||||
print_mount_opts(c);
|
||||
|
||||
#ifdef CONFIG_UNICODE
|
||||
bch_info(c, "Using encoding defined by superblock: utf8-%u.%u.%u",
|
||||
unicode_major(BCH_FS_DEFAULT_UTF8_ENCODING),
|
||||
unicode_minor(BCH_FS_DEFAULT_UTF8_ENCODING),
|
||||
unicode_rev(BCH_FS_DEFAULT_UTF8_ENCODING));
|
||||
#endif
|
||||
if (IS_ENABLED(CONFIG_UNICODE))
|
||||
bch_info(c, "Using encoding defined by superblock: utf8-%u.%u.%u",
|
||||
unicode_major(BCH_FS_DEFAULT_UTF8_ENCODING),
|
||||
unicode_minor(BCH_FS_DEFAULT_UTF8_ENCODING),
|
||||
unicode_rev(BCH_FS_DEFAULT_UTF8_ENCODING));
|
||||
|
||||
if (!bch2_fs_may_start(c))
|
||||
return bch_err_throw(c, insufficient_devices_to_start);
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include <linux/random.h>
|
||||
#include <linux/ratelimit.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/sort.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
@ -672,8 +673,6 @@ static inline void percpu_memset(void __percpu *p, int c, size_t bytes)
|
||||
|
||||
u64 *bch2_acc_percpu_u64s(u64 __percpu *, unsigned);
|
||||
|
||||
#define cmp_int(l, r) ((l > r) - (l < r))
|
||||
|
||||
static inline int u8_cmp(u8 l, u8 r)
|
||||
{
|
||||
return cmp_int(l, r);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user