void bch2_trans_unlock(struct btree_trans *);
bool bch2_trans_locked(struct btree_trans *);
-static inline bool trans_was_restarted(struct btree_trans *trans, u32 restart_count)
+static inline int trans_was_restarted(struct btree_trans *trans, u32 restart_count)
{
- return restart_count != trans->restart_count;
+ return restart_count != trans->restart_count
+ ? -BCH_ERR_transaction_restart_nested
+ : 0;
}
void __noreturn bch2_trans_restart_error(struct btree_trans *, u32);
if (!_ret) \
bch2_trans_verify_not_restarted(_trans, _restart_count);\
\
- if (!_ret && trans_was_restarted(_trans, _orig_restart_count)) \
- _ret = -BCH_ERR_transaction_restart_nested; \
- \
- _ret; \
+ _ret ?: trans_was_restarted(_trans, _restart_count); \
})
#define for_each_btree_key2(_trans, _iter, _btree_id, \
}
bch2_trans_iter_exit(trans, &iter);
- if (!ret && trans_was_restarted(trans, restart_count))
- ret = -BCH_ERR_transaction_restart_nested;
- return ret;
+ return ret ?: trans_was_restarted(trans, restart_count);
}
/*
w->first_this_inode = true;
- if (trans_was_restarted(trans, restart_count))
- return -BCH_ERR_transaction_restart_nested;
-
- return 0;
+ return trans_was_restarted(trans, restart_count);
}
static struct inode_walker_entry *
fsck_err:
if (ret)
bch_err_fn(c, ret);
- if (!ret && trans_was_restarted(trans, restart_count))
- ret = -BCH_ERR_transaction_restart_nested;
- return ret;
+ return ret ?: trans_was_restarted(trans, restart_count);
}
struct extent_end {
fsck_err:
if (ret)
bch_err_fn(c, ret);
- if (!ret && trans_was_restarted(trans, restart_count))
- ret = -BCH_ERR_transaction_restart_nested;
- return ret;
+ return ret ?: trans_was_restarted(trans, restart_count);
}
static int check_dirent_target(struct btree_trans *trans,
{
struct bch_fs *c = trans->c;
struct bkey_buf sk;
+ u32 restart_count = trans->restart_count;
int ret;
bch2_bkey_buf_init(&sk);
}
bch2_bkey_buf_exit(&sk, c);
- return ret;
+
+ return ret ?: trans_was_restarted(trans, restart_count);
}
int bch2_snapshots_read(struct bch_fs *c)