Commit cb4d340a authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: bch2_evacuate_bucket() -> bch2_dev_tryget()

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 07d7c4da
......@@ -690,6 +690,10 @@ int bch2_evacuate_bucket(struct moving_context *ctxt,
struct bpos bp_pos = POS_MIN;
int ret = 0;
struct bch_dev *ca = bch2_dev_tryget(c, bucket.inode);
if (!ca)
return 0;
trace_bucket_evacuate(c, &bucket);
bch2_bkey_buf_init(&sk);
......@@ -711,7 +715,7 @@ int bch2_evacuate_bucket(struct moving_context *ctxt,
a = bch2_alloc_to_v4(k, &a_convert);
dirty_sectors = bch2_bucket_sectors_dirty(*a);
bucket_size = bch2_dev_bkey_exists(c, bucket.inode)->mi.bucket_size;
bucket_size = ca->mi.bucket_size;
fragmentation = a->fragmentation_lru;
ret = bch2_btree_write_buffer_tryflush(trans);
......@@ -823,6 +827,7 @@ int bch2_evacuate_bucket(struct moving_context *ctxt,
trace_evacuate_bucket(c, &bucket, dirty_sectors, bucket_size, fragmentation, ret);
err:
bch2_dev_put(ca);
bch2_bkey_buf_exit(&sk, c);
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment