bcachefs: Unlink not-touched iters on successful transaction commit

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2019-03-28 00:32:38 -04:00 committed by Kent Overstreet
parent bf7b87a4a9
commit 4afe700060
2 changed files with 7 additions and 1 deletions

View File

@ -1892,6 +1892,7 @@ int bch2_trans_unlock(struct btree_trans *trans)
inline void bch2_trans_unlink_iters(struct btree_trans *trans, u64 iters) inline void bch2_trans_unlink_iters(struct btree_trans *trans, u64 iters)
{ {
iters &= trans->iters_linked; iters &= trans->iters_linked;
iters &= ~trans->iters_live;
while (iters) { while (iters) {
unsigned idx = __ffs64(iters); unsigned idx = __ffs64(iters);
@ -1919,9 +1920,10 @@ void __bch2_trans_begin(struct btree_trans *trans)
iters_to_unlink |= trans->iters_unlink_on_restart; iters_to_unlink |= trans->iters_unlink_on_restart;
iters_to_unlink |= trans->iters_unlink_on_commit; iters_to_unlink |= trans->iters_unlink_on_commit;
trans->iters_live = 0;
bch2_trans_unlink_iters(trans, iters_to_unlink); bch2_trans_unlink_iters(trans, iters_to_unlink);
trans->iters_live = 0;
trans->iters_touched = 0; trans->iters_touched = 0;
trans->iters_unlink_on_restart = 0; trans->iters_unlink_on_restart = 0;
trans->iters_unlink_on_commit = 0; trans->iters_unlink_on_commit = 0;

View File

@ -856,6 +856,10 @@ out_noupdates:
BUG_ON(!(trans->flags & BTREE_INSERT_ATOMIC) && ret == -EINTR); BUG_ON(!(trans->flags & BTREE_INSERT_ATOMIC) && ret == -EINTR);
bch2_trans_unlink_iters(trans, trans->iters_unlink_on_commit); bch2_trans_unlink_iters(trans, trans->iters_unlink_on_commit);
if (!ret) {
bch2_trans_unlink_iters(trans, ~trans->iters_touched);
trans->iters_touched = 0;
}
trans->nr_updates = 0; trans->nr_updates = 0;
return ret; return ret;