Skip to contentSkip to conversation

bcachefs: copygc: remove ambiguity in bucket struct names

PATCH New Daniel Hill 1 participant 2 messages Feb 19, 2024

lore
Share & tools
lore
#0 lore raw

cover bcachefs: copygc: remove ambiguity in bucket struct names

Having the same variable name for different structures is confusing, lets fix that.

Daniel Hill (1):
bcachefs: copygc: remove ambiguity in bucket struct names

 fs/bcachefs/movinggc.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/1 bcachefs: copygc: remove ambiguity in bucket struct names

---
 fs/bcachefs/movinggc.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)
fs/bcachefs/movinggc.c +20 -20
index 7ecb3009bed3..40139e6d9770 100644
@@ -141,7 +141,7 @@ typedef DARRAY(struct move_bucket) move_buckets;
 
 static int bch2_copygc_get_buckets(struct moving_context *ctxt,
 			struct buckets_in_flight *buckets_in_flight,
-			move_buckets *buckets)
+			move_buckets *move_buckets)
 {
 	struct btree_trans *trans = ctxt->trans;
 	struct bch_fs *c = trans->c;
@@ -177,19 +177,19 @@ static int bch2_copygc_get_buckets(struct moving_context *ctxt,
 		else if (bucket_in_flight(buckets_in_flight, b.k))
 			in_flight++;
 		else {
-			ret2 = darray_push(buckets, b);
+			ret2 = darray_push(move_buckets, b);
 			if (ret2)
 				goto err;
 			sectors += b.sectors;
 		}
 
-		ret2 = buckets->nr >= nr_to_get;
+		ret2 = move_buckets->nr >= nr_to_get;
 err:
 		ret2;
 	}));
 
 	trace_copygc_get_buckets(c, buckets_in_flight->nr, nr_to_get, saw,
-				 not_movable, in_flight, buckets->nr, ret);
+				 not_movable, in_flight, move_buckets->nr, ret);
 
 	return ret < 0 ? ret : 0;
 }
@@ -204,18 +204,18 @@ static int bch2_copygc(struct moving_context *ctxt,
 	struct data_update_opts data_opts = {
 		.btree_insert_flags = BCH_WATERMARK_copygc,
 	};
-	move_buckets buckets = { 0 };
+	move_buckets move_buckets = { 0 };
 	struct move_bucket_in_flight *f;
 	u64 moved = atomic64_read(&ctxt->stats->sectors_moved);
 	u64 raced = atomic64_read(&ctxt->stats->sectors_raced);
 	u64 seen = atomic64_read(&ctxt->stats->sectors_seen);
 	int ret = 0;
 
-	ret = bch2_copygc_get_buckets(ctxt, buckets_in_flight, &buckets);
+	ret = bch2_copygc_get_buckets(ctxt, buckets_in_flight, &move_buckets);
 	if (ret)
 		goto err;
 
-	darray_for_each(buckets, i) {
+	darray_for_each(move_buckets, i) {
 		if (kthread_should_stop() || freezing(current))
 			break;
 
@@ -238,7 +238,7 @@ static int bch2_copygc(struct moving_context *ctxt,
 		*did_work = true;
 	}
 err:
-	darray_exit(&buckets);
+	darray_exit(&move_buckets);
 
 	/* no entries in LRU btree found, or got to end: */
 	if (bch2_err_matches(ret, ENOENT))
@@ -313,17 +313,17 @@ static int bch2_copygc_thread(void *arg)
 	struct moving_context ctxt;
 	struct bch_move_stats move_stats;
 	struct io_clock *clock = &c->io_clock[WRITE];
-	struct buckets_in_flight *buckets;
+	struct buckets_in_flight *buckets_in_flight;
 	u64 last, wait;
 	int ret = 0;
 
-	buckets = kzalloc(sizeof(struct buckets_in_flight), GFP_KERNEL);
-	if (!buckets)
+	buckets_in_flight = kzalloc(sizeof(struct buckets_in_flight), GFP_KERNEL);
+	if (!buckets_in_flight)
 		return -ENOMEM;
-	ret = rhashtable_init(&buckets->table, &bch_move_bucket_params);
+	ret = rhashtable_init(&buckets_in_flight->table, &bch_move_bucket_params);
 	bch_err_msg(c, ret, "allocating copygc buckets in flight");
 	if (ret) {
-		kfree(buckets);
+		kfree(buckets_in_flight);
 		return ret;
 	}
 
@@ -341,13 +341,13 @@ static int bch2_copygc_thread(void *arg)
 		cond_resched();
 
 		if (!c->copy_gc_enabled) {
-			move_buckets_wait(&ctxt, buckets, true);
+			move_buckets_wait(&ctxt, buckets_in_flight, true);
 			kthread_wait_freezable(c->copy_gc_enabled ||
 					       kthread_should_stop());
 		}
 
 		if (unlikely(freezing(current))) {
-			move_buckets_wait(&ctxt, buckets, true);
+			move_buckets_wait(&ctxt, buckets_in_flight, true);
 			__refrigerator(false);
 			continue;
 		}
@@ -358,7 +358,7 @@ static int bch2_copygc_thread(void *arg)
 		if (wait > clock->max_slop) {
 			c->copygc_wait_at = last;
 			c->copygc_wait = last + wait;
-			move_buckets_wait(&ctxt, buckets, true);
+			move_buckets_wait(&ctxt, buckets_in_flight, true);
 			trace_and_count(c, copygc_wait, c, wait, last + wait);
 			bch2_kthread_io_clock_wait(clock, last + wait,
 					MAX_SCHEDULE_TIMEOUT);
@@ -368,7 +368,7 @@ static int bch2_copygc_thread(void *arg)
 		c->copygc_wait = 0;
 
 		c->copygc_running = true;
-		ret = bch2_copygc(&ctxt, buckets, &did_work);
+		ret = bch2_copygc(&ctxt, buckets_in_flight, &did_work);
 		c->copygc_running = false;
 
 		wake_up(&c->copygc_running_wq);
@@ -385,10 +385,10 @@ static int bch2_copygc_thread(void *arg)
 		}
 	}
 
-	move_buckets_wait(&ctxt, buckets, true);
+	move_buckets_wait(&ctxt, buckets_in_flight, true);
 
-	rhashtable_destroy(&buckets->table);
-	kfree(buckets);
+	rhashtable_destroy(&buckets_in_flight->table);
+	kfree(buckets_in_flight);
 	bch2_moving_ctxt_exit(&ctxt);
 	bch2_move_stats_exit(&move_stats, c);
 
Signature · 1 line
2.43.0