mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-12-08 00:00:12 +03:00
Update bcachefs sources to e6f97f86f5fc bcachefs: btree write buffer -> bch2_btree_node_merge_async()
Some checks failed
build / bcachefs-tools-msrv (push) Has been cancelled
.deb build orchestrator / source-only (push) Has been cancelled
Nix Flake actions / nix-matrix (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: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 / 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: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 / publish (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
Nix Flake actions / nix-matrix (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: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 / 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: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 / publish (push) Has been cancelled
Nix Flake actions / ${{ matrix.name }} (${{ matrix.system }}) (push) Has been cancelled
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
d05552cf02
commit
62c0874fa5
@ -1 +1 @@
|
||||
4749aaded066f8efed6819bf616eb4097e25dac2
|
||||
e6f97f86f5fcb9f53c6fef2287af7d3f8acccac7
|
||||
|
||||
@ -2338,6 +2338,20 @@ int bch2_btree_node_rewrite_key(struct btree_trans *trans,
|
||||
: -ENOENT;
|
||||
}
|
||||
|
||||
static int bch2_btree_node_merge_key(struct btree_trans *trans,
|
||||
enum btree_id btree, unsigned level,
|
||||
struct bkey_i *k,
|
||||
enum bch_trans_commit_flags flags)
|
||||
{
|
||||
CLASS(btree_node_iter, iter)(trans, btree, k->k.p, 0, level, 0);
|
||||
struct btree *b = errptr_try(bch2_btree_iter_peek_node(&iter));
|
||||
|
||||
bool found = b && btree_ptr_hash_val(&b->key) == btree_ptr_hash_val(k);
|
||||
return found
|
||||
? bch2_foreground_maybe_merge(trans, iter.path, level, flags, 0, NULL)
|
||||
: -ENOENT;
|
||||
}
|
||||
|
||||
int bch2_btree_node_rewrite_pos(struct btree_trans *trans,
|
||||
enum btree_id btree, unsigned level,
|
||||
struct bpos pos,
|
||||
@ -2360,6 +2374,7 @@ struct async_btree_rewrite {
|
||||
struct list_head list;
|
||||
enum btree_id btree_id;
|
||||
unsigned level;
|
||||
bool merge;
|
||||
struct bkey_buf key;
|
||||
};
|
||||
|
||||
@ -2369,8 +2384,9 @@ static void async_btree_node_rewrite_work(struct work_struct *work)
|
||||
container_of(work, struct async_btree_rewrite, work);
|
||||
struct bch_fs *c = a->c;
|
||||
|
||||
int ret = bch2_trans_do(c, bch2_btree_node_rewrite_key(trans,
|
||||
a->btree_id, a->level, a->key.k, 0));
|
||||
int ret = bch2_trans_do(c, !a->merge
|
||||
? bch2_btree_node_rewrite_key(trans, a->btree_id, a->level, a->key.k, 0)
|
||||
: bch2_btree_node_merge_key(trans, a->btree_id, a->level, a->key.k, 0));
|
||||
if (!bch2_err_matches(ret, ENOENT) &&
|
||||
!bch2_err_matches(ret, EROFS))
|
||||
bch_err_fn_ratelimited(c, ret);
|
||||
@ -2385,15 +2401,16 @@ static void async_btree_node_rewrite_work(struct work_struct *work)
|
||||
kfree(a);
|
||||
}
|
||||
|
||||
void bch2_btree_node_rewrite_async(struct bch_fs *c, struct btree *b)
|
||||
static void __bch2_btree_node_rewrite_async(struct bch_fs *c, struct btree *b, bool merge)
|
||||
{
|
||||
struct async_btree_rewrite *a = kmalloc(sizeof(*a), GFP_NOFS);
|
||||
struct async_btree_rewrite *a = kzalloc(sizeof(*a), GFP_NOFS);
|
||||
if (!a)
|
||||
return;
|
||||
|
||||
a->c = c;
|
||||
a->btree_id = b->c.btree_id;
|
||||
a->level = b->c.level;
|
||||
a->merge = merge;
|
||||
INIT_WORK(&a->work, async_btree_node_rewrite_work);
|
||||
|
||||
bch2_bkey_buf_init(&a->key);
|
||||
@ -2406,7 +2423,7 @@ void bch2_btree_node_rewrite_async(struct bch_fs *c, struct btree *b)
|
||||
enumerated_ref_tryget(&c->writes, BCH_WRITE_REF_node_rewrite)) {
|
||||
list_add(&a->list, &c->btree_node_rewrites);
|
||||
now = true;
|
||||
} else if (!test_bit(BCH_FS_may_go_rw, &c->flags)) {
|
||||
} else if (!test_bit(BCH_FS_may_go_rw, &c->flags) && !merge) {
|
||||
list_add(&a->list, &c->btree_node_rewrites_pending);
|
||||
pending = true;
|
||||
}
|
||||
@ -2422,6 +2439,16 @@ void bch2_btree_node_rewrite_async(struct bch_fs *c, struct btree *b)
|
||||
}
|
||||
}
|
||||
|
||||
void bch2_btree_node_rewrite_async(struct bch_fs *c, struct btree *b)
|
||||
{
|
||||
__bch2_btree_node_rewrite_async(c, b, false);
|
||||
}
|
||||
|
||||
void bch2_btree_node_merge_async(struct bch_fs *c, struct btree *b)
|
||||
{
|
||||
__bch2_btree_node_rewrite_async(c, b, true);
|
||||
}
|
||||
|
||||
void bch2_async_btree_node_rewrites_flush(struct bch_fs *c)
|
||||
{
|
||||
closure_wait_event(&c->btree_node_rewrites_wait,
|
||||
|
||||
@ -175,6 +175,7 @@ int bch2_btree_node_rewrite_pos(struct btree_trans *,
|
||||
enum bch_write_flags);
|
||||
|
||||
void bch2_btree_node_rewrite_async(struct bch_fs *, struct btree *);
|
||||
void bch2_btree_node_merge_async(struct bch_fs *, struct btree *);
|
||||
|
||||
int bch2_btree_node_update_key(struct btree_trans *, struct btree_iter *,
|
||||
struct btree *, struct bkey_i *,
|
||||
@ -203,8 +204,8 @@ static inline unsigned btree_update_reserve_required(struct bch_fs *c,
|
||||
|
||||
static inline void btree_node_reset_sib_u64s(struct btree *b)
|
||||
{
|
||||
b->sib_u64s[0] = b->nr.live_u64s;
|
||||
b->sib_u64s[1] = b->nr.live_u64s;
|
||||
b->sib_u64s[0] = !bpos_eq(b->data->min_key, POS_MIN) ? b->nr.live_u64s : U16_MAX;
|
||||
b->sib_u64s[1] = !bpos_eq(b->key.k.p, SPOS_MAX) ? b->nr.live_u64s : U16_MAX;
|
||||
}
|
||||
|
||||
static inline void *btree_data_end(struct btree *b)
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
#include "btree/bkey_methods.h"
|
||||
#include "btree/bkey_buf.h"
|
||||
#include "btree/cache.h"
|
||||
#include "btree/interior.h"
|
||||
#include "btree/iter.h"
|
||||
#include "btree/journal_overlay.h"
|
||||
#include "btree/key_cache.h"
|
||||
@ -2366,6 +2367,9 @@ static struct bkey_s_c __bch2_btree_iter_peek(struct btree_iter *iter, struct bp
|
||||
if (likely(k.k)) {
|
||||
break;
|
||||
} else if (likely(!bpos_eq(l->b->key.k.p, SPOS_MAX))) {
|
||||
if (btree_node_needs_merge(trans, l->b, 0))
|
||||
bch2_btree_node_merge_async(trans->c, l->b);
|
||||
|
||||
/* Advance to next leaf node: */
|
||||
search_key = bpos_successor(l->b->key.k.p);
|
||||
} else {
|
||||
|
||||
@ -207,19 +207,8 @@ static inline int wb_flush_one(struct btree_trans *trans, struct btree_iter *ite
|
||||
bch2_btree_insert_key_leaf(trans, path, &wb->k, wb->journal_seq);
|
||||
(*fast)++;
|
||||
|
||||
if (unlikely(btree_node_needs_merge(trans, b, 0))) {
|
||||
*write_locked = false;
|
||||
bch2_btree_node_unlock_write(trans, path, b);
|
||||
|
||||
lockrestart_do(trans,
|
||||
bch2_btree_iter_traverse(iter) ?:
|
||||
bch2_foreground_maybe_merge(trans, iter->path, 0,
|
||||
BCH_WATERMARK_reclaim|
|
||||
BCH_TRANS_COMMIT_journal_reclaim|
|
||||
BCH_TRANS_COMMIT_no_check_rw|
|
||||
BCH_TRANS_COMMIT_no_enospc,
|
||||
0, NULL));
|
||||
}
|
||||
if (unlikely(btree_node_needs_merge(trans, b, 0)))
|
||||
bch2_btree_node_merge_async(trans->c, b);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -627,8 +627,7 @@ bool bch2_bkey_narrow_crc(const struct bch_fs *c,
|
||||
{
|
||||
BUG_ON(crc_is_compressed(new));
|
||||
BUG_ON(new.offset);
|
||||
BUG_ON(new.live_size != k->k.size);
|
||||
|
||||
BUG_ON(new.uncompressed_size != new.live_size);
|
||||
|
||||
union bch_extent_entry *old_e = bkey_crc_find(c, k, old);
|
||||
if (!old_e)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user