bcachefs fixes for 6.16-rc7

- two small syzbot fixes
 - fix discard behaviour regression; we no longer wait until the number
   of buckets needing discard is greater than the number of buckets
   available before kicking off discards
 - fix a fast_list leak when async object debugging is enabled
 - fixes for casefolding when CONFIG_UTF8 != y
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEKnAFLkS8Qha+jvQrE6szbY3KbnYFAmh5jvMACgkQE6szbY3K
 bnbi/RAAqbZkvlh9LzzN+9Av2DdVGUc8mOMIJMyYj4RqZDXFTDXyICgAWpX6aq9D
 8aBZt/sMqbhF6NQ/zvSUaYpTVI+ko9lWdHVKphPhE6QwIiuwgGpwIvRQl/oiHMlz
 uFur/m32VgbBgPAe8NuFGzna42glUi2AuVdchV/IGRpYFfFHsyIwRLu3cjkhF52X
 hq+oXrf3/IVrruqBBxJNk48SVdSPmN7WZKbPEYzxoG1dOcMK7lByqQpe2ntPdKdr
 zy97HU0OnNDyAzmv1eG6s7A3GvLc244i7QQ6aPv+5FnfB1auqDB1hAHd1J1MAFPQ
 TFKaStdy9C7y2Nzoa8MJ6SevsQpsYEMAmo+cImm31cB2fYQC3R0OOAU4JBBnFq6s
 czRv3IGGy5JHRxzQ3mYAZEvJOPfO/SkEx8eWRlE2MVa3v6HciysdB8fTGyjujJme
 Cwb+rTwgf7xJ1PoeobnaOyduxk1X+LppfomvMou9OSG3ZpyFRCx5tOMRop1g8VN7
 n0E7lIat3VPEncQ2Fnxa1ybrUeXz7JoWNoZEBSPit/PtSJBNyBl9CwF1O2xw6+T/
 s/RSnunyo5t14QuBwRrR3lThZ9KOagn+9djRjykFetYUNUXiJ4vXJSz3NnsUb0JB
 r+pseHTkHAbYKLk3CVraAGIG49pcpZTMsIweqd1pR1Z0UsKmz10=
 =LGa2
 -----END PGP SIGNATURE-----

Merge tag 'bcachefs-2025-07-17' of git://evilpiepirate.org/bcachefs

Pull bcachefs fixes from Kent Overstreet:

 - two small syzbot fixes

 - fix discard behaviour regression; we no longer wait until the number
   of buckets needing discard is greater than the number of buckets
   available before kicking off discards

 - fix a fast_list leak when async object debugging is enabled

 - fixes for casefolding when CONFIG_UTF8 != y

* tag 'bcachefs-2025-07-17' of git://evilpiepirate.org/bcachefs:
  bcachefs: Fix bch2_maybe_casefold() when CONFIG_UTF8=n
  bcachefs: Fix build when CONFIG_UNICODE=n
  bcachefs: Fix reference to invalid bucket in copygc
  bcachefs: Don't build aux search tree when still repairing node
  bcachefs: Tweak threshold for allocator triggering discards
  bcachefs: Fix triggering of discard by the journal path
  bcachefs: io_read: remove from async obj list in rbio_done()
This commit is contained in:
Linus Torvalds 2025-07-18 09:19:57 -07:00
commit d3d16f31d7
7 changed files with 24 additions and 5 deletions

View File

@ -511,7 +511,8 @@ again:
bch2_dev_usage_read_fast(ca, &req->usage);
avail = dev_buckets_free(ca, req->usage, req->watermark);
if (req->usage.buckets[BCH_DATA_need_discard] > avail)
if (req->usage.buckets[BCH_DATA_need_discard] >
min(avail, ca->mi.nbuckets >> 7))
bch2_dev_do_discards(ca);
if (req->usage.buckets[BCH_DATA_need_gc_gens] > avail)

View File

