mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-17 13:58:46 +00:00
bcachefs: trans_for_each_update() now declares loop iter
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
cee0a8ea6d
commit
559e6c2336
@ -648,7 +648,6 @@ void bch2_btree_path_level_init(struct btree_trans *trans,
|
||||
static void bch2_trans_revalidate_updates_in_node(struct btree_trans *trans, struct btree *b)
|
||||
{
|
||||
struct bch_fs *c = trans->c;
|
||||
struct btree_insert_entry *i;
|
||||
|
||||
trans_for_each_update(trans, i)
|
||||
if (!i->cached &&
|
||||
@ -1369,8 +1368,6 @@ void __noreturn bch2_trans_in_restart_error(struct btree_trans *trans)
|
||||
noinline __cold
|
||||
void bch2_trans_updates_to_text(struct printbuf *buf, struct btree_trans *trans)
|
||||
{
|
||||
struct btree_insert_entry *i;
|
||||
|
||||
prt_printf(buf, "transaction updates for %s journal seq %llu",
|
||||
trans->fn, trans->journal_res.seq);
|
||||
prt_newline(buf);
|
||||
@ -1840,7 +1837,6 @@ inline bool bch2_btree_iter_rewind(struct btree_iter *iter)
|
||||
static noinline
|
||||
struct bkey_i *__bch2_btree_trans_peek_updates(struct btree_iter *iter)
|
||||
{
|
||||
struct btree_insert_entry *i;
|
||||
struct bkey_i *ret = NULL;
|
||||
|
||||
trans_for_each_update(iter->trans, i) {
|
||||
@ -2975,7 +2971,6 @@ leaked:
|
||||
void bch2_trans_put(struct btree_trans *trans)
|
||||
__releases(&c->btree_trans_barrier)
|
||||
{
|
||||
struct btree_insert_entry *i;
|
||||
struct bch_fs *c = trans->c;
|
||||
struct btree_transaction_stats *s = btree_trans_stats(trans);
|
||||
|
||||
|
@ -93,8 +93,6 @@ static noinline int trans_lock_write_fail(struct btree_trans *trans, struct btre
|
||||
|
||||
static inline int bch2_trans_lock_write(struct btree_trans *trans)
|
||||
{
|
||||
struct btree_insert_entry *i;
|
||||
|
||||
EBUG_ON(trans->write_locked);
|
||||
|
||||
trans_for_each_update(trans, i) {
|
||||
@ -115,8 +113,6 @@ static inline int bch2_trans_lock_write(struct btree_trans *trans)
|
||||
static inline void bch2_trans_unlock_write(struct btree_trans *trans)
|
||||
{
|
||||
if (likely(trans->write_locked)) {
|
||||
struct btree_insert_entry *i;
|
||||
|
||||
trans_for_each_update(trans, i)
|
||||
if (!same_leaf_as_prev(trans, i))
|
||||
bch2_btree_node_unlock_write_inlined(trans, i->path,
|
||||
@ -361,7 +357,6 @@ noinline static int
|
||||
btree_key_can_insert_cached_slowpath(struct btree_trans *trans, unsigned flags,
|
||||
struct btree_path *path, unsigned new_u64s)
|
||||
{
|
||||
struct btree_insert_entry *i;
|
||||
struct bkey_cached *ck = (void *) path->l[0].b;
|
||||
struct bkey_i *new_k;
|
||||
int ret;
|
||||
@ -400,7 +395,6 @@ static int btree_key_can_insert_cached(struct btree_trans *trans, unsigned flags
|
||||
{
|
||||
struct bch_fs *c = trans->c;
|
||||
struct bkey_cached *ck = (void *) path->l[0].b;
|
||||
struct btree_insert_entry *i;
|
||||
unsigned new_u64s;
|
||||
struct bkey_i *new_k;
|
||||
|
||||
@ -550,7 +544,7 @@ static int run_btree_triggers(struct btree_trans *trans, enum btree_id btree_id,
|
||||
|
||||
static int bch2_trans_commit_run_triggers(struct btree_trans *trans)
|
||||
{
|
||||
struct btree_insert_entry *i = NULL, *btree_id_start = trans->updates;
|
||||
struct btree_insert_entry *btree_id_start = trans->updates;
|
||||
unsigned btree_id = 0;
|
||||
int ret = 0;
|
||||
|
||||
@ -597,7 +591,6 @@ static int bch2_trans_commit_run_triggers(struct btree_trans *trans)
|
||||
static noinline int bch2_trans_commit_run_gc_triggers(struct btree_trans *trans)
|
||||
{
|
||||
struct bch_fs *c = trans->c;
|
||||
struct btree_insert_entry *i;
|
||||
int ret = 0;
|
||||
|
||||
trans_for_each_update(trans, i) {
|
||||
@ -623,7 +616,6 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags,
|
||||
unsigned long trace_ip)
|
||||
{
|
||||
struct bch_fs *c = trans->c;
|
||||
struct btree_insert_entry *i;
|
||||
struct btree_trans_commit_hook *h;
|
||||
unsigned u64s = 0;
|
||||
int ret;
|
||||
@ -775,8 +767,6 @@ revert_fs_usage:
|
||||
|
||||
static noinline void bch2_drop_overwrites_from_journal(struct btree_trans *trans)
|
||||
{
|
||||
struct btree_insert_entry *i;
|
||||
|
||||
trans_for_each_update(trans, i)
|
||||
bch2_journal_key_overwritten(trans->c, i->btree_id, i->level, i->k->k.p);
|
||||
}
|
||||
@ -820,7 +810,6 @@ static inline int do_bch2_trans_commit(struct btree_trans *trans, unsigned flags
|
||||
unsigned long trace_ip)
|
||||
{
|
||||
struct bch_fs *c = trans->c;
|
||||
struct btree_insert_entry *i;
|
||||
int ret = 0, u64s_delta = 0;
|
||||
|
||||
trans_for_each_update(trans, i) {
|
||||
@ -964,7 +953,6 @@ static noinline int
|
||||
do_bch2_trans_commit_to_journal_replay(struct btree_trans *trans)
|
||||
{
|
||||
struct bch_fs *c = trans->c;
|
||||
struct btree_insert_entry *i;
|
||||
int ret = 0;
|
||||
|
||||
trans_for_each_update(trans, i) {
|
||||
@ -978,8 +966,8 @@ do_bch2_trans_commit_to_journal_replay(struct btree_trans *trans)
|
||||
|
||||
int __bch2_trans_commit(struct btree_trans *trans, unsigned flags)
|
||||
{
|
||||
struct btree_insert_entry *errored_at = NULL;
|
||||
struct bch_fs *c = trans->c;
|
||||
struct btree_insert_entry *i = NULL;
|
||||
int ret = 0;
|
||||
|
||||
if (!trans->nr_updates &&
|
||||
@ -1058,11 +1046,12 @@ int __bch2_trans_commit(struct btree_trans *trans, unsigned flags)
|
||||
goto err;
|
||||
}
|
||||
retry:
|
||||
errored_at = NULL;
|
||||
bch2_trans_verify_not_in_restart(trans);
|
||||
if (likely(!(flags & BCH_TRANS_COMMIT_no_journal_res)))
|
||||
memset(&trans->journal_res, 0, sizeof(trans->journal_res));
|
||||
|
||||
ret = do_bch2_trans_commit(trans, flags, &i, _RET_IP_);
|
||||
ret = do_bch2_trans_commit(trans, flags, &errored_at, _RET_IP_);
|
||||
|
||||
/* make sure we didn't drop or screw up locks: */
|
||||
bch2_trans_verify_locks(trans);
|
||||
@ -1081,7 +1070,7 @@ out_reset:
|
||||
|
||||
return ret;
|
||||
err:
|
||||
ret = bch2_trans_commit_error(trans, flags, i, ret, _RET_IP_);
|
||||
ret = bch2_trans_commit_error(trans, flags, errored_at, ret, _RET_IP_);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
|
@ -408,7 +408,7 @@ bch2_trans_update_by_path(struct btree_trans *trans, struct btree_path *path,
|
||||
* Pending updates are kept sorted: first, find position of new update,
|
||||
* then delete/trim any updates the new update overwrites:
|
||||
*/
|
||||
trans_for_each_update(trans, i) {
|
||||
for (i = trans->updates; i < trans->updates + trans->nr_updates; i++) {
|
||||
cmp = btree_insert_entry_cmp(&n, i);
|
||||
if (cmp <= 0)
|
||||
break;
|
||||
|
@ -187,14 +187,12 @@ static inline int bch2_trans_commit(struct btree_trans *trans,
|
||||
bch2_trans_run(_c, commit_do(trans, _disk_res, _journal_seq, _flags, _do))
|
||||
|
||||
#define trans_for_each_update(_trans, _i) \
|
||||
for ((_i) = (_trans)->updates; \
|
||||
for (struct btree_insert_entry *_i = (_trans)->updates; \
|
||||
(_i) < (_trans)->updates + (_trans)->nr_updates; \
|
||||
(_i)++)
|
||||
|
||||
static inline void bch2_trans_reset_updates(struct btree_trans *trans)
|
||||
{
|
||||
struct btree_insert_entry *i;
|
||||
|
||||
trans_for_each_update(trans, i)
|
||||
bch2_path_put(trans, i->path, true);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user