|
28 | 28 | #include <linux/wait.h> |
29 | 29 |
|
30 | 30 | struct buckets_in_flight { |
31 | | - struct rhashtable table; |
| 31 | + struct rhashtable *table; |
32 | 32 | struct move_bucket *first; |
33 | 33 | struct move_bucket *last; |
34 | 34 | size_t nr; |
@@ -98,7 +98,7 @@ static int bch2_bucket_is_movable(struct btree_trans *trans, |
98 | 98 | static void move_bucket_free(struct buckets_in_flight *list, |
99 | 99 | struct move_bucket *b) |
100 | 100 | { |
101 | | - int ret = rhashtable_remove_fast(&list->table, &b->hash, |
| 101 | + int ret = rhashtable_remove_fast(list->table, &b->hash, |
102 | 102 | bch_move_bucket_params); |
103 | 103 | BUG_ON(ret); |
104 | 104 | kfree(b); |
@@ -133,7 +133,7 @@ static void move_buckets_wait(struct moving_context *ctxt, |
133 | 133 | static bool bucket_in_flight(struct buckets_in_flight *list, |
134 | 134 | struct move_bucket_key k) |
135 | 135 | { |
136 | | - return rhashtable_lookup_fast(&list->table, &k, bch_move_bucket_params); |
| 136 | + return rhashtable_lookup_fast(list->table, &k, bch_move_bucket_params); |
137 | 137 | } |
138 | 138 |
|
139 | 139 | static int bch2_copygc_get_buckets(struct moving_context *ctxt, |
@@ -185,7 +185,7 @@ static int bch2_copygc_get_buckets(struct moving_context *ctxt, |
185 | 185 | goto err; |
186 | 186 | } |
187 | 187 |
|
188 | | - ret2 = rhashtable_lookup_insert_fast(&buckets_in_flight->table, &b_i->hash, |
| 188 | + ret2 = rhashtable_lookup_insert_fast(buckets_in_flight->table, &b_i->hash, |
189 | 189 | bch_move_bucket_params); |
190 | 190 | BUG_ON(ret2); |
191 | 191 |
|
@@ -350,10 +350,13 @@ static int bch2_copygc_thread(void *arg) |
350 | 350 | struct buckets_in_flight buckets = {}; |
351 | 351 | u64 last, wait; |
352 | 352 |
|
353 | | - int ret = rhashtable_init(&buckets.table, &bch_move_bucket_params); |
| 353 | + buckets.table = kzalloc(sizeof(*buckets.table), GFP_KERNEL); |
| 354 | + int ret = !buckets.table |
| 355 | + ? -ENOMEM |
| 356 | + : rhashtable_init(buckets.table, &bch_move_bucket_params); |
354 | 357 | bch_err_msg(c, ret, "allocating copygc buckets in flight"); |
355 | 358 | if (ret) |
356 | | - return ret; |
| 359 | + goto err; |
357 | 360 |
|
358 | 361 | set_freezable(); |
359 | 362 |
|
@@ -421,11 +424,12 @@ static int bch2_copygc_thread(void *arg) |
421 | 424 | } |
422 | 425 |
|
423 | 426 | move_buckets_wait(&ctxt, &buckets, true); |
424 | | - rhashtable_destroy(&buckets.table); |
| 427 | + rhashtable_destroy(buckets.table); |
425 | 428 | bch2_moving_ctxt_exit(&ctxt); |
426 | 429 | bch2_move_stats_exit(&move_stats, c); |
427 | | - |
428 | | - return 0; |
| 430 | +err: |
| 431 | + kfree(buckets.table); |
| 432 | + return ret; |
429 | 433 | } |
430 | 434 |
|
431 | 435 | void bch2_copygc_stop(struct bch_fs *c) |
|
0 commit comments