Skip to content

Commit d3d16f3

Browse files
committed
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()
2 parents 6832a93 + 89edfcf commit d3d16f3

File tree

7 files changed

+24
-5
lines changed

7 files changed

+24
-5
lines changed

fs/bcachefs/alloc_foreground.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,8 @@ static struct open_bucket *bch2_bucket_alloc_trans(struct btree_trans *trans,
511511
bch2_dev_usage_read_fast(ca, &req->usage);
512512
avail = dev_buckets_free(ca, req->usage, req->watermark);
513513

514-
if (req->usage.buckets[BCH_DATA_need_discard] > avail)
514+
if (req->usage.buckets[BCH_DATA_need_discard] >
515+
min(avail, ca->mi.nbuckets >> 7))
515516
bch2_dev_do_discards(ca);
516517

517518
if (req->usage.buckets[BCH_DATA_need_gc_gens] > avail)

fs/bcachefs/btree_io.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,9 +1295,6 @@ int bch2_btree_node_read_done(struct bch_fs *c, struct bch_dev *ca,
12951295

12961296
btree_bounce_free(c, btree_buf_bytes(b), used_mempool, sorted);
12971297

1298-
if (updated_range)
1299-
bch2_btree_node_drop_keys_outside_node(b);
1300-
13011298
i = &b->data->keys;
13021299
for (k = i->start; k != vstruct_last(i);) {
13031300
struct bkey tmp;
@@ -1335,6 +1332,9 @@ int bch2_btree_node_read_done(struct bch_fs *c, struct bch_dev *ca,
13351332

13361333
btree_node_reset_sib_u64s(b);
13371334

1335+
if (updated_range)
1336+
bch2_btree_node_drop_keys_outside_node(b);
1337+
13381338
/*
13391339
* XXX:
13401340
*

fs/bcachefs/dirent.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include <linux/dcache.h>
1515

16+
#ifdef CONFIG_UNICODE
1617
int bch2_casefold(struct btree_trans *trans, const struct bch_hash_info *info,
1718
const struct qstr *str, struct qstr *out_cf)
1819
{
@@ -33,6 +34,7 @@ int bch2_casefold(struct btree_trans *trans, const struct bch_hash_info *info,
3334
*out_cf = (struct qstr) QSTR_INIT(buf, ret);
3435
return 0;
3536
}
37+
#endif
3638

3739
static unsigned bch2_dirent_name_bytes(struct bkey_s_c_dirent d)
3840
{
@@ -254,6 +256,7 @@ int bch2_dirent_init_name(struct bch_fs *c,
254256
if (!bch2_fs_casefold_enabled(c))
255257
return -EOPNOTSUPP;
256258

259+
#ifdef CONFIG_UNICODE
257260
memcpy(&dirent->v.d_cf_name_block.d_names[0], name->name, name->len);
258261

259262
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,
279282
dirent->v.d_cf_name_block.d_cf_name_len = cpu_to_le16(cf_len);
280283

281284
EBUG_ON(bch2_dirent_get_casefold_name(dirent_i_to_s_c(dirent)).len != cf_len);
285+
#endif
282286
}
283287

284288
unsigned u64s = dirent_val_u64s(name->len, cf_len);

fs/bcachefs/dirent.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,16 @@ struct bch_fs;
2323
struct bch_hash_info;
2424
struct bch_inode_info;
2525

26+
#ifdef CONFIG_UNICODE
2627
int bch2_casefold(struct btree_trans *, const struct bch_hash_info *,
2728
const struct qstr *, struct qstr *);
29+
#else
30+
static inline int bch2_casefold(struct btree_trans *trans, const struct bch_hash_info *info,
31+
const struct qstr *str, struct qstr *out_cf)
32+
{
33+
return -EOPNOTSUPP;
34+
}
35+
#endif
2836

2937
static inline int bch2_maybe_casefold(struct btree_trans *trans,
3038
const struct bch_hash_info *info,

fs/bcachefs/io_read.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ static noinline void promote_free(struct bch_read_bio *rbio)
166166
BUG_ON(ret);
167167

168168
async_object_list_del(c, promote, op->list_idx);
169+
async_object_list_del(c, rbio, rbio->list_idx);
169170

170171
bch2_data_update_exit(&op->write);
171172

@@ -456,6 +457,10 @@ static void bch2_rbio_done(struct bch_read_bio *rbio)
456457
if (rbio->start_time)
457458
bch2_time_stats_update(&rbio->c->times[BCH_TIME_data_read],
458459
rbio->start_time);
460+
#ifdef CONFIG_BCACHEFS_ASYNC_OBJECT_LISTS
461+
if (rbio->list_idx)
462+
async_object_list_del(rbio->c, rbio, rbio->list_idx);
463+
#endif
459464
bio_endio(&rbio->bio);
460465
}
461466

fs/bcachefs/journal_io.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,6 +1767,7 @@ static CLOSURE_CALLBACK(journal_write_done)
17671767

17681768
closure_wake_up(&c->freelist_wait);
17691769
bch2_reset_alloc_cursors(c);
1770+
do_discards = true;
17701771
}
17711772

17721773
j->seq_ondisk = seq;

fs/bcachefs/movinggc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static int bch2_bucket_is_movable(struct btree_trans *trans,
7171
if (ret)
7272
return ret;
7373

74-
struct bch_dev *ca = bch2_dev_tryget(c, k.k->p.inode);
74+
struct bch_dev *ca = bch2_dev_bucket_tryget(c, k.k->p);
7575
if (!ca)
7676
goto out;
7777

0 commit comments

Comments
 (0)