@ -1295,9 +1295,6 @@ int bch2_btree_node_read_done(struct bch_fs *c, struct bch_dev *ca,
btree_bounce_free(c, btree_buf_bytes(b), used_mempool, sorted);
if (updated_range)
bch2_btree_node_drop_keys_outside_node(b);
i = &b->data->keys;
for (k = i->start; k != vstruct_last(i);) {
struct bkey tmp;
@ -1335,6 +1332,9 @@ int bch2_btree_node_read_done(struct bch_fs *c, struct bch_dev *ca,
btree_node_reset_sib_u64s(b);
if (updated_range)
bch2_btree_node_drop_keys_outside_node(b);
/*
* XXX:
*

View File

@ -13,6 +13,7 @@
#include <linux/dcache.h>
#ifdef CONFIG_UNICODE
int bch2_casefold(struct btree_trans *trans, const struct bch_hash_info *info,
const struct qstr *str, struct qstr *out_cf)
{
@ -33,6 +34,7 @@ int bch2_casefold(struct btree_trans *trans, const struct bch_hash_info *info,
*out_cf = (struct qstr) QSTR_INIT(buf, ret);
return 0;
}
#endif
static unsigned bch2_dirent_name_bytes(struct bkey_s_c_dirent d)
{
@ -254,6 +256,7 @@ int bch2_dirent_init_name(struct bch_fs *c,
if (!bch2_fs_casefold_enabled(c))
return -EOPNOTSUPP;
#ifdef CONFIG_UNICODE
memcpy(&dirent->v.d_cf_name_block.d_names[0], name->name, name->len);
char *cf_out = &dirent->v.d_cf_name_block.d_names[name->len];
@ -279,6 +282,7 @@ int bch2_dirent_init_name(struct bch_fs *c,
dirent->v.d_cf_name_block.d_cf_name_len = cpu_to_le16(cf_len);
EBUG_ON(bch2_dirent_get_casefold_name(dirent_i_to_s_c(dirent)).len != cf_len);
#endif
}
unsigned u64s = dirent_val_u64s(name->len, cf_len);

View File

@ -23,8 +23,16 @@ struct bch_fs;
struct bch_hash_info;
struct bch_inode_info;
#ifdef CONFIG_UNICODE
int bch2_casefold(struct btree_trans *, const struct bch_hash_info *,
const struct qstr *, struct qstr *);
#else
static inline int bch2_casefold(struct btree_trans *trans, const struct bch_hash_info *info,
const struct qstr *str, struct qstr *out_cf)
{
return -EOPNOTSUPP;
}
#endif
static inline int bch2_maybe_casefold(struct btree_trans *trans,
const struct bch_hash_info *info,

View File

@ -166,6 +166,7 @@ static noinline void promote_free(struct bch_read_bio *rbio)
BUG_ON(ret);
async_object_list_del(c, promote, op->list_idx);
async_object_list_del(c, rbio, rbio->list_idx);
bch2_data_update_exit(&op->write);
@ -456,6 +457,10 @@ static void bch2_rbio_done(struct bch_read_bio *rbio)
if (rbio->start_time)
bch2_time_stats_update(&rbio->c->times[BCH_TIME_data_read],
rbio->start_time);
#ifdef CONFIG_BCACHEFS_ASYNC_OBJECT_LISTS
if (rbio->list_idx)
async_object_list_del(rbio->c, rbio, rbio->list_idx);
#endif
bio_endio(&rbio->bio);
}

View File

@ -1767,6 +1767,7 @@ static CLOSURE_CALLBACK(journal_write_done)
closure_wake_up(&c->freelist_wait);
bch2_reset_alloc_cursors(c);
do_discards = true;
}
j->seq_ondisk = seq;

View File

@ -71,7 +71,7 @@ static int bch2_bucket_is_movable(struct btree_trans *trans,
if (ret)
return ret;
struct bch_dev *ca = bch2_dev_tryget(c, k.k->p.inode);
struct bch_dev *ca = bch2_dev_bucket_tryget(c, k.k->p);
if (!ca)
goto out;