diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-03-31 22:24:45 +0200 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:09:59 +0200 |
commit | 62a03559d667c1b0552a692ac01c576358847318 (patch) | |
tree | 3873884189ec483d5e0ddf1072aade78f883c9db /fs/bcachefs/move.c | |
parent | bcachefs: use reservation for log messages during recovery (diff) | |
download | linux-62a03559d667c1b0552a692ac01c576358847318.tar.xz linux-62a03559d667c1b0552a692ac01c576358847318.zip |
bcachefs: Rip out code for storing backpointers in alloc keys
We don't store backpointers in alloc keys anymore, since we gained the
btree write buffer.
This patch drops support for backpointers in alloc keys, and revs the on
disk format version so that we know a fsck is required.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/move.c')
-rw-r--r-- | fs/bcachefs/move.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c index be14d3737027..9c8af0872b29 100644 --- a/fs/bcachefs/move.c +++ b/fs/bcachefs/move.c @@ -626,7 +626,7 @@ void bch2_verify_bucket_evacuated(struct btree_trans *trans, struct bpos bucket, struct bkey_s_c k; struct printbuf buf = PRINTBUF; struct bch_backpointer bp; - u64 bp_offset = 0; + struct bpos bp_pos = POS_MIN; unsigned nr_bps = 0; int ret; @@ -668,17 +668,16 @@ failed_to_evacuate: bch2_trans_begin(trans); ret = bch2_get_next_backpointer(trans, bucket, gen, - &bp_offset, &bp, + &bp_pos, &bp, BTREE_ITER_CACHED); if (bch2_err_matches(ret, BCH_ERR_transaction_restart)) continue; if (ret) break; - if (bp_offset == U64_MAX) + if (bkey_eq(bp_pos, POS_MAX)) break; - k = bch2_backpointer_get_key(trans, &iter, - bucket, bp_offset, bp, 0); + k = bch2_backpointer_get_key(trans, &iter, bp_pos, bp, 0); ret = bkey_err(k); if (bch2_err_matches(ret, BCH_ERR_transaction_restart)) continue; @@ -692,7 +691,7 @@ failed_to_evacuate: if (++nr_bps > 10) break; - bp_offset++; + bp_pos = bpos_nosnap_successor(bp_pos); } bch2_print_string_as_lines(KERN_ERR, buf.buf); @@ -716,7 +715,8 @@ int __bch2_evacuate_bucket(struct btree_trans *trans, struct data_update_opts data_opts; unsigned dirty_sectors, bucket_size; u64 fragmentation; - u64 bp_offset = 0, cur_inum = U64_MAX; + u64 cur_inum = U64_MAX; + struct bpos bp_pos = POS_MIN; int ret = 0; bch2_bkey_buf_init(&sk); @@ -752,13 +752,13 @@ int __bch2_evacuate_bucket(struct btree_trans *trans, bch2_trans_begin(trans); ret = bch2_get_next_backpointer(trans, bucket, gen, - &bp_offset, &bp, + &bp_pos, &bp, BTREE_ITER_CACHED); if (bch2_err_matches(ret, BCH_ERR_transaction_restart)) continue; if (ret) goto err; - if (bp_offset == U64_MAX) + if (bkey_eq(bp_pos, POS_MAX)) break; if (!bp.level) { @@ -766,8 +766,7 @@ int __bch2_evacuate_bucket(struct btree_trans *trans, struct bkey_s_c k; unsigned i = 0; - k = bch2_backpointer_get_key(trans, &iter, - bucket, bp_offset, bp, 0); + k = bch2_backpointer_get_key(trans, &iter, bp_pos, bp, 0); ret = bkey_err(k); if (bch2_err_matches(ret, BCH_ERR_transaction_restart)) continue; @@ -822,8 +821,7 @@ int __bch2_evacuate_bucket(struct btree_trans *trans, } else { struct btree *b; - b = bch2_backpointer_get_node(trans, &iter, - bucket, bp_offset, bp); + b = bch2_backpointer_get_node(trans, &iter, bp_pos, bp); ret = PTR_ERR_OR_ZERO(b); if (ret == -BCH_ERR_backpointer_to_overwritten_btree_node) continue; @@ -851,7 +849,7 @@ int __bch2_evacuate_bucket(struct btree_trans *trans, } } next: - bp_offset++; + bp_pos = bpos_nosnap_successor(bp_pos); } trace_evacuate_bucket(c, &bucket, dirty_sectors, bucket_size, fragmentation, ret); |