mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-22 00:00:03 +03:00
Update bcachefs sources to 3421116a6c bcachefs: bch2_btree_delete_range_trans() now returns -BCH_ERR_transaction_restart_nested
This commit is contained in:
parent
dded444b20
commit
c4ddc63aec
@ -1 +1 @@
|
||||
dfaf9a6ee24f5c415635f9a75f5281f385535ebd
|
||||
3421116a6c137a36963cfe93c485f48ccd8802b9
|
||||
|
@ -1693,15 +1693,16 @@ int bch2_btree_delete_range_trans(struct btree_trans *trans, enum btree_id id,
|
||||
unsigned update_flags,
|
||||
u64 *journal_seq)
|
||||
{
|
||||
u32 restart_count = trans->restart_count;
|
||||
struct btree_iter iter;
|
||||
struct bkey_s_c k;
|
||||
int ret = 0;
|
||||
|
||||
bch2_trans_iter_init(trans, &iter, id, start, BTREE_ITER_INTENT);
|
||||
retry:
|
||||
while ((bch2_trans_begin(trans),
|
||||
(k = bch2_btree_iter_peek(&iter)).k) &&
|
||||
!(ret = bkey_err(k)) &&
|
||||
while ((k = bch2_btree_iter_peek(&iter)).k &&
|
||||
!(ret = bkey_err(k) ?:
|
||||
btree_trans_too_many_iters(trans)) &&
|
||||
bkey_cmp(iter.pos, end) < 0) {
|
||||
struct disk_reservation disk_res =
|
||||
bch2_disk_reservation_init(trans->c, 0);
|
||||
@ -1747,11 +1748,15 @@ retry:
|
||||
}
|
||||
|
||||
if (bch2_err_matches(ret, BCH_ERR_transaction_restart)) {
|
||||
bch2_trans_begin(trans);
|
||||
ret = 0;
|
||||
goto retry;
|
||||
}
|
||||
|
||||
bch2_trans_iter_exit(trans, &iter);
|
||||
|
||||
if (!ret && trans_was_restarted(trans, restart_count))
|
||||
ret = -BCH_ERR_transaction_restart_nested;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1765,8 +1770,12 @@ int bch2_btree_delete_range(struct bch_fs *c, enum btree_id id,
|
||||
unsigned update_flags,
|
||||
u64 *journal_seq)
|
||||
{
|
||||
return bch2_trans_run(c,
|
||||
bch2_btree_delete_range_trans(&trans, id, start, end, update_flags, journal_seq));
|
||||
int ret = bch2_trans_run(c,
|
||||
bch2_btree_delete_range_trans(&trans, id, start, end,
|
||||
update_flags, journal_seq));
|
||||
if (ret == -BCH_ERR_transaction_restart_nested)
|
||||
ret = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int bch2_trans_log_msg(struct btree_trans *trans, const char *msg)
|
||||
|
@ -19,6 +19,10 @@
|
||||
|
||||
#define QSTR(n) { { { .len = strlen(n) } }, .name = n }
|
||||
|
||||
/*
|
||||
* XXX: this is handling transaction restarts without returning
|
||||
* -BCH_ERR_transaction_restart_nested, this is not how we do things anymore:
|
||||
*/
|
||||
static s64 bch2_count_inode_sectors(struct btree_trans *trans, u64 inum,
|
||||
u32 snapshot)
|
||||
{
|
||||
@ -239,18 +243,20 @@ static int fsck_inode_rm(struct btree_trans *trans, u64 inum, u32 snapshot)
|
||||
struct bkey_s_c k;
|
||||
int ret;
|
||||
|
||||
ret = bch2_btree_delete_range_trans(trans, BTREE_ID_extents,
|
||||
SPOS(inum, 0, snapshot),
|
||||
SPOS(inum, U64_MAX, snapshot),
|
||||
0, NULL) ?:
|
||||
bch2_btree_delete_range_trans(trans, BTREE_ID_dirents,
|
||||
SPOS(inum, 0, snapshot),
|
||||
SPOS(inum, U64_MAX, snapshot),
|
||||
0, NULL) ?:
|
||||
bch2_btree_delete_range_trans(trans, BTREE_ID_xattrs,
|
||||
SPOS(inum, 0, snapshot),
|
||||
SPOS(inum, U64_MAX, snapshot),
|
||||
0, NULL);
|
||||
do {
|
||||
ret = bch2_btree_delete_range_trans(trans, BTREE_ID_extents,
|
||||
SPOS(inum, 0, snapshot),
|
||||
SPOS(inum, U64_MAX, snapshot),
|
||||
0, NULL) ?:
|
||||
bch2_btree_delete_range_trans(trans, BTREE_ID_dirents,
|
||||
SPOS(inum, 0, snapshot),
|
||||
SPOS(inum, U64_MAX, snapshot),
|
||||
0, NULL) ?:
|
||||
bch2_btree_delete_range_trans(trans, BTREE_ID_xattrs,
|
||||
SPOS(inum, 0, snapshot),
|
||||
SPOS(inum, U64_MAX, snapshot),
|
||||
0, NULL);
|
||||
} while (ret == -BCH_ERR_transaction_restart_nested);
|
||||
if (ret)
|
||||
goto err;
|
||||
retry:
|
||||
|
Loading…
Reference in New Issue
Block a user