diff options
-rw-r--r-- | fs/bcachefs/bcachefs.h | 3 | ||||
-rw-r--r-- | fs/bcachefs/bkey_methods.c | 6 | ||||
-rw-r--r-- | fs/bcachefs/bset.c | 4 | ||||
-rw-r--r-- | fs/bcachefs/bset.h | 5 | ||||
-rw-r--r-- | fs/bcachefs/btree_cache.c | 26 | ||||
-rw-r--r-- | fs/bcachefs/btree_cache.h | 2 | ||||
-rw-r--r-- | fs/bcachefs/btree_write_buffer.c | 11 | ||||
-rw-r--r-- | fs/bcachefs/buckets.c | 8 | ||||
-rw-r--r-- | fs/bcachefs/fs.c | 3 | ||||
-rw-r--r-- | fs/bcachefs/journal.h | 17 | ||||
-rw-r--r-- | include/linux/sched.h | 2 |
11 files changed, 50 insertions, 37 deletions
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h index 3364d671826a..19b7e018d283 100644 --- a/fs/bcachefs/bcachefs.h +++ b/fs/bcachefs/bcachefs.h @@ -640,7 +640,8 @@ struct bch_dev { x(error) \ x(topology_error) \ x(errors_fixed) \ - x(errors_not_fixed) + x(errors_not_fixed) \ + x(no_invalid_checks) enum bch_fs_flags { #define x(n) BCH_FS_##n, diff --git a/fs/bcachefs/bkey_methods.c b/fs/bcachefs/bkey_methods.c index 845e385ee4ce..b64a9974e001 100644 --- a/fs/bcachefs/bkey_methods.c +++ b/fs/bcachefs/bkey_methods.c @@ -127,6 +127,9 @@ int bch2_bkey_val_invalid(struct bch_fs *c, struct bkey_s_c k, enum bch_validate_flags flags, struct printbuf *err) { + if (test_bit(BCH_FS_no_invalid_checks, &c->flags)) + return 0; + const struct bkey_ops *ops = bch2_bkey_type_ops(k.k->type); int ret = 0; @@ -163,6 +166,9 @@ int __bch2_bkey_invalid(struct bch_fs *c, struct bkey_s_c k, enum bch_validate_flags flags, struct printbuf *err) { + if (test_bit(BCH_FS_no_invalid_checks, &c->flags)) + return 0; + int ret = 0; bkey_fsck_err_on(k.k->u64s < BKEY_U64s, c, err, diff --git a/fs/bcachefs/bset.c b/fs/bcachefs/bset.c index 8ef224282512..575e1d0b6eeb 100644 --- a/fs/bcachefs/bset.c +++ b/fs/bcachefs/bset.c @@ -1541,9 +1541,9 @@ struct bkey_s_c bch2_btree_node_iter_peek_unpack(struct btree_node_iter *iter, /* Mergesort */ -void bch2_btree_keys_stats(struct btree *b, struct bset_stats *stats) +void bch2_btree_keys_stats(const struct btree *b, struct bset_stats *stats) { - for_each_bset(b, t) { + for_each_bset_c(b, t) { enum bset_aux_tree_type type = bset_aux_tree_type(t); size_t j; diff --git a/fs/bcachefs/bset.h b/fs/bcachefs/bset.h index 8e8ae92bf771..03a262787894 100644 --- a/fs/bcachefs/bset.h +++ b/fs/bcachefs/bset.h @@ -209,6 +209,9 @@ static inline size_t btree_aux_data_u64s(const struct btree *b) #define for_each_bset(_b, _t) \ for (struct bset_tree *_t = (_b)->set; _t < (_b)->set + (_b)->nsets; _t++) +#define for_each_bset_c(_b, _t) \ + for (const struct bset_tree *_t = (_b)->set; _t < (_b)->set + (_b)->nsets; _t++) + #define bset_tree_for_each_key(_b, _t, _k) \ for (_k = btree_bkey_first(_b, _t); \ _k != btree_bkey_last(_b, _t); \ @@ -510,7 +513,7 @@ struct bset_stats { size_t failed; }; -void bch2_btree_keys_stats(struct btree *, struct bset_stats *); +void bch2_btree_keys_stats(const struct btree *, struct bset_stats *); void bch2_bfloat_to_text(struct printbuf *, struct btree *, struct bkey_packed *); diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c index ce233f800541..2063eaf5ced2 100644 --- a/fs/bcachefs/btree_cache.c +++ b/fs/bcachefs/btree_cache.c @@ -1279,7 +1279,7 @@ void bch2_btree_pos_to_text(struct printbuf *out, struct bch_fs *c, const struct bch2_bkey_val_to_text(out, c, bkey_i_to_s_c(&b->key)); } -void bch2_btree_node_to_text(struct printbuf *out, struct bch_fs *c, struct btree *b) +void bch2_btree_node_to_text(struct printbuf *out, struct bch_fs *c, const struct btree *b) { struct bset_stats stats; @@ -1334,7 +1334,7 @@ void bch2_btree_cache_to_text(struct printbuf *out, const struct btree_cache *bc struct bch_fs *c = container_of(bc, struct bch_fs, btree_cache); if (!out->nr_tabstops) - printbuf_tabstop_push(out, 24); + printbuf_tabstop_push(out, 32); prt_btree_cache_line(out, c, "total:", bc->used); prt_btree_cache_line(out, c, "nr dirty:", atomic_read(&bc->dirty)); @@ -1344,14 +1344,16 @@ void bch2_btree_cache_to_text(struct printbuf *out, const struct btree_cache *bc for (unsigned i = 0; i < ARRAY_SIZE(bc->used_by_btree); i++) prt_btree_cache_line(out, c, bch2_btree_id_str(i), bc->used_by_btree[i]); - prt_printf(out, "freed:\t\t\t\t%u\n", bc->freed); - prt_printf(out, "not freed, dirty:\t\t%u\n", bc->not_freed_dirty); - prt_printf(out, "not freed, write in flight:\t%u\n", bc->not_freed_write_in_flight); - prt_printf(out, "not freed, read in flight:\t%u\n", bc->not_freed_read_in_flight); - prt_printf(out, "not freed, lock intent failed:\t%u\n", bc->not_freed_lock_intent); - prt_printf(out, "not freed, lock write failed:\t%u\n", bc->not_freed_lock_write); - prt_printf(out, "not freed, access bit:\t\t%u\n", bc->not_freed_access_bit); - prt_printf(out, "not freed, no evict failed:\t%u\n", bc->not_freed_noevict); - prt_printf(out, "not freed, write blocked:\t%u\n", bc->not_freed_write_blocked); - prt_printf(out, "not freed, will make reachable:\t%u\n", bc->not_freed_will_make_reachable); + prt_newline(out); + prt_printf(out, "freed:\t%u\n", bc->freed); + prt_printf(out, "not freed:\n"); + prt_printf(out, " dirty\t%u\n", bc->not_freed_dirty); + prt_printf(out, " write in flight\t%u\n", bc->not_freed_write_in_flight); + prt_printf(out, " read in flight\t%u\n", bc->not_freed_read_in_flight); + prt_printf(out, " lock intent failed\t%u\n", bc->not_freed_lock_intent); + prt_printf(out, " lock write failed\t%u\n", bc->not_freed_lock_write); + prt_printf(out, " access bit\t%u\n", bc->not_freed_access_bit); + prt_printf(out, " no evict failed\t%u\n", bc->not_freed_noevict); + prt_printf(out, " write blocked\t%u\n", bc->not_freed_write_blocked); + prt_printf(out, " will make reachable\t%u\n", bc->not_freed_will_make_reachable); } diff --git a/fs/bcachefs/btree_cache.h b/fs/bcachefs/btree_cache.h index 2b0e0861cb49..fed35de3e4de 100644 --- a/fs/bcachefs/btree_cache.h +++ b/fs/bcachefs/btree_cache.h @@ -133,7 +133,7 @@ static inline struct btree *btree_node_root(struct bch_fs *c, struct btree *b) const char *bch2_btree_id_str(enum btree_id); void bch2_btree_pos_to_text(struct printbuf *, struct bch_fs *, const struct btree *); -void bch2_btree_node_to_text(struct printbuf *, struct bch_fs *, struct btree *); +void bch2_btree_node_to_text(struct printbuf *, struct bch_fs *, const struct btree *); void bch2_btree_cache_to_text(struct printbuf *, const struct btree_cache *); #endif /* _BCACHEFS_BTREE_CACHE_H */ diff --git a/fs/bcachefs/btree_write_buffer.c b/fs/bcachefs/btree_write_buffer.c index 5b7088e8a11b..23a3a2e49595 100644 --- a/fs/bcachefs/btree_write_buffer.c +++ b/fs/bcachefs/btree_write_buffer.c @@ -303,17 +303,6 @@ static int bch2_btree_write_buffer_flush_locked(struct btree_trans *trans) wb_key_eq(i, i + 1)) { struct btree_write_buffered_key *n = &wb->flushing.keys.data[i[1].idx]; - if (k->k.k.type == KEY_TYPE_accounting && - n->k.k.type == KEY_TYPE_accounting) { - struct bch_accounting *k_a = &bkey_i_to_accounting(&k->k)->v; - struct bch_accounting *n_a = &bkey_i_to_accounting(&n->k)->v; - - BUG_ON(k->k.k.u64s != n->k.k.u64s); - - for (unsigned j = 0; j < bkey_val_u64s(&k->k.k); j++) - le64_add_cpu(&n_a->d[j], le64_to_cpu(k_a->d[j])); - } - skipped++; n->journal_seq = min_t(u64, n->journal_seq, k->journal_seq); k->journal_seq = 0; diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index e1924e8e7808..15d5f1cf2797 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -479,9 +479,8 @@ int bch2_check_fix_ptrs(struct btree_trans *trans, percpu_down_read(&c->mark_lock); - rcu_read_lock(); bkey_for_each_ptr_decode(k.k, ptrs_c, p, entry_c) { - struct bch_dev *ca = bch2_dev_rcu(c, p.ptr.dev); + struct bch_dev *ca = bch2_dev_tryget(c, p.ptr.dev); if (!ca) { if (fsck_err(c, ptr_to_invalid_device, "pointer to missing device %u\n" @@ -558,7 +557,7 @@ int bch2_check_fix_ptrs(struct btree_trans *trans, do_update = true; if (data_type != BCH_DATA_btree && p.ptr.gen != g->gen) - continue; + goto next; if (fsck_err_on(bucket_data_type_mismatch(g->data_type, data_type), c, ptr_bucket_data_type_mismatch, @@ -601,8 +600,9 @@ int bch2_check_fix_ptrs(struct btree_trans *trans, bch2_bkey_val_to_text(&buf, c, k), buf.buf))) do_update = true; } +next: + bch2_dev_put(ca); } - rcu_read_unlock(); if (do_update) { if (flags & BTREE_TRIGGER_is_root) { diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c index 72b545ee9dff..bb723b40fe70 100644 --- a/fs/bcachefs/fs.c +++ b/fs/bcachefs/fs.c @@ -1141,6 +1141,8 @@ static int bch2_open(struct inode *vinode, struct file *file) return ret; } + file->f_mode |= FMODE_CAN_ODIRECT; + return generic_file_open(vinode, file); } @@ -1233,7 +1235,6 @@ static const struct address_space_operations bch_address_space_operations = { .write_end = bch2_write_end, .invalidate_folio = bch2_invalidate_folio, .release_folio = bch2_release_folio, - .direct_IO = noop_direct_IO, #ifdef CONFIG_MIGRATION .migrate_folio = filemap_migrate_folio, #endif diff --git a/fs/bcachefs/journal.h b/fs/bcachefs/journal.h index de5ede1fa311..4f819650136c 100644 --- a/fs/bcachefs/journal.h +++ b/fs/bcachefs/journal.h @@ -329,16 +329,26 @@ static inline int journal_res_get_fast(struct journal *j, { union journal_res_state old, new; u64 v = atomic64_read(&j->reservations.counter); - unsigned offset; + unsigned u64s, offset; do { old.v = new.v = v; /* + * Round up the end of the journal reservation to the next + * cacheline boundary: + */ + u64s = res->u64s; + offset = sizeof(struct jset) / sizeof(u64) + + new.cur_entry_offset + u64s; + u64s += ((offset - 1) & ((SMP_CACHE_BYTES / sizeof(u64)) - 1)) + 1; + + + /* * Check if there is still room in the current journal * entry: */ - if (new.cur_entry_offset + res->u64s > j->cur_entry_u64s) + if (new.cur_entry_offset + u64s > j->cur_entry_u64s) return 0; EBUG_ON(!journal_state_count(new, new.idx)); @@ -346,7 +356,7 @@ static inline int journal_res_get_fast(struct journal *j, if ((flags & BCH_WATERMARK_MASK) < j->watermark) return 0; - new.cur_entry_offset += res->u64s; + new.cur_entry_offset += u64s; journal_state_inc(&new); /* @@ -363,6 +373,7 @@ static inline int journal_res_get_fast(struct journal *j, res->ref = true; res->idx = old.idx; + res->u64s = u64s; res->offset = old.cur_entry_offset; res->seq = le64_to_cpu(j->buf[old.idx].data->seq); diff --git a/include/linux/sched.h b/include/linux/sched.h index bd843265fb98..984afc28712c 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1191,7 +1191,7 @@ struct task_struct { #endif #ifdef CONFIG_LOCKDEP -# define MAX_LOCK_DEPTH 63UL +# define MAX_LOCK_DEPTH 48UL u64 curr_chain_key; int lockdep_depth; unsigned int lockdep_recursion; |