summaryrefslogtreecommitdiff
path: root/libbcachefs/move.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-08-10 20:28:55 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2022-08-11 17:34:34 -0400
commitddac1641ee1e2686c2211a8d671ea723634dfc89 (patch)
tree0596db2376fb5cbdcd83bf1642efdc7868ade480 /libbcachefs/move.c
parenta6128b5335a79cd68b9dbb6b083a835d94539d04 (diff)
Update bcachefs sources to 90a9c61e2b bcachefs: Switch bch2_btree_delete_range() to bch2_trans_run()
Diffstat (limited to 'libbcachefs/move.c')
-rw-r--r--libbcachefs/move.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/libbcachefs/move.c b/libbcachefs/move.c
index 9748b865..2fc24745 100644
--- a/libbcachefs/move.c
+++ b/libbcachefs/move.c
@@ -9,6 +9,7 @@
#include "btree_update_interior.h"
#include "disk_groups.h"
#include "ec.h"
+#include "errcode.h"
#include "error.h"
#include "inode.h"
#include "io.h"
@@ -370,7 +371,7 @@ static int move_get_io_opts(struct btree_trans *trans,
ret = lookup_inode(trans,
SPOS(0, k.k->p.inode, k.k->p.snapshot),
&inode);
- if (ret == -EINTR)
+ if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
return ret;
if (!ret)
@@ -418,7 +419,7 @@ static int __bch2_move_data(struct moving_context *ctxt,
break;
ret = bkey_err(k);
- if (ret == -EINTR)
+ if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
continue;
if (ret)
break;
@@ -449,7 +450,7 @@ static int __bch2_move_data(struct moving_context *ctxt,
ret2 = bch2_move_extent(&trans, ctxt, io_opts,
btree_id, k, data_opts);
if (ret2) {
- if (ret2 == -EINTR)
+ if (bch2_err_matches(ret2, BCH_ERR_transaction_restart))
continue;
if (ret2 == -ENOMEM) {
@@ -574,7 +575,7 @@ int __bch2_evacuate_bucket(struct moving_context *ctxt,
ret = bch2_get_next_backpointer(&trans, bucket, gen,
&bp_offset, &bp);
- if (ret == -EINTR)
+ if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
continue;
if (ret)
goto err;
@@ -589,7 +590,7 @@ int __bch2_evacuate_bucket(struct moving_context *ctxt,
k = bch2_backpointer_get_key(&trans, &iter,
bucket, bp_offset, bp);
ret = bkey_err(k);
- if (ret == -EINTR)
+ if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
continue;
if (ret)
goto err;
@@ -616,7 +617,7 @@ int __bch2_evacuate_bucket(struct moving_context *ctxt,
ret = bch2_move_extent(&trans, ctxt, io_opts,
bp.btree_id, k, data_opts);
- if (ret == -EINTR)
+ if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
continue;
if (ret == -ENOMEM) {
/* memory allocation failure, wait for some IO to finish */
@@ -635,7 +636,7 @@ int __bch2_evacuate_bucket(struct moving_context *ctxt,
b = bch2_backpointer_get_node(&trans, &iter,
bucket, bp_offset, bp);
ret = PTR_ERR_OR_ZERO(b);
- if (ret == -EINTR)
+ if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
continue;
if (ret)
goto err;
@@ -645,7 +646,7 @@ int __bch2_evacuate_bucket(struct moving_context *ctxt,
ret = bch2_btree_node_rewrite(&trans, &iter, b, 0);
bch2_trans_iter_exit(&trans, &iter);
- if (ret == -EINTR)
+ if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
continue;
if (ret)
goto err;
@@ -740,14 +741,14 @@ retry:
goto next;
ret = bch2_btree_node_rewrite(&trans, &iter, b, 0) ?: ret;
- if (ret == -EINTR)
+ if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
continue;
if (ret)
break;
next:
bch2_btree_iter_next_node(&iter);
}
- if (ret == -EINTR)
+ if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
goto retry;
bch2_trans_iter_exit(&trans, &iter);
@@ -759,7 +760,7 @@ next:
bch2_trans_exit(&trans);
if (ret)
- bch_err(c, "error %i in bch2_move_btree", ret);
+ bch_err(c, "error in %s(): %s", __func__, bch2_err_str(ret));
bch2_btree_interior_updates_flush(c);