From: Daniel Hill <daniel@gluo.nz>
To: linux-bcachefs@vger.kernel.org
Cc: Daniel Hill <daniel@gluo.nz>
Subject: [PATCH 1/1] bcachefs: copygc: remove ambiguity in bucket struct names
Date: Tue, 20 Feb 2024 03:08:42 +1300 [thread overview]
Message-ID: <20240219140857.901012-2-daniel@gluo.nz> (raw)
In-Reply-To: <20240219140857.901012-1-daniel@gluo.nz>
Signed-off-by: Daniel Hill <daniel@gluo.nz>
---
fs/bcachefs/movinggc.c | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/fs/bcachefs/movinggc.c b/fs/bcachefs/movinggc.c
index 7ecb3009bed3..40139e6d9770 100644
--- a/fs/bcachefs/movinggc.c
+++ b/fs/bcachefs/movinggc.c
@@ -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);
--
2.43.0
prev parent reply other threads:[~2024-02-19 14:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-19 14:08 [PATCH 0/1] bcachefs: copygc: remove ambiguity in bucket struct names Daniel Hill
2024-02-19 14:08 ` Daniel Hill [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240219140857.901012-2-daniel@gluo.nz \
--to=daniel@gluo.nz \
--cc=linux-bcachefs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).