bcachefs: for_each_btree_key_upto() -> for_each_btree_key_old_upto()

And for_each_btree_key2_upto -> for_each_btree_key_upto

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2023-12-16 21:46:23 -05:00
parent c8ef2dc2fc
commit 3a860b5ad5
5 changed files with 23 additions and 23 deletions

View File

@ -1818,7 +1818,7 @@ static void bch2_do_invalidates_work(struct work_struct *work)
s64 nr_to_invalidate = s64 nr_to_invalidate =
should_invalidate_buckets(ca, bch2_dev_usage_read(ca)); should_invalidate_buckets(ca, bch2_dev_usage_read(ca));
ret = for_each_btree_key2_upto(trans, iter, BTREE_ID_lru, ret = for_each_btree_key_upto(trans, iter, BTREE_ID_lru,
lru_pos(ca->dev_idx, 0, 0), lru_pos(ca->dev_idx, 0, 0),
lru_pos(ca->dev_idx, U64_MAX, LRU_TIME_MAX), lru_pos(ca->dev_idx, U64_MAX, LRU_TIME_MAX),
BTREE_ITER_INTENT, k, BTREE_ITER_INTENT, k,

View File

@ -701,8 +701,8 @@ transaction_restart: \
_ret2 ?: trans_was_restarted(_trans, _restart_count); \ _ret2 ?: trans_was_restarted(_trans, _restart_count); \
}) })
#define for_each_btree_key2_upto(_trans, _iter, _btree_id, \ #define for_each_btree_key_upto(_trans, _iter, _btree_id, \
_start, _end, _flags, _k, _do) \ _start, _end, _flags, _k, _do) \
({ \ ({ \
int _ret3 = 0; \ int _ret3 = 0; \
\ \
@ -726,7 +726,7 @@ transaction_restart: \
#define for_each_btree_key(_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_key_upto(_trans, _iter, _btree_id, _start, \
SPOS_MAX, _flags, _k, _do) SPOS_MAX, _flags, _k, _do)
#define for_each_btree_key_reverse(_trans, _iter, _btree_id, \ #define for_each_btree_key_reverse(_trans, _iter, _btree_id, \
@ -772,11 +772,11 @@ transaction_restart: \
_start, _end, _iter_flags, _k, \ _start, _end, _iter_flags, _k, \
_disk_res, _journal_seq, _commit_flags,\ _disk_res, _journal_seq, _commit_flags,\
_do) \ _do) \
for_each_btree_key2_upto(_trans, _iter, _btree_id, _start, _end, _iter_flags, _k,\ for_each_btree_key_upto(_trans, _iter, _btree_id, _start, _end, _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)))
#define for_each_btree_key_old(_trans, _iter, _btree_id, \ #define for_each_btree_key_old(_trans, _iter, _btree_id, \
_start, _flags, _k, _ret) \ _start, _flags, _k, _ret) \
for (bch2_trans_iter_init((_trans), &(_iter), (_btree_id), \ for (bch2_trans_iter_init((_trans), &(_iter), (_btree_id), \
(_start), (_flags)); \ (_start), (_flags)); \
@ -784,7 +784,7 @@ transaction_restart: \
!((_ret) = bkey_err(_k)) && (_k).k; \ !((_ret) = bkey_err(_k)) && (_k).k; \
bch2_btree_iter_advance(&(_iter))) bch2_btree_iter_advance(&(_iter)))
#define for_each_btree_key_upto(_trans, _iter, _btree_id, \ #define for_each_btree_key_old_upto(_trans, _iter, _btree_id, \
_start, _end, _flags, _k, _ret) \ _start, _end, _flags, _k, _ret) \
for (bch2_trans_iter_init((_trans), &(_iter), (_btree_id), \ for (bch2_trans_iter_init((_trans), &(_iter), (_btree_id), \
(_start), (_flags)); \ (_start), (_flags)); \

View File

@ -32,10 +32,10 @@ static s64 bch2_count_inode_sectors(struct btree_trans *trans, u64 inum,
u64 sectors = 0; u64 sectors = 0;
int ret; int ret;
for_each_btree_key_upto(trans, iter, BTREE_ID_extents, for_each_btree_key_old_upto(trans, iter, BTREE_ID_extents,
SPOS(inum, 0, snapshot), SPOS(inum, 0, snapshot),
POS(inum, U64_MAX), POS(inum, U64_MAX),
0, k, ret) 0, k, ret)
if (bkey_extent_is_allocation(k.k)) if (bkey_extent_is_allocation(k.k))
sectors += k.k->size; sectors += k.k->size;
@ -53,10 +53,10 @@ static s64 bch2_count_subdirs(struct btree_trans *trans, u64 inum,
u64 subdirs = 0; u64 subdirs = 0;
int ret; int ret;
for_each_btree_key_upto(trans, iter, BTREE_ID_dirents, for_each_btree_key_old_upto(trans, iter, BTREE_ID_dirents,
SPOS(inum, 0, snapshot), SPOS(inum, 0, snapshot),
POS(inum, U64_MAX), POS(inum, U64_MAX),
0, k, ret) { 0, k, ret) {
if (k.k->type != KEY_TYPE_dirent) if (k.k->type != KEY_TYPE_dirent)
continue; continue;

View File

@ -161,7 +161,7 @@ static int bch2_copygc_get_buckets(struct moving_context *ctxt,
__func__, bch2_err_str(ret))) __func__, bch2_err_str(ret)))
return ret; return ret;
ret = for_each_btree_key2_upto(trans, iter, BTREE_ID_lru, ret = for_each_btree_key_upto(trans, iter, BTREE_ID_lru,
lru_pos(BCH_LRU_FRAGMENTATION_START, 0, 0), lru_pos(BCH_LRU_FRAGMENTATION_START, 0, 0),
lru_pos(BCH_LRU_FRAGMENTATION_START, U64_MAX, LRU_TIME_MAX), lru_pos(BCH_LRU_FRAGMENTATION_START, U64_MAX, LRU_TIME_MAX),
0, k, ({ 0, k, ({

View File

@ -134,7 +134,7 @@ static int test_iterate(struct bch_fs *c, u64 nr)
i = 0; i = 0;
ret = for_each_btree_key2_upto(trans, iter, BTREE_ID_xattrs, ret = for_each_btree_key_upto(trans, iter, BTREE_ID_xattrs,
SPOS(0, 0, U32_MAX), POS(0, U64_MAX), SPOS(0, 0, U32_MAX), POS(0, U64_MAX),
0, k, ({ 0, k, ({
BUG_ON(k.k->p.offset != i++); BUG_ON(k.k->p.offset != i++);
@ -195,7 +195,7 @@ static int test_iterate_extents(struct bch_fs *c, u64 nr)
i = 0; i = 0;
ret = for_each_btree_key2_upto(trans, iter, BTREE_ID_extents, ret = for_each_btree_key_upto(trans, iter, BTREE_ID_extents,
SPOS(0, 0, U32_MAX), POS(0, U64_MAX), SPOS(0, 0, U32_MAX), POS(0, U64_MAX),
0, k, ({ 0, k, ({
BUG_ON(bkey_start_offset(k.k) != i); BUG_ON(bkey_start_offset(k.k) != i);
@ -257,7 +257,7 @@ static int test_iterate_slots(struct bch_fs *c, u64 nr)
i = 0; i = 0;
ret = for_each_btree_key2_upto(trans, iter, BTREE_ID_xattrs, ret = for_each_btree_key_upto(trans, iter, BTREE_ID_xattrs,
SPOS(0, 0, U32_MAX), POS(0, U64_MAX), SPOS(0, 0, U32_MAX), POS(0, U64_MAX),
0, k, ({ 0, k, ({
BUG_ON(k.k->p.offset != i); BUG_ON(k.k->p.offset != i);
@ -274,7 +274,7 @@ static int test_iterate_slots(struct bch_fs *c, u64 nr)
i = 0; i = 0;
ret = for_each_btree_key2_upto(trans, iter, BTREE_ID_xattrs, ret = for_each_btree_key_upto(trans, iter, BTREE_ID_xattrs,
SPOS(0, 0, U32_MAX), POS(0, U64_MAX), SPOS(0, 0, U32_MAX), POS(0, U64_MAX),
BTREE_ITER_SLOTS, k, ({ BTREE_ITER_SLOTS, k, ({
if (i >= nr * 2) if (i >= nr * 2)
@ -326,7 +326,7 @@ static int test_iterate_slots_extents(struct bch_fs *c, u64 nr)
i = 0; i = 0;
ret = for_each_btree_key2_upto(trans, iter, BTREE_ID_extents, ret = for_each_btree_key_upto(trans, iter, BTREE_ID_extents,
SPOS(0, 0, U32_MAX), POS(0, U64_MAX), SPOS(0, 0, U32_MAX), POS(0, U64_MAX),
0, k, ({ 0, k, ({
BUG_ON(bkey_start_offset(k.k) != i + 8); BUG_ON(bkey_start_offset(k.k) != i + 8);
@ -344,7 +344,7 @@ static int test_iterate_slots_extents(struct bch_fs *c, u64 nr)
i = 0; i = 0;
ret = for_each_btree_key2_upto(trans, iter, BTREE_ID_extents, ret = for_each_btree_key_upto(trans, iter, BTREE_ID_extents,
SPOS(0, 0, U32_MAX), POS(0, U64_MAX), SPOS(0, 0, U32_MAX), POS(0, U64_MAX),
BTREE_ITER_SLOTS, k, ({ BTREE_ITER_SLOTS, k, ({
if (i == nr) if (i == nr)
@ -760,7 +760,7 @@ static int seq_lookup(struct bch_fs *c, u64 nr)
struct bkey_s_c k; struct bkey_s_c k;
return bch2_trans_run(c, return bch2_trans_run(c,
for_each_btree_key2_upto(trans, iter, BTREE_ID_xattrs, for_each_btree_key_upto(trans, iter, BTREE_ID_xattrs,
SPOS(0, 0, U32_MAX), POS(0, U64_MAX), SPOS(0, 0, U32_MAX), POS(0, U64_MAX),
0, k, 0, k,
0)); 0));