Commit 5028b907 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Rename for_each_btree_key2() -> for_each_btree_key()

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 27b2df98
...@@ -544,8 +544,8 @@ int bch2_bucket_gens_init(struct bch_fs *c) ...@@ -544,8 +544,8 @@ int bch2_bucket_gens_init(struct bch_fs *c)
u8 gen; u8 gen;
int ret; int ret;
ret = for_each_btree_key2(trans, iter, BTREE_ID_alloc, POS_MIN, ret = for_each_btree_key(trans, iter, BTREE_ID_alloc, POS_MIN,
BTREE_ITER_PREFETCH, k, ({ BTREE_ITER_PREFETCH, k, ({
/* /*
* Not a fsck error because this is checked/repaired by * Not a fsck error because this is checked/repaired by
* bch2_check_alloc_key() which runs later: * bch2_check_alloc_key() which runs later:
...@@ -600,8 +600,8 @@ int bch2_alloc_read(struct bch_fs *c) ...@@ -600,8 +600,8 @@ int bch2_alloc_read(struct bch_fs *c)
const struct bch_bucket_gens *g; const struct bch_bucket_gens *g;
u64 b; u64 b;
ret = for_each_btree_key2(trans, iter, BTREE_ID_bucket_gens, POS_MIN, ret = for_each_btree_key(trans, iter, BTREE_ID_bucket_gens, POS_MIN,
BTREE_ITER_PREFETCH, k, ({ BTREE_ITER_PREFETCH, k, ({
u64 start = bucket_gens_pos_to_alloc(k.k->p, 0).offset; u64 start = bucket_gens_pos_to_alloc(k.k->p, 0).offset;
u64 end = bucket_gens_pos_to_alloc(bpos_nosnap_successor(k.k->p), 0).offset; u64 end = bucket_gens_pos_to_alloc(bpos_nosnap_successor(k.k->p), 0).offset;
...@@ -628,8 +628,8 @@ int bch2_alloc_read(struct bch_fs *c) ...@@ -628,8 +628,8 @@ int bch2_alloc_read(struct bch_fs *c)
} else { } else {
struct bch_alloc_v4 a; struct bch_alloc_v4 a;
ret = for_each_btree_key2(trans, iter, BTREE_ID_alloc, POS_MIN, ret = for_each_btree_key(trans, iter, BTREE_ID_alloc, POS_MIN,
BTREE_ITER_PREFETCH, k, ({ BTREE_ITER_PREFETCH, k, ({
/* /*
* Not a fsck error because this is checked/repaired by * Not a fsck error because this is checked/repaired by
* bch2_check_alloc_key() which runs later: * bch2_check_alloc_key() which runs later:
...@@ -1427,7 +1427,7 @@ int bch2_check_alloc_info(struct bch_fs *c) ...@@ -1427,7 +1427,7 @@ int bch2_check_alloc_info(struct bch_fs *c)
if (ret < 0) if (ret < 0)
goto err; goto err;
ret = for_each_btree_key2(trans, iter, ret = for_each_btree_key(trans, iter,
BTREE_ID_need_discard, POS_MIN, BTREE_ID_need_discard, POS_MIN,
BTREE_ITER_PREFETCH, k, BTREE_ITER_PREFETCH, k,
bch2_check_discard_freespace_key(trans, &iter)); bch2_check_discard_freespace_key(trans, &iter));
...@@ -1693,8 +1693,8 @@ static void bch2_do_discards_work(struct work_struct *work) ...@@ -1693,8 +1693,8 @@ static void bch2_do_discards_work(struct work_struct *work)
* successful commit: * successful commit:
*/ */
ret = bch2_trans_run(c, ret = bch2_trans_run(c,
for_each_btree_key2(trans, iter, for_each_btree_key(trans, iter,
BTREE_ID_need_discard, POS_MIN, 0, k, BTREE_ID_need_discard, POS_MIN, 0, k,
bch2_discard_one_bucket(trans, &iter, &discard_pos_done, bch2_discard_one_bucket(trans, &iter, &discard_pos_done,
&seen, &seen,
&open, &open,
......
...@@ -1538,8 +1538,8 @@ static int bch2_gc_alloc_start(struct bch_fs *c, bool metadata_only) ...@@ -1538,8 +1538,8 @@ static int bch2_gc_alloc_start(struct bch_fs *c, bool metadata_only)
rcu_assign_pointer(ca->buckets_gc, buckets); rcu_assign_pointer(ca->buckets_gc, buckets);
} }
ret = for_each_btree_key2(trans, iter, BTREE_ID_alloc, POS_MIN, ret = for_each_btree_key(trans, iter, BTREE_ID_alloc, POS_MIN,
BTREE_ITER_PREFETCH, k, ({ BTREE_ITER_PREFETCH, k, ({
ca = bch_dev_bkey_exists(c, k.k->p.inode); ca = bch_dev_bkey_exists(c, k.k->p.inode);
g = gc_bucket(ca, k.k->p.offset); g = gc_bucket(ca, k.k->p.offset);
...@@ -1676,8 +1676,8 @@ static int bch2_gc_reflink_start(struct bch_fs *c, ...@@ -1676,8 +1676,8 @@ static int bch2_gc_reflink_start(struct bch_fs *c,
c->reflink_gc_nr = 0; c->reflink_gc_nr = 0;
ret = bch2_trans_run(c, ret = bch2_trans_run(c,
for_each_btree_key2(trans, iter, BTREE_ID_reflink, POS_MIN, for_each_btree_key(trans, iter, BTREE_ID_reflink, POS_MIN,
BTREE_ITER_PREFETCH, k, ({ BTREE_ITER_PREFETCH, k, ({
const __le64 *refcount = bkey_refcount_c(k); const __le64 *refcount = bkey_refcount_c(k);
if (!refcount) if (!refcount)
......
...@@ -725,8 +725,8 @@ transaction_restart: \ ...@@ -725,8 +725,8 @@ transaction_restart: \
_ret3; \ _ret3; \
}) })
#define for_each_btree_key2(_trans, _iter, _btree_id, \ #define for_each_btree_key(_trans, _iter, _btree_id, \
_start, _flags, _k, _do) \ _start, _flags, _k, _do) \
for_each_btree_key2_upto(_trans, _iter, _btree_id, _start, \ for_each_btree_key2_upto(_trans, _iter, _btree_id, _start, \
SPOS_MAX, _flags, _k, _do) SPOS_MAX, _flags, _k, _do)
...@@ -757,7 +757,7 @@ transaction_restart: \ ...@@ -757,7 +757,7 @@ transaction_restart: \
_start, _iter_flags, _k, \ _start, _iter_flags, _k, \
_disk_res, _journal_seq, _commit_flags,\ _disk_res, _journal_seq, _commit_flags,\
_do) \ _do) \
for_each_btree_key2(_trans, _iter, _btree_id, _start, _iter_flags, _k,\ for_each_btree_key(_trans, _iter, _btree_id, _start, _iter_flags, _k,\
(_do) ?: bch2_trans_commit(_trans, (_disk_res),\ (_do) ?: bch2_trans_commit(_trans, (_disk_res),\
(_journal_seq), (_commit_flags))) (_journal_seq), (_commit_flags)))
......
...@@ -380,9 +380,9 @@ static ssize_t bch2_read_btree(struct file *file, char __user *buf, ...@@ -380,9 +380,9 @@ static ssize_t bch2_read_btree(struct file *file, char __user *buf,
return ret; return ret;
trans = bch2_trans_get(i->c); trans = bch2_trans_get(i->c);
ret = for_each_btree_key2(trans, iter, i->id, i->from, ret = for_each_btree_key(trans, iter, i->id, i->from,
BTREE_ITER_PREFETCH| BTREE_ITER_PREFETCH|
BTREE_ITER_ALL_SNAPSHOTS, k, ({ BTREE_ITER_ALL_SNAPSHOTS, k, ({
bch2_bkey_val_to_text(&i->buf, i->c, k); bch2_bkey_val_to_text(&i->buf, i->c, k);
prt_newline(&i->buf); prt_newline(&i->buf);
bch2_trans_unlock(trans); bch2_trans_unlock(trans);
...@@ -478,9 +478,9 @@ static ssize_t bch2_read_bfloat_failed(struct file *file, char __user *buf, ...@@ -478,9 +478,9 @@ static ssize_t bch2_read_bfloat_failed(struct file *file, char __user *buf,
trans = bch2_trans_get(i->c); trans = bch2_trans_get(i->c);
ret = for_each_btree_key2(trans, iter, i->id, i->from, ret = for_each_btree_key(trans, iter, i->id, i->from,
BTREE_ITER_PREFETCH| BTREE_ITER_PREFETCH|
BTREE_ITER_ALL_SNAPSHOTS, k, ({ BTREE_ITER_ALL_SNAPSHOTS, k, ({
struct btree_path_level *l = &iter.path->l[0]; struct btree_path_level *l = &iter.path->l[0];
struct bkey_packed *_k = struct bkey_packed *_k =
bch2_btree_node_iter_peek(&l->iter, l->b); bch2_btree_node_iter_peek(&l->iter, l->b);
......
...@@ -1841,8 +1841,8 @@ int bch2_stripes_read(struct bch_fs *c) ...@@ -1841,8 +1841,8 @@ int bch2_stripes_read(struct bch_fs *c)
int ret; int ret;
ret = bch2_trans_run(c, ret = bch2_trans_run(c,
for_each_btree_key2(trans, iter, BTREE_ID_stripes, POS_MIN, for_each_btree_key(trans, iter, BTREE_ID_stripes, POS_MIN,
BTREE_ITER_PREFETCH, k, ({ BTREE_ITER_PREFETCH, k, ({
if (k.k->type != KEY_TYPE_stripe) if (k.k->type != KEY_TYPE_stripe)
continue; continue;
......
...@@ -2254,11 +2254,11 @@ static int check_nlinks_find_hardlinks(struct bch_fs *c, ...@@ -2254,11 +2254,11 @@ static int check_nlinks_find_hardlinks(struct bch_fs *c,
struct bch_inode_unpacked u; struct bch_inode_unpacked u;
int ret = bch2_trans_run(c, int ret = bch2_trans_run(c,
for_each_btree_key2(trans, iter, BTREE_ID_inodes, for_each_btree_key(trans, iter, BTREE_ID_inodes,
POS(0, start), POS(0, start),
BTREE_ITER_INTENT| BTREE_ITER_INTENT|
BTREE_ITER_PREFETCH| BTREE_ITER_PREFETCH|
BTREE_ITER_ALL_SNAPSHOTS, k, ({ BTREE_ITER_ALL_SNAPSHOTS, k, ({
if (!bkey_is_inode(k.k)) if (!bkey_is_inode(k.k))
continue; continue;
...@@ -2300,10 +2300,10 @@ static int check_nlinks_walk_dirents(struct bch_fs *c, struct nlink_table *links ...@@ -2300,10 +2300,10 @@ static int check_nlinks_walk_dirents(struct bch_fs *c, struct nlink_table *links
snapshots_seen_init(&s); snapshots_seen_init(&s);
int ret = bch2_trans_run(c, int ret = bch2_trans_run(c,
for_each_btree_key2(trans, iter, BTREE_ID_dirents, POS_MIN, for_each_btree_key(trans, iter, BTREE_ID_dirents, POS_MIN,
BTREE_ITER_INTENT| BTREE_ITER_INTENT|
BTREE_ITER_PREFETCH| BTREE_ITER_PREFETCH|
BTREE_ITER_ALL_SNAPSHOTS, k, ({ BTREE_ITER_ALL_SNAPSHOTS, k, ({
ret = snapshots_seen_update(c, &s, iter.btree_id, k.k->p); ret = snapshots_seen_update(c, &s, iter.btree_id, k.k->p);
if (ret) if (ret)
break; break;
......
...@@ -59,8 +59,9 @@ int bch2_resume_logged_ops(struct bch_fs *c) ...@@ -59,8 +59,9 @@ int bch2_resume_logged_ops(struct bch_fs *c)
int ret; int ret;
ret = bch2_trans_run(c, ret = bch2_trans_run(c,
for_each_btree_key2(trans, iter, for_each_btree_key(trans, iter,
BTREE_ID_logged_ops, POS_MIN, BTREE_ITER_PREFETCH, k, BTREE_ID_logged_ops, POS_MIN,
BTREE_ITER_PREFETCH, k,
resume_logged_op(trans, &iter, k))); resume_logged_op(trans, &iter, k)));
if (ret) if (ret)
bch_err_fn(c, ret); bch_err_fn(c, ret);
......
...@@ -377,8 +377,8 @@ struct bch_io_opts *bch2_move_get_io_opts(struct btree_trans *trans, ...@@ -377,8 +377,8 @@ struct bch_io_opts *bch2_move_get_io_opts(struct btree_trans *trans,
io_opts->d.nr = 0; io_opts->d.nr = 0;
ret = for_each_btree_key2(trans, iter, BTREE_ID_inodes, POS(0, extent_k.k->p.inode), ret = for_each_btree_key(trans, iter, BTREE_ID_inodes, POS(0, extent_k.k->p.inode),
BTREE_ITER_ALL_SNAPSHOTS, k, ({ BTREE_ITER_ALL_SNAPSHOTS, k, ({
if (k.k->p.offset != extent_k.k->p.inode) if (k.k->p.offset != extent_k.k->p.inode)
break; break;
......
...@@ -617,11 +617,11 @@ int bch2_fs_quota_read(struct bch_fs *c) ...@@ -617,11 +617,11 @@ int bch2_fs_quota_read(struct bch_fs *c)
trans = bch2_trans_get(c); trans = bch2_trans_get(c);
ret = for_each_btree_key2(trans, iter, BTREE_ID_quotas, ret = for_each_btree_key(trans, iter, BTREE_ID_quotas, POS_MIN,
POS_MIN, BTREE_ITER_PREFETCH, k, BTREE_ITER_PREFETCH, k,
__bch2_quota_set(c, k, NULL)) ?: __bch2_quota_set(c, k, NULL)) ?:
for_each_btree_key2(trans, iter, BTREE_ID_inodes, for_each_btree_key(trans, iter, BTREE_ID_inodes, POS_MIN,
POS_MIN, BTREE_ITER_PREFETCH|BTREE_ITER_ALL_SNAPSHOTS, k, BTREE_ITER_PREFETCH|BTREE_ITER_ALL_SNAPSHOTS, k,
bch2_fs_quota_read_inode(trans, &iter, k)); bch2_fs_quota_read_inode(trans, &iter, k));
bch2_trans_put(trans); bch2_trans_put(trans);
......
...@@ -1402,16 +1402,16 @@ int bch2_delete_dead_snapshots(struct bch_fs *c) ...@@ -1402,16 +1402,16 @@ int bch2_delete_dead_snapshots(struct bch_fs *c)
goto err; goto err;
} }
ret = for_each_btree_key2(trans, iter, BTREE_ID_snapshots, ret = for_each_btree_key(trans, iter, BTREE_ID_snapshots,
POS_MIN, 0, k, POS_MIN, 0, k,
bch2_snapshot_set_equiv(trans, k)); bch2_snapshot_set_equiv(trans, k));
if (ret) { if (ret) {
bch_err_msg(c, ret, "in bch2_snapshots_set_equiv"); bch_err_msg(c, ret, "in bch2_snapshots_set_equiv");
goto err; goto err;
} }
ret = for_each_btree_key2(trans, iter, BTREE_ID_snapshots, ret = for_each_btree_key(trans, iter, BTREE_ID_snapshots,
POS_MIN, 0, k, ({ POS_MIN, 0, k, ({
if (k.k->type != KEY_TYPE_snapshot) if (k.k->type != KEY_TYPE_snapshot)
continue; continue;
...@@ -1466,8 +1466,8 @@ int bch2_delete_dead_snapshots(struct bch_fs *c) ...@@ -1466,8 +1466,8 @@ int bch2_delete_dead_snapshots(struct bch_fs *c)
bch2_trans_unlock(trans); bch2_trans_unlock(trans);
down_write(&c->snapshot_create_lock); down_write(&c->snapshot_create_lock);
ret = for_each_btree_key2(trans, iter, BTREE_ID_snapshots, ret = for_each_btree_key(trans, iter, BTREE_ID_snapshots,
POS_MIN, 0, k, ({ POS_MIN, 0, k, ({
u32 snapshot = k.k->p.offset; u32 snapshot = k.k->p.offset;
u32 equiv = bch2_snapshot_equiv(c, snapshot); u32 equiv = bch2_snapshot_equiv(c, snapshot);
...@@ -1693,13 +1693,13 @@ int bch2_snapshots_read(struct bch_fs *c) ...@@ -1693,13 +1693,13 @@ int bch2_snapshots_read(struct bch_fs *c)
int ret = 0; int ret = 0;
ret = bch2_trans_run(c, ret = bch2_trans_run(c,
for_each_btree_key2(trans, iter, BTREE_ID_snapshots, for_each_btree_key(trans, iter, BTREE_ID_snapshots,
POS_MIN, 0, k, POS_MIN, 0, k,
bch2_mark_snapshot(trans, BTREE_ID_snapshots, 0, bkey_s_c_null, k, 0) ?: bch2_mark_snapshot(trans, BTREE_ID_snapshots, 0, bkey_s_c_null, k, 0) ?:
bch2_snapshot_set_equiv(trans, k) ?: bch2_snapshot_set_equiv(trans, k) ?:
bch2_check_snapshot_needs_deletion(trans, k)) ?: bch2_check_snapshot_needs_deletion(trans, k)) ?:
for_each_btree_key2(trans, iter, BTREE_ID_snapshots, for_each_btree_key(trans, iter, BTREE_ID_snapshots,
POS_MIN, 0, k, POS_MIN, 0, k,
(set_is_ancestor_bitmap(c, k.k->p.offset), 0))); (set_is_ancestor_bitmap(c, k.k->p.offset), 0)));
if (ret) if (ret)
bch_err_fn(c, ret); bch_err_fn(c, ret);
......
...@@ -278,8 +278,8 @@ static int bch2_compression_stats_to_text(struct printbuf *out, struct bch_fs *c ...@@ -278,8 +278,8 @@ static int bch2_compression_stats_to_text(struct printbuf *out, struct bch_fs *c
if (!btree_type_has_ptrs(id)) if (!btree_type_has_ptrs(id))
continue; continue;
ret = for_each_btree_key2(trans, iter, id, POS_MIN, ret = for_each_btree_key(trans, iter, id, POS_MIN,
BTREE_ITER_ALL_SNAPSHOTS, k, ({ BTREE_ITER_ALL_SNAPSHOTS, k, ({
struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k); struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k);
struct bch_extent_crc_unpacked crc; struct bch_extent_crc_unpacked crc;
const union bch_extent_entry *entry; const union bch_extent_entry *entry;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment