mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-22 00:00:03 +03:00
Update bcachefs sources to 1336a995cbc3 bcachefs: Silence transaction restart error message
This commit is contained in:
parent
6e8f2857af
commit
1e358401ec
@ -1 +1 @@
|
|||||||
f9c612bbf82da87d7d4a005310c5213db00e22de
|
1336a995cbc3a575002ed517c4d27c847ecb6496
|
||||||
|
@ -971,10 +971,10 @@ static int check_inode(struct btree_trans *trans,
|
|||||||
|
|
||||||
if (do_update) {
|
if (do_update) {
|
||||||
ret = __write_inode(trans, &u, iter->pos.snapshot);
|
ret = __write_inode(trans, &u, iter->pos.snapshot);
|
||||||
if (ret) {
|
if (ret && !bch2_err_matches(ret, BCH_ERR_transaction_restart))
|
||||||
bch_err_msg(c, ret, "in fsck updating inode");
|
bch_err_msg(c, ret, "in fsck updating inode");
|
||||||
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
err:
|
err:
|
||||||
fsck_err:
|
fsck_err:
|
||||||
|
@ -1376,10 +1376,12 @@ err_get_ioref:
|
|||||||
/* Fall back to COW path: */
|
/* Fall back to COW path: */
|
||||||
goto out;
|
goto out;
|
||||||
err_bucket_stale:
|
err_bucket_stale:
|
||||||
while (--i >= 0)
|
while (i >= 0) {
|
||||||
bch2_bucket_nocow_unlock(&c->nocow_locks,
|
bch2_bucket_nocow_unlock(&c->nocow_locks,
|
||||||
buckets[i].b,
|
buckets[i].b,
|
||||||
BUCKET_NOCOW_LOCK_UPDATE);
|
BUCKET_NOCOW_LOCK_UPDATE);
|
||||||
|
--i;
|
||||||
|
}
|
||||||
for (i = 0; i < nr_buckets; i++)
|
for (i = 0; i < nr_buckets; i++)
|
||||||
percpu_ref_put(&bch_dev_bkey_exists(c, buckets[i].b.inode)->io_ref);
|
percpu_ref_put(&bch_dev_bkey_exists(c, buckets[i].b.inode)->io_ref);
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "io_misc.h"
|
#include "io_misc.h"
|
||||||
#include "logged_ops.h"
|
#include "logged_ops.h"
|
||||||
|
#include "super.h"
|
||||||
|
|
||||||
struct bch_logged_op_fn {
|
struct bch_logged_op_fn {
|
||||||
u8 type;
|
u8 type;
|
||||||
@ -44,7 +45,8 @@ static int resume_logged_op(struct btree_trans *trans, struct btree_iter *iter,
|
|||||||
bch2_bkey_buf_init(&sk);
|
bch2_bkey_buf_init(&sk);
|
||||||
bch2_bkey_buf_reassemble(&sk, c, k);
|
bch2_bkey_buf_reassemble(&sk, c, k);
|
||||||
|
|
||||||
ret = fn->resume(trans, sk.k) ?: trans_was_restarted(trans, restart_count);
|
ret = drop_locks_do(trans, (bch2_fs_lazy_rw(c), 0)) ?:
|
||||||
|
fn->resume(trans, sk.k) ?: trans_was_restarted(trans, restart_count);
|
||||||
|
|
||||||
bch2_bkey_buf_exit(&sk, c);
|
bch2_bkey_buf_exit(&sk, c);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
#include "bcachefs.h"
|
#include "bcachefs.h"
|
||||||
|
#include "bkey_methods.h"
|
||||||
#include "nocow_locking.h"
|
#include "nocow_locking.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
@ -29,9 +30,10 @@ void bch2_bucket_nocow_unlock(struct bucket_nocow_lock_table *t, struct bpos buc
|
|||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(l->b); i++)
|
for (i = 0; i < ARRAY_SIZE(l->b); i++)
|
||||||
if (l->b[i] == dev_bucket) {
|
if (l->b[i] == dev_bucket) {
|
||||||
BUG_ON(sign(atomic_read(&l->l[i])) != lock_val);
|
int v = atomic_sub_return(lock_val, &l->l[i]);
|
||||||
|
|
||||||
if (!atomic_sub_return(lock_val, &l->l[i]))
|
BUG_ON(v && sign(v) != lock_val);
|
||||||
|
if (!v)
|
||||||
closure_wake_up(&l->wait);
|
closure_wake_up(&l->wait);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -64,6 +66,11 @@ got_entry:
|
|||||||
if (lock_val > 0 ? v < 0 : v > 0)
|
if (lock_val > 0 ? v < 0 : v > 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
take_lock:
|
take_lock:
|
||||||
|
v = atomic_read(&l->l[i]);
|
||||||
|
/* Overflow? */
|
||||||
|
if (v && sign(v + lock_val) != sign(v))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
atomic_add(lock_val, &l->l[i]);
|
atomic_add(lock_val, &l->l[i]);
|
||||||
spin_unlock(&l->lock);
|
spin_unlock(&l->lock);
|
||||||
return true;
|
return true;
|
||||||
@ -83,6 +90,7 @@ void __bch2_bucket_nocow_lock(struct bucket_nocow_lock_table *t,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void bch2_nocow_locks_to_text(struct printbuf *out, struct bucket_nocow_lock_table *t)
|
void bch2_nocow_locks_to_text(struct printbuf *out, struct bucket_nocow_lock_table *t)
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned i, nr_zero = 0;
|
unsigned i, nr_zero = 0;
|
||||||
struct nocow_lock_bucket *l;
|
struct nocow_lock_bucket *l;
|
||||||
@ -102,9 +110,13 @@ void bch2_nocow_locks_to_text(struct printbuf *out, struct bucket_nocow_lock_tab
|
|||||||
prt_printf(out, "(%u empty entries)\n", nr_zero);
|
prt_printf(out, "(%u empty entries)\n", nr_zero);
|
||||||
nr_zero = 0;
|
nr_zero = 0;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(l->l); i++)
|
for (i = 0; i < ARRAY_SIZE(l->l); i++) {
|
||||||
if (atomic_read(&l->l[i]))
|
int v = atomic_read(&l->l[i]);
|
||||||
prt_printf(out, "%llu: %i ", l->b[i], atomic_read(&l->l[i]));
|
if (v) {
|
||||||
|
bch2_bpos_to_text(out, u64_to_bucket(l->b[i]));
|
||||||
|
prt_printf(out, ": %s %u ", v < 0 ? "copy" : "update", abs(v));
|
||||||
|
}
|
||||||
|
}
|
||||||
prt_newline(out);
|
prt_newline(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,12 +124,21 @@ void bch2_nocow_locks_to_text(struct printbuf *out, struct bucket_nocow_lock_tab
|
|||||||
prt_printf(out, "(%u empty entries)\n", nr_zero);
|
prt_printf(out, "(%u empty entries)\n", nr_zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bch2_fs_nocow_locking_exit(struct bch_fs *c)
|
||||||
|
{
|
||||||
|
struct bucket_nocow_lock_table *t = &c->nocow_locks;
|
||||||
|
|
||||||
|
for (struct nocow_lock_bucket *l = t->l; l < t->l + ARRAY_SIZE(t->l); l++)
|
||||||
|
for (unsigned j = 0; j < ARRAY_SIZE(l->l); j++)
|
||||||
|
BUG_ON(atomic_read(&l->l[j]));
|
||||||
|
}
|
||||||
|
|
||||||
int bch2_fs_nocow_locking_init(struct bch_fs *c)
|
int bch2_fs_nocow_locking_init(struct bch_fs *c)
|
||||||
{
|
{
|
||||||
unsigned i;
|
struct bucket_nocow_lock_table *t = &c->nocow_locks;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(c->nocow_locks.l); i++)
|
for (struct nocow_lock_bucket *l = t->l; l < t->l + ARRAY_SIZE(t->l); l++)
|
||||||
spin_lock_init(&c->nocow_locks.l[i].lock);
|
spin_lock_init(&l->lock);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ static inline bool bch2_bucket_nocow_trylock(struct bucket_nocow_lock_table *t,
|
|||||||
|
|
||||||
void bch2_nocow_locks_to_text(struct printbuf *, struct bucket_nocow_lock_table *);
|
void bch2_nocow_locks_to_text(struct printbuf *, struct bucket_nocow_lock_table *);
|
||||||
|
|
||||||
|
void bch2_fs_nocow_locking_exit(struct bch_fs *);
|
||||||
int bch2_fs_nocow_locking_init(struct bch_fs *);
|
int bch2_fs_nocow_locking_init(struct bch_fs *);
|
||||||
|
|
||||||
#endif /* _BCACHEFS_NOCOW_LOCKING_H */
|
#endif /* _BCACHEFS_NOCOW_LOCKING_H */
|
||||||
|
@ -24,12 +24,12 @@
|
|||||||
x(check_alloc_to_lru_refs, PASS_FSCK) \
|
x(check_alloc_to_lru_refs, PASS_FSCK) \
|
||||||
x(fs_freespace_init, PASS_ALWAYS|PASS_SILENT) \
|
x(fs_freespace_init, PASS_ALWAYS|PASS_SILENT) \
|
||||||
x(bucket_gens_init, 0) \
|
x(bucket_gens_init, 0) \
|
||||||
x(resume_logged_ops, PASS_ALWAYS) \
|
|
||||||
x(check_snapshot_trees, PASS_FSCK) \
|
x(check_snapshot_trees, PASS_FSCK) \
|
||||||
x(check_snapshots, PASS_FSCK) \
|
x(check_snapshots, PASS_FSCK) \
|
||||||
x(check_subvols, PASS_FSCK) \
|
x(check_subvols, PASS_FSCK) \
|
||||||
x(delete_dead_snapshots, PASS_FSCK|PASS_UNCLEAN) \
|
x(delete_dead_snapshots, PASS_FSCK|PASS_UNCLEAN) \
|
||||||
x(fs_upgrade_for_subvolumes, 0) \
|
x(fs_upgrade_for_subvolumes, 0) \
|
||||||
|
x(resume_logged_ops, PASS_ALWAYS) \
|
||||||
x(check_inodes, PASS_FSCK) \
|
x(check_inodes, PASS_FSCK) \
|
||||||
x(check_extents, PASS_FSCK) \
|
x(check_extents, PASS_FSCK) \
|
||||||
x(check_dirents, PASS_FSCK) \
|
x(check_dirents, PASS_FSCK) \
|
||||||
|
@ -484,6 +484,7 @@ static void __bch2_fs_free(struct bch_fs *c)
|
|||||||
bch2_fs_fsio_exit(c);
|
bch2_fs_fsio_exit(c);
|
||||||
bch2_fs_ec_exit(c);
|
bch2_fs_ec_exit(c);
|
||||||
bch2_fs_encryption_exit(c);
|
bch2_fs_encryption_exit(c);
|
||||||
|
bch2_fs_nocow_locking_exit(c);
|
||||||
bch2_fs_io_write_exit(c);
|
bch2_fs_io_write_exit(c);
|
||||||
bch2_fs_io_read_exit(c);
|
bch2_fs_io_read_exit(c);
|
||||||
bch2_fs_buckets_waiting_for_journal_exit(c);
|
bch2_fs_buckets_waiting_for_journal_exit(c);
|
||||||
|
Loading…
Reference in New Issue
Block a user