Skip to content

Commit cb4d340

Browse files
author
Kent Overstreet
committed
bcachefs: bch2_evacuate_bucket() -> bch2_dev_tryget()
Signed-off-by: Kent Overstreet <[email protected]>
1 parent 07d7c4d commit cb4d340

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

fs/bcachefs/move.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,10 @@ int bch2_evacuate_bucket(struct moving_context *ctxt,
690690
struct bpos bp_pos = POS_MIN;
691691
int ret = 0;
692692

693+
struct bch_dev *ca = bch2_dev_tryget(c, bucket.inode);
694+
if (!ca)
695+
return 0;
696+
693697
trace_bucket_evacuate(c, &bucket);
694698

695699
bch2_bkey_buf_init(&sk);
@@ -711,7 +715,7 @@ int bch2_evacuate_bucket(struct moving_context *ctxt,
711715

712716
a = bch2_alloc_to_v4(k, &a_convert);
713717
dirty_sectors = bch2_bucket_sectors_dirty(*a);
714-
bucket_size = bch2_dev_bkey_exists(c, bucket.inode)->mi.bucket_size;
718+
bucket_size = ca->mi.bucket_size;
715719
fragmentation = a->fragmentation_lru;
716720

717721
ret = bch2_btree_write_buffer_tryflush(trans);
@@ -823,6 +827,7 @@ int bch2_evacuate_bucket(struct moving_context *ctxt,
823827

824828
trace_evacuate_bucket(c, &bucket, dirty_sectors, bucket_size, fragmentation, ret);
825829
err:
830+
bch2_dev_put(ca);
826831
bch2_bkey_buf_exit(&sk, c);
827832
return ret;
828833
}

0 commit comments

Comments
 (0)