mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-12-08 00:00:12 +03:00
Update bcachefs sources to d99ec3f1cfe0 bcachefs: kill CONFIG_BCACHEFS_ASYNC_OBJECT_LISTS
Some checks failed
build / bcachefs-tools-msrv (push) Has been cancelled
.deb build orchestrator / source-only (push) Has been cancelled
.deb build orchestrator / obs (push) Has been cancelled
.deb build orchestrator / buildd (map[name:debian version:forky], map[build-arch:amd64 host-arch:amd64 machine-arch:amd64 runs-on:ubuntu-24.04]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:debian version:forky], map[build-arch:amd64 host-arch:ppc64el machine-arch:amd64 runs-on:ubuntu-24.04]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:debian version:forky], map[build-arch:arm64 host-arch:arm64 machine-arch:arm64 runs-on:ubuntu-24.04-arm]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:debian version:trixie], map[build-arch:amd64 host-arch:amd64 machine-arch:amd64 runs-on:ubuntu-24.04]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:debian version:trixie], map[build-arch:amd64 host-arch:ppc64el machine-arch:amd64 runs-on:ubuntu-24.04]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:debian version:trixie], map[build-arch:arm64 host-arch:arm64 machine-arch:arm64 runs-on:ubuntu-24.04-arm]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:debian version:unstable], map[build-arch:amd64 host-arch:amd64 machine-arch:amd64 runs-on:ubuntu-24.04]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:debian version:unstable], map[build-arch:amd64 host-arch:ppc64el machine-arch:amd64 runs-on:ubuntu-24.04]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:debian version:unstable], map[build-arch:arm64 host-arch:arm64 machine-arch:arm64 runs-on:ubuntu-24.04-arm]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:ubuntu version:plucky], map[build-arch:amd64 host-arch:amd64 machine-arch:amd64 runs-on:ubuntu-24.04]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:ubuntu version:plucky], map[build-arch:arm64 host-arch:arm64 machine-arch:arm64 runs-on:ubuntu-24.04-arm]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:ubuntu version:questing], map[build-arch:amd64 host-arch:amd64 machine-arch:amd64 runs-on:ubuntu-24.04]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:ubuntu version:questing], map[build-arch:arm64 host-arch:arm64 machine-arch:arm64 runs-on:ubuntu-24.04-arm]) (push) Has been cancelled
.deb build orchestrator / reprotest (push) Has been cancelled
.deb build orchestrator / publish (push) Has been cancelled
Nix Flake actions / nix-matrix (push) Has been cancelled
Nix Flake actions / ${{ matrix.name }} (${{ matrix.system }}) (push) Has been cancelled
Some checks failed
build / bcachefs-tools-msrv (push) Has been cancelled
.deb build orchestrator / source-only (push) Has been cancelled
.deb build orchestrator / obs (push) Has been cancelled
.deb build orchestrator / buildd (map[name:debian version:forky], map[build-arch:amd64 host-arch:amd64 machine-arch:amd64 runs-on:ubuntu-24.04]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:debian version:forky], map[build-arch:amd64 host-arch:ppc64el machine-arch:amd64 runs-on:ubuntu-24.04]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:debian version:forky], map[build-arch:arm64 host-arch:arm64 machine-arch:arm64 runs-on:ubuntu-24.04-arm]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:debian version:trixie], map[build-arch:amd64 host-arch:amd64 machine-arch:amd64 runs-on:ubuntu-24.04]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:debian version:trixie], map[build-arch:amd64 host-arch:ppc64el machine-arch:amd64 runs-on:ubuntu-24.04]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:debian version:trixie], map[build-arch:arm64 host-arch:arm64 machine-arch:arm64 runs-on:ubuntu-24.04-arm]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:debian version:unstable], map[build-arch:amd64 host-arch:amd64 machine-arch:amd64 runs-on:ubuntu-24.04]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:debian version:unstable], map[build-arch:amd64 host-arch:ppc64el machine-arch:amd64 runs-on:ubuntu-24.04]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:debian version:unstable], map[build-arch:arm64 host-arch:arm64 machine-arch:arm64 runs-on:ubuntu-24.04-arm]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:ubuntu version:plucky], map[build-arch:amd64 host-arch:amd64 machine-arch:amd64 runs-on:ubuntu-24.04]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:ubuntu version:plucky], map[build-arch:arm64 host-arch:arm64 machine-arch:arm64 runs-on:ubuntu-24.04-arm]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:ubuntu version:questing], map[build-arch:amd64 host-arch:amd64 machine-arch:amd64 runs-on:ubuntu-24.04]) (push) Has been cancelled
.deb build orchestrator / buildd (map[name:ubuntu version:questing], map[build-arch:arm64 host-arch:arm64 machine-arch:arm64 runs-on:ubuntu-24.04-arm]) (push) Has been cancelled
.deb build orchestrator / reprotest (push) Has been cancelled
.deb build orchestrator / publish (push) Has been cancelled
Nix Flake actions / nix-matrix (push) Has been cancelled
Nix Flake actions / ${{ matrix.name }} (${{ matrix.system }}) (push) Has been cancelled
This commit is contained in:
parent
1f990548a2
commit
de22048b52
@ -1 +1 @@
|
||||
18e4f70c7ff5ef0cd80aab0c1786bd68fd386779
|
||||
d99ec3f1cfe0323eaa83fea048bdc1c0458c8e43
|
||||
|
||||
@ -96,10 +96,6 @@ config BCACHEFS_TRANS_KMALLOC_TRACE
|
||||
bool "Trace bch2_trans_kmalloc() calls"
|
||||
depends on BCACHEFS_FS
|
||||
|
||||
config BCACHEFS_ASYNC_OBJECT_LISTS
|
||||
bool "Keep async objects on fast_lists for debugfs visibility"
|
||||
depends on BCACHEFS_FS && DEBUG_FS
|
||||
|
||||
config MEAN_AND_VARIANCE_UNIT_TEST
|
||||
tristate "mean_and_variance unit tests" if !KUNIT_ALL_TESTS
|
||||
depends on KUNIT
|
||||
|
||||
@ -187,6 +187,10 @@
|
||||
#define ENUMERATED_REF_DEBUG
|
||||
#endif
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#define CONFIG_BCACHEFS_ASYNC_OBJECT_LISTS
|
||||
#endif
|
||||
|
||||
#ifndef dynamic_fault
|
||||
#define dynamic_fault(...) 0
|
||||
#endif
|
||||
|
||||
@ -120,8 +120,7 @@ err:
|
||||
bch2_increment_clock(c, sectors_allocated, WRITE);
|
||||
if (should_print_err(ret)) {
|
||||
CLASS(printbuf, buf)();
|
||||
lockrestart_do(trans,
|
||||
bch2_inum_offset_err_msg_trans(trans, &buf, inum, iter->pos.offset << 9));
|
||||
bch2_inum_offset_err_msg_trans(trans, &buf, inum.subvol, iter->pos);
|
||||
prt_printf(&buf, "fallocate error: %s", bch2_err_str(ret));
|
||||
bch_err_ratelimited(c, "%s", buf.buf);
|
||||
}
|
||||
|
||||
@ -435,20 +435,13 @@ void bch2_promote_op_to_text(struct printbuf *out,
|
||||
|
||||
/* Read */
|
||||
|
||||
static int bch2_read_err_msg_trans(struct btree_trans *trans, struct printbuf *out,
|
||||
struct bch_read_bio *rbio, struct bpos read_pos)
|
||||
void bch2_read_err_msg_trans(struct btree_trans *trans, struct printbuf *out,
|
||||
struct bch_read_bio *rbio, struct bpos read_pos)
|
||||
{
|
||||
int ret = lockrestart_do(trans,
|
||||
bch2_inum_offset_err_msg_trans(trans, out,
|
||||
(subvol_inum) { rbio->subvol, read_pos.inode },
|
||||
read_pos.offset << 9));
|
||||
if (ret)
|
||||
return ret;
|
||||
bch2_inum_offset_err_msg_trans(trans, out, rbio->subvol, read_pos);
|
||||
|
||||
if (rbio->data_update)
|
||||
prt_str(out, "(internal move) ");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bch2_read_err_msg(struct bch_fs *c, struct printbuf *out,
|
||||
@ -649,7 +642,7 @@ static void bch2_rbio_retry(struct work_struct *work)
|
||||
.subvol = rbio->subvol,
|
||||
.inum = rbio->read_pos.inode,
|
||||
};
|
||||
u64 read_offset = rbio->read_pos.offset;
|
||||
struct bpos read_pos = rbio->read_pos;
|
||||
struct bch_io_failures failed = { .nr = 0 };
|
||||
|
||||
trace_io_read_retry(&rbio->bio);
|
||||
@ -693,10 +686,7 @@ static void bch2_rbio_retry(struct work_struct *work)
|
||||
CLASS(printbuf, buf)();
|
||||
bch2_log_msg_start(c, &buf);
|
||||
|
||||
lockrestart_do(trans,
|
||||
bch2_inum_offset_err_msg_trans(trans, &buf, inum, read_offset << 9));
|
||||
if (rbio->data_update)
|
||||
prt_str(&buf, "(internal move) ");
|
||||
bch2_read_err_msg_trans(trans, &buf, rbio, read_pos);
|
||||
|
||||
prt_str(&buf, "data read error, ");
|
||||
if (!ret) {
|
||||
@ -1494,9 +1484,7 @@ err:
|
||||
if (unlikely(ret)) {
|
||||
if (ret != -BCH_ERR_extent_poisoned) {
|
||||
CLASS(printbuf, buf)();
|
||||
lockrestart_do(trans,
|
||||
bch2_inum_offset_err_msg_trans(trans, &buf, inum,
|
||||
bvec_iter.bi_sector << 9));
|
||||
bch2_read_err_msg_trans(trans, &buf, rbio, POS(inum.inum, bvec_iter.bi_sector));
|
||||
prt_printf(&buf, "data read error: %s", bch2_err_str(ret));
|
||||
bch_err_ratelimited(c, "%s", buf.buf);
|
||||
}
|
||||
|
||||
@ -132,6 +132,9 @@ enum bch_read_flags {
|
||||
#undef x
|
||||
};
|
||||
|
||||
void bch2_read_err_msg_trans(struct btree_trans *, struct printbuf *,
|
||||
struct bch_read_bio *, struct bpos);
|
||||
|
||||
int __bch2_read_extent(struct btree_trans *, struct bch_read_bio *,
|
||||
struct bvec_iter, struct bpos, enum btree_id,
|
||||
struct bkey_s_c, unsigned,
|
||||
|
||||
@ -291,14 +291,12 @@ int bch2_bkey_get_io_opts(struct btree_trans *trans,
|
||||
struct bch_inode_opts *opts)
|
||||
{
|
||||
struct bch_fs *c = trans->c;
|
||||
bool metadata = bkey_is_btree_ptr(k.k);
|
||||
|
||||
if (!snapshot_opts) {
|
||||
bch2_inode_opts_get(c, opts, bkey_is_btree_ptr(k.k));
|
||||
bch2_inode_opts_get(c, opts, metadata);
|
||||
|
||||
if (k.k->type == KEY_TYPE_reflink_v)
|
||||
goto indirect_extent_fixups;
|
||||
|
||||
if (!bkey_is_btree_ptr(k.k) && k.k->type != KEY_TYPE_reflink_v) {
|
||||
if (k.k->p.snapshot) {
|
||||
struct bch_inode_unpacked inode;
|
||||
int ret = bch2_inode_find_by_inum_snapshot(trans, k.k->p.inode, k.k->p.snapshot,
|
||||
&inode, BTREE_ITER_cached);
|
||||
@ -307,72 +305,60 @@ int bch2_bkey_get_io_opts(struct btree_trans *trans,
|
||||
if (!ret)
|
||||
bch2_inode_opts_get_inode(c, &inode, opts);
|
||||
}
|
||||
} else {
|
||||
if (snapshot_opts->fs_io_opts.change_cookie != atomic_read(&c->opt_change_cookie)) {
|
||||
bch2_inode_opts_get(c, &snapshot_opts->fs_io_opts, metadata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
snapshot_opts->cur_inum = 0;
|
||||
snapshot_opts->d.nr = 0;
|
||||
}
|
||||
|
||||
if (snapshot_opts->fs_io_opts.change_cookie != atomic_read(&c->opt_change_cookie)) {
|
||||
bch2_inode_opts_get(c, &snapshot_opts->fs_io_opts, bkey_is_btree_ptr(k.k));
|
||||
if (k.k->p.snapshot) {
|
||||
if (snapshot_opts->cur_inum != k.k->p.inode) {
|
||||
snapshot_opts->d.nr = 0;
|
||||
|
||||
snapshot_opts->cur_inum = 0;
|
||||
snapshot_opts->d.nr = 0;
|
||||
}
|
||||
int ret = for_each_btree_key(trans, iter, BTREE_ID_inodes, POS(0, k.k->p.inode),
|
||||
BTREE_ITER_all_snapshots, k, ({
|
||||
if (k.k->p.offset != k.k->p.inode)
|
||||
break;
|
||||
|
||||
if (bkey_is_btree_ptr(k.k)) {
|
||||
*opts = snapshot_opts->fs_io_opts;
|
||||
return 0;
|
||||
}
|
||||
if (!bkey_is_inode(k.k))
|
||||
continue;
|
||||
|
||||
if (k.k->type == KEY_TYPE_reflink_v) {
|
||||
*opts = snapshot_opts->fs_io_opts;
|
||||
goto indirect_extent_fixups;
|
||||
}
|
||||
struct bch_inode_unpacked inode;
|
||||
_ret3 = bch2_inode_unpack(k, &inode);
|
||||
if (_ret3)
|
||||
break;
|
||||
|
||||
if (snapshot_opts->cur_inum != k.k->p.inode) {
|
||||
snapshot_opts->d.nr = 0;
|
||||
struct snapshot_io_opts_entry e = { .snapshot = k.k->p.snapshot };
|
||||
bch2_inode_opts_get_inode(c, &inode, &e.io_opts);
|
||||
|
||||
int ret = for_each_btree_key(trans, iter, BTREE_ID_inodes, POS(0, k.k->p.inode),
|
||||
BTREE_ITER_all_snapshots, k, ({
|
||||
if (k.k->p.offset != k.k->p.inode)
|
||||
break;
|
||||
darray_push(&snapshot_opts->d, e);
|
||||
}));
|
||||
|
||||
if (!bkey_is_inode(k.k))
|
||||
continue;
|
||||
snapshot_opts->cur_inum = k.k->p.inode;
|
||||
|
||||
struct bch_inode_unpacked inode;
|
||||
_ret3 = bch2_inode_unpack(k, &inode);
|
||||
if (_ret3)
|
||||
break;
|
||||
|
||||
struct snapshot_io_opts_entry e = { .snapshot = k.k->p.snapshot };
|
||||
bch2_inode_opts_get_inode(c, &inode, &e.io_opts);
|
||||
|
||||
darray_push(&snapshot_opts->d, e);
|
||||
}));
|
||||
|
||||
snapshot_opts->cur_inum = k.k->p.inode;
|
||||
|
||||
return ret ?: bch_err_throw(c, transaction_restart_nested);
|
||||
}
|
||||
|
||||
if (k.k->p.snapshot)
|
||||
darray_for_each(snapshot_opts->d, i)
|
||||
if (bch2_snapshot_is_ancestor(c, k.k->p.snapshot, i->snapshot)) {
|
||||
*opts = i->io_opts;
|
||||
return 0;
|
||||
return ret ?: bch_err_throw(c, transaction_restart_nested);
|
||||
}
|
||||
|
||||
*opts = snapshot_opts->fs_io_opts;
|
||||
return 0;
|
||||
indirect_extent_fixups:
|
||||
const struct bch_extent_rebalance *old = bch2_bkey_rebalance_opts(k);
|
||||
if (old) {
|
||||
#define x(_name) \
|
||||
if (old->_name##_from_inode) { \
|
||||
opts->_name = old->_name; \
|
||||
opts->_name##_from_inode = old->_name##_from_inode; \
|
||||
darray_for_each(snapshot_opts->d, i)
|
||||
if (bch2_snapshot_is_ancestor(c, k.k->p.snapshot, i->snapshot)) {
|
||||
*opts = i->io_opts;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
*opts = snapshot_opts->fs_io_opts;
|
||||
}
|
||||
BCH_REBALANCE_OPTS()
|
||||
|
||||
const struct bch_extent_rebalance *old;
|
||||
if (k.k->type == KEY_TYPE_reflink_v &&
|
||||
(old = bch2_bkey_rebalance_opts(k))) {
|
||||
#define x(_name) \
|
||||
if (old->_name##_from_inode) \
|
||||
opts->_name = old->_name; \
|
||||
opts->_name##_from_inode = old->_name##_from_inode;
|
||||
BCH_REBALANCE_OPTS()
|
||||
#undef x
|
||||
}
|
||||
|
||||
|
||||
@ -197,7 +197,7 @@ static int bch2_indirect_extent_missing_error(struct btree_trans *trans,
|
||||
missing_pos.offset += missing_start - live_start;
|
||||
|
||||
prt_printf(&buf, "pointer to missing indirect extent in ");
|
||||
try(bch2_inum_snap_offset_err_msg_trans(trans, &buf, missing_pos));
|
||||
try(bch2_inum_offset_err_msg_trans_norestart(trans, &buf, 0, missing_pos));
|
||||
|
||||
prt_printf(&buf, "-%llu\n", (missing_pos.offset + (missing_end - missing_start)) << 9);
|
||||
bch2_bkey_val_to_text(&buf, c, p.s_c);
|
||||
|
||||
@ -427,16 +427,12 @@ static int bch2_write_index_default(struct bch_write_op *op)
|
||||
void bch2_write_op_error(struct bch_write_op *op, u64 offset, const char *fmt, ...)
|
||||
{
|
||||
CLASS(printbuf, buf)();
|
||||
CLASS(btree_trans, trans)(op->c);
|
||||
|
||||
if (op->subvol) {
|
||||
bch2_inum_offset_err_msg(op->c, &buf,
|
||||
(subvol_inum) { op->subvol, op->pos.inode, },
|
||||
offset << 9);
|
||||
} else {
|
||||
struct bpos pos = op->pos;
|
||||
pos.offset = offset;
|
||||
bch2_inum_snap_offset_err_msg(op->c, &buf, pos);
|
||||
}
|
||||
struct bpos pos = op->pos;
|
||||
pos.offset = offset;
|
||||
|
||||
bch2_inum_offset_err_msg_trans(trans, &buf, op->subvol, pos);
|
||||
|
||||
prt_str(&buf, "write error: ");
|
||||
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#ifdef CONFIG_BCACHEFS_ASYNC_OBJECT_LISTS
|
||||
|
||||
/*
|
||||
* Async obj debugging: keep asynchronous objects on (very fast) lists, make
|
||||
* them visibile in debugfs:
|
||||
@ -8,6 +6,8 @@
|
||||
|
||||
#include "bcachefs.h"
|
||||
|
||||
#ifdef CONFIG_BCACHEFS_ASYNC_OBJECT_LISTS
|
||||
|
||||
#include "btree/read.h"
|
||||
#include "btree/write.h"
|
||||
|
||||
|
||||
@ -728,45 +728,28 @@ void bch2_free_fsck_errs(struct bch_fs *c)
|
||||
__bch2_flush_fsck_errs(c, false);
|
||||
}
|
||||
|
||||
int bch2_inum_offset_err_msg_trans(struct btree_trans *trans, struct printbuf *out,
|
||||
subvol_inum inum, u64 offset)
|
||||
int bch2_inum_offset_err_msg_trans_norestart(struct btree_trans *trans, struct printbuf *out,
|
||||
u32 subvol, struct bpos pos)
|
||||
{
|
||||
u32 restart_count = trans->restart_count;
|
||||
int ret = 0;
|
||||
if (subvol)
|
||||
ret = bch2_inum_to_path(trans, (subvol_inum) { subvol, pos.inode }, out);
|
||||
else if (pos.snapshot)
|
||||
ret = bch2_inum_snapshot_to_path(trans, pos.inode, pos.snapshot, NULL, out);
|
||||
|
||||
if (inum.subvol) {
|
||||
ret = bch2_inum_to_path(trans, inum, out);
|
||||
if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
|
||||
return ret;
|
||||
}
|
||||
if (!inum.subvol || ret)
|
||||
prt_printf(out, "inum %llu:%llu", inum.subvol, inum.inum);
|
||||
prt_printf(out, " offset %llu: ", offset);
|
||||
|
||||
return trans_was_restarted(trans, restart_count);
|
||||
}
|
||||
|
||||
void bch2_inum_offset_err_msg(struct bch_fs *c, struct printbuf *out,
|
||||
subvol_inum inum, u64 offset)
|
||||
{
|
||||
CLASS(btree_trans, trans)(c);
|
||||
lockrestart_do(trans, bch2_inum_offset_err_msg_trans(trans, out, inum, offset));
|
||||
}
|
||||
|
||||
int bch2_inum_snap_offset_err_msg_trans(struct btree_trans *trans, struct printbuf *out,
|
||||
struct bpos pos)
|
||||
{
|
||||
int ret = bch2_inum_snapshot_to_path(trans, pos.inode, pos.snapshot, NULL, out);
|
||||
if (ret)
|
||||
if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
|
||||
return ret;
|
||||
|
||||
prt_printf(out, " offset %llu: ", pos.offset << 8);
|
||||
if (!subvol && !pos.snapshot)
|
||||
prt_printf(out, "inum %llu", pos.inode);
|
||||
else if (ret)
|
||||
prt_printf(out, "inum %u:%llu", subvol, pos.inode);
|
||||
prt_printf(out, " offset %llu: ", pos.offset << 9);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void bch2_inum_snap_offset_err_msg(struct bch_fs *c, struct printbuf *out,
|
||||
struct bpos pos)
|
||||
void bch2_inum_offset_err_msg_trans(struct btree_trans *trans, struct printbuf *out,
|
||||
u32 subvol, struct bpos pos)
|
||||
{
|
||||
CLASS(btree_trans, trans)(c);
|
||||
lockrestart_do(trans, bch2_inum_snap_offset_err_msg_trans(trans, out, pos));
|
||||
lockrestart_do(trans, bch2_inum_offset_err_msg_trans_norestart(trans, out, subvol, pos));
|
||||
}
|
||||
|
||||
@ -249,11 +249,7 @@ static inline void bch2_account_io_completion(struct bch_dev *ca,
|
||||
bch2_account_io_success_fail(ca, type, success);
|
||||
}
|
||||
|
||||
int bch2_inum_offset_err_msg_trans(struct btree_trans *, struct printbuf *, subvol_inum, u64);
|
||||
|
||||
void bch2_inum_offset_err_msg(struct bch_fs *, struct printbuf *, subvol_inum, u64);
|
||||
|
||||
int bch2_inum_snap_offset_err_msg_trans(struct btree_trans *, struct printbuf *, struct bpos);
|
||||
void bch2_inum_snap_offset_err_msg(struct bch_fs *, struct printbuf *, struct bpos);
|
||||
int bch2_inum_offset_err_msg_trans_norestart(struct btree_trans *, struct printbuf *, u32, struct bpos);
|
||||
void bch2_inum_offset_err_msg_trans(struct btree_trans *, struct printbuf *, u32, struct bpos);
|
||||
|
||||
#endif /* _BCACHEFS_ERROR_H */
|
||||
|
||||
@ -525,13 +525,13 @@ static int snapshot_tree_reconstruct_next(struct bch_fs *c, struct snapshot_tree
|
||||
darray_for_each(r->trees, i)
|
||||
if (snapshot_id_lists_have_common(i, &r->cur_ids)) {
|
||||
try(snapshot_list_merge(c, i, &r->cur_ids));
|
||||
goto out;
|
||||
r->cur_ids.nr = 0;
|
||||
return 0;
|
||||
}
|
||||
darray_push(&r->trees, r->cur_ids);
|
||||
darray_init(&r->cur_ids);
|
||||
}
|
||||
out:
|
||||
r->cur_ids.nr = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -547,7 +547,7 @@ int bch2_reconstruct_snapshots(struct bch_fs *c)
|
||||
{
|
||||
CLASS(btree_trans, trans)(c);
|
||||
CLASS(printbuf, buf)();
|
||||
struct snapshot_tree_reconstruct r = {};
|
||||
struct snapshot_tree_reconstruct r __cleanup(snapshot_tree_reconstruct_exit) = {};
|
||||
int ret = 0;
|
||||
|
||||
struct progress_indicator_state progress;
|
||||
@ -557,13 +557,11 @@ int bch2_reconstruct_snapshots(struct bch_fs *c)
|
||||
if (btree_type_has_snapshots(btree)) {
|
||||
r.btree = btree;
|
||||
|
||||
ret = for_each_btree_key(trans, iter, btree, POS_MIN,
|
||||
try(for_each_btree_key(trans, iter, btree, POS_MIN,
|
||||
BTREE_ITER_all_snapshots|BTREE_ITER_prefetch, k, ({
|
||||
progress_update_iter(trans, &progress, &iter);
|
||||
get_snapshot_trees(c, &r, k.k->p);
|
||||
}));
|
||||
if (ret)
|
||||
goto err;
|
||||
})));
|
||||
|
||||
snapshot_tree_reconstruct_next(c, &r);
|
||||
}
|
||||
@ -579,20 +577,15 @@ int bch2_reconstruct_snapshots(struct bch_fs *c)
|
||||
"snapshot node %u from tree %s missing, recreate?", *id, buf.buf)) {
|
||||
if (t->nr > 1) {
|
||||
bch_err(c, "cannot reconstruct snapshot trees with multiple nodes");
|
||||
ret = bch_err_throw(c, fsck_repair_unimplemented);
|
||||
goto err;
|
||||
return bch_err_throw(c, fsck_repair_unimplemented);
|
||||
}
|
||||
|
||||
ret = commit_do(trans, NULL, NULL, BCH_TRANS_COMMIT_no_enospc,
|
||||
check_snapshot_exists(trans, *id));
|
||||
if (ret)
|
||||
goto err;
|
||||
try(commit_do(trans, NULL, NULL, BCH_TRANS_COMMIT_no_enospc,
|
||||
check_snapshot_exists(trans, *id)));
|
||||
}
|
||||
}
|
||||
}
|
||||
fsck_err:
|
||||
err:
|
||||
snapshot_tree_reconstruct_exit(&r);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -1180,7 +1180,8 @@ int __bch2_key_has_snapshot_overwrites(struct btree_trans *trans,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int bch2_get_dead_interior_snapshots(struct btree_trans *trans, struct bkey_s_c k)
|
||||
static int bch2_get_dead_interior_snapshots(struct btree_trans *trans, struct bkey_s_c k,
|
||||
interior_delete_list *delete)
|
||||
{
|
||||
struct bch_fs *c = trans->c;
|
||||
|
||||
@ -1196,7 +1197,7 @@ static int bch2_get_dead_interior_snapshots(struct btree_trans *trans, struct bk
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return darray_push(&c->snapshot_delete.delete_interior, n);
|
||||
return darray_push(delete, n);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1205,39 +1206,33 @@ static int bch2_get_dead_interior_snapshots(struct btree_trans *trans, struct bk
|
||||
int bch2_delete_dead_interior_snapshots(struct bch_fs *c)
|
||||
{
|
||||
CLASS(btree_trans, trans)(c);
|
||||
int ret = for_each_btree_key(trans, iter, BTREE_ID_snapshots, POS_MAX, 0, k,
|
||||
bch2_get_dead_interior_snapshots(trans, k));
|
||||
if (ret)
|
||||
goto err;
|
||||
CLASS(interior_delete_list, delete)();
|
||||
|
||||
struct snapshot_delete *d = &c->snapshot_delete;
|
||||
if (d->delete_interior.nr) {
|
||||
try(for_each_btree_key(trans, iter, BTREE_ID_snapshots, POS_MAX, 0, k,
|
||||
bch2_get_dead_interior_snapshots(trans, k, &delete)));
|
||||
|
||||
if (delete.nr) {
|
||||
/*
|
||||
* Fixing children of deleted snapshots can't be done completely
|
||||
* atomically, if we crash between here and when we delete the interior
|
||||
* nodes some depth fields will be off:
|
||||
*/
|
||||
ret = for_each_btree_key_commit(trans, iter, BTREE_ID_snapshots, POS_MIN,
|
||||
BTREE_ITER_intent, k,
|
||||
NULL, NULL, BCH_TRANS_COMMIT_no_enospc,
|
||||
bch2_fix_child_of_deleted_snapshot(trans, &iter, k, &d->delete_interior));
|
||||
if (ret)
|
||||
goto err;
|
||||
try(for_each_btree_key_commit(trans, iter, BTREE_ID_snapshots, POS_MIN,
|
||||
BTREE_ITER_intent, k,
|
||||
NULL, NULL, BCH_TRANS_COMMIT_no_enospc,
|
||||
bch2_fix_child_of_deleted_snapshot(trans, &iter, k, &delete)));
|
||||
|
||||
darray_for_each(d->delete_interior, i) {
|
||||
ret = commit_do(trans, NULL, NULL, 0,
|
||||
darray_for_each(delete, i) {
|
||||
int ret = commit_do(trans, NULL, NULL, 0,
|
||||
bch2_snapshot_node_delete(trans, i->id));
|
||||
if (!bch2_err_matches(ret, EROFS))
|
||||
bch_err_msg(c, ret, "deleting snapshot %u", i->id);
|
||||
if (ret)
|
||||
goto err;
|
||||
return ret;
|
||||
}
|
||||
|
||||
darray_exit(&d->delete_interior);
|
||||
}
|
||||
err:
|
||||
bch_err_fn(c, ret);
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool interior_snapshot_needs_delete(struct bkey_s_c_snapshot snap)
|
||||
|
||||
@ -39,7 +39,7 @@ struct snapshot_interior_delete {
|
||||
u32 id;
|
||||
u32 live_child;
|
||||
};
|
||||
typedef DARRAY(struct snapshot_interior_delete) interior_delete_list;
|
||||
DEFINE_DARRAY_NAMED(interior_delete_list, struct snapshot_interior_delete);
|
||||
|
||||
struct snapshot_delete {
|
||||
struct mutex lock;
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#ifdef CONFIG_BCACHEFS_ASYNC_OBJECT_LISTS
|
||||
|
||||
/*
|
||||
* Fast, unordered lists
|
||||
@ -13,8 +12,11 @@
|
||||
* except when refilling/emptying the percpu slot buffers.
|
||||
*/
|
||||
|
||||
#include "bcachefs.h"
|
||||
#include "fast_list.h"
|
||||
|
||||
#ifdef CONFIG_BCACHEFS_ASYNC_OBJECT_LISTS
|
||||
|
||||
struct fast_list_pcpu {
|
||||
u32 nr;
|
||||
u32 entries[31];
|
||||
|
||||
@ -273,9 +273,8 @@ err:
|
||||
|
||||
if (ret) {
|
||||
CLASS(printbuf, buf)();
|
||||
lockrestart_do(trans,
|
||||
bch2_inum_offset_err_msg_trans(trans, &buf, inum, iter.pos.offset << 9));
|
||||
prt_printf(&buf, "read error %s from btree lookup", bch2_err_str(ret));
|
||||
bch2_read_err_msg_trans(trans, &buf, rbio, iter.pos);
|
||||
prt_printf(&buf, "data read error: %s", bch2_err_str(ret));
|
||||
bch_err_ratelimited(c, "%s", buf.buf);
|
||||
|
||||
rbio->bio.bi_status = BLK_STS_IOERR;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user