mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-23 00:00:02 +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,
|
unsigned update_flags,
|
||||||
u64 *journal_seq)
|
u64 *journal_seq)
|
||||||
{
|
{
|
||||||
|
u32 restart_count = trans->restart_count;
|
||||||
struct btree_iter iter;
|
struct btree_iter iter;
|
||||||
struct bkey_s_c k;
|
struct bkey_s_c k;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
bch2_trans_iter_init(trans, &iter, id, start, BTREE_ITER_INTENT);
|
bch2_trans_iter_init(trans, &iter, id, start, BTREE_ITER_INTENT);
|
||||||
retry:
|
retry:
|
||||||
while ((bch2_trans_begin(trans),
|
while ((k = bch2_btree_iter_peek(&iter)).k &&
|
||||||
(k = bch2_btree_iter_peek(&iter)).k) &&
|
!(ret = bkey_err(k) ?:
|
||||||
!(ret = bkey_err(k)) &&
|
btree_trans_too_many_iters(trans)) &&
|
||||||
bkey_cmp(iter.pos, end) < 0) {
|
bkey_cmp(iter.pos, end) < 0) {
|
||||||
struct disk_reservation disk_res =
|
struct disk_reservation disk_res =
|
||||||
bch2_disk_reservation_init(trans->c, 0);
|
bch2_disk_reservation_init(trans->c, 0);
|
||||||
@ -1747,11 +1748,15 @@ retry:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bch2_err_matches(ret, BCH_ERR_transaction_restart)) {
|
if (bch2_err_matches(ret, BCH_ERR_transaction_restart)) {
|
||||||
|
bch2_trans_begin(trans);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
||||||
bch2_trans_iter_exit(trans, &iter);
|
bch2_trans_iter_exit(trans, &iter);
|
||||||
|
|
||||||
|
if (!ret && trans_was_restarted(trans, restart_count))
|
||||||
|
ret = -BCH_ERR_transaction_restart_nested;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1765,8 +1770,12 @@ int bch2_btree_delete_range(struct bch_fs *c, enum btree_id id,
|
|||||||
unsigned update_flags,
|
unsigned update_flags,
|
||||||
u64 *journal_seq)
|
u64 *journal_seq)
|
||||||
{
|
{
|
||||||
return bch2_trans_run(c,
|
int ret = bch2_trans_run(c,
|
||||||
bch2_btree_delete_range_trans(&trans, id, start, end, update_flags, journal_seq));
|
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)
|
int bch2_trans_log_msg(struct btree_trans *trans, const char *msg)
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
|
|
||||||
#define QSTR(n) { { { .len = strlen(n) } }, .name = n }
|
#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,
|
static s64 bch2_count_inode_sectors(struct btree_trans *trans, u64 inum,
|
||||||
u32 snapshot)
|
u32 snapshot)
|
||||||
{
|
{
|
||||||
@ -239,6 +243,7 @@ static int fsck_inode_rm(struct btree_trans *trans, u64 inum, u32 snapshot)
|
|||||||
struct bkey_s_c k;
|
struct bkey_s_c k;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
do {
|
||||||
ret = bch2_btree_delete_range_trans(trans, BTREE_ID_extents,
|
ret = bch2_btree_delete_range_trans(trans, BTREE_ID_extents,
|
||||||
SPOS(inum, 0, snapshot),
|
SPOS(inum, 0, snapshot),
|
||||||
SPOS(inum, U64_MAX, snapshot),
|
SPOS(inum, U64_MAX, snapshot),
|
||||||
@ -251,6 +256,7 @@ static int fsck_inode_rm(struct btree_trans *trans, u64 inum, u32 snapshot)
|
|||||||
SPOS(inum, 0, snapshot),
|
SPOS(inum, 0, snapshot),
|
||||||
SPOS(inum, U64_MAX, snapshot),
|
SPOS(inum, U64_MAX, snapshot),
|
||||||
0, NULL);
|
0, NULL);
|
||||||
|
} while (ret == -BCH_ERR_transaction_restart_nested);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err;
|
goto err;
|
||||||
retry:
|
retry:
|
||||||
|
Loading…
Reference in New Issue
Block a user