bcachefs: Fix next_bucket()
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 11 Mar 2023 20:52:37 +0000 (15:52 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:57 +0000 (17:09 -0400)
This fixes an infinite loop in bch2_get_key_or_real_bucket_hole().

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/alloc_background.c

index ce0ea48862885bd65302819f0e14bfef69bf491b..e5abe6406afe22211ead53c6f8cb0997a3f16579 100644 (file)
@@ -1006,7 +1006,7 @@ static bool next_bucket(struct bch_fs *c, struct bpos *bucket)
        iter = bucket->inode;
        ca = __bch2_next_dev(c, &iter, NULL);
        if (ca)
-               bucket->offset = ca->mi.first_bucket;
+               *bucket = POS(ca->dev_idx, ca->mi.first_bucket);
        rcu_read_unlock();
 
        return ca != NULL;