Skip to content

Commit f4301b6

Browse files
author
Kent Overstreet
committed
bcachefs: kill bch2_dev_bkey_exists() in discard_one_bucket_fast()
Signed-off-by: Kent Overstreet <[email protected]>
1 parent bc3204c commit f4301b6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fs/bcachefs/alloc_background.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,9 +1903,12 @@ static void bch2_do_discards_fast_work(struct work_struct *work)
19031903

19041904
static void bch2_discard_one_bucket_fast(struct bch_fs *c, struct bpos bucket)
19051905
{
1906-
struct bch_dev *ca = bch2_dev_bkey_exists(c, bucket.inode);
1906+
rcu_read_lock();
1907+
struct bch_dev *ca = bch2_dev_rcu(c, bucket.inode);
1908+
bool dead = !ca || percpu_ref_is_dying(&ca->io_ref);
1909+
rcu_read_unlock();
19071910

1908-
if (!percpu_ref_is_dying(&ca->io_ref) &&
1911+
if (!dead &&
19091912
!discard_in_flight_add(c, bucket) &&
19101913
bch2_write_ref_tryget(c, BCH_WRITE_REF_discard_fast) &&
19111914
!queue_work(c->write_ref_wq, &c->discard_fast_work))

0 commit comments

Comments
 (0)