mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-23 00:00:02 +03:00
Update bcachefs sources to bb2281735c bcachefs: Factor out bch2_ec_stripes_heap_start()
This commit is contained in:
parent
4aed137c42
commit
02002f3774
@ -1 +1 @@
|
|||||||
93347f716249d5b2503bb7504fe9faac2bcd8d36
|
bb2281735c5992c8da66a4da552eeab1d376b6df
|
||||||
|
@ -607,8 +607,6 @@ static int bch2_gc_done(struct bch_fs *c,
|
|||||||
struct genradix_iter src_iter = genradix_iter_init(&c->stripes[1], 0);
|
struct genradix_iter src_iter = genradix_iter_init(&c->stripes[1], 0);
|
||||||
struct stripe *dst, *src;
|
struct stripe *dst, *src;
|
||||||
|
|
||||||
c->ec_stripes_heap.used = 0;
|
|
||||||
|
|
||||||
while ((dst = genradix_iter_peek(&dst_iter, &c->stripes[0])) &&
|
while ((dst = genradix_iter_peek(&dst_iter, &c->stripes[0])) &&
|
||||||
(src = genradix_iter_peek(&src_iter, &c->stripes[1]))) {
|
(src = genradix_iter_peek(&src_iter, &c->stripes[1]))) {
|
||||||
BUG_ON(src_iter.pos != dst_iter.pos);
|
BUG_ON(src_iter.pos != dst_iter.pos);
|
||||||
@ -625,12 +623,6 @@ static int bch2_gc_done(struct bch_fs *c,
|
|||||||
copy_stripe_field(block_sectors[i],
|
copy_stripe_field(block_sectors[i],
|
||||||
"block_sectors[%u]", i);
|
"block_sectors[%u]", i);
|
||||||
|
|
||||||
if (dst->alive) {
|
|
||||||
spin_lock(&c->ec_stripes_heap_lock);
|
|
||||||
bch2_stripes_heap_insert(c, dst, dst_iter.pos);
|
|
||||||
spin_unlock(&c->ec_stripes_heap_lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
genradix_iter_advance(&dst_iter, &c->stripes[0]);
|
genradix_iter_advance(&dst_iter, &c->stripes[0]);
|
||||||
genradix_iter_advance(&src_iter, &c->stripes[1]);
|
genradix_iter_advance(&src_iter, &c->stripes[1]);
|
||||||
}
|
}
|
||||||
|
@ -1450,6 +1450,16 @@ unlock:
|
|||||||
mutex_unlock(&c->ec_stripe_head_lock);
|
mutex_unlock(&c->ec_stripe_head_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bch2_stripes_heap_start(struct bch_fs *c)
|
||||||
|
{
|
||||||
|
struct genradix_iter iter;
|
||||||
|
struct stripe *m;
|
||||||
|
|
||||||
|
genradix_for_each(&c->stripes[0], iter, m)
|
||||||
|
if (m->alive)
|
||||||
|
bch2_stripes_heap_insert(c, m, iter.pos);
|
||||||
|
}
|
||||||
|
|
||||||
static int __bch2_stripe_write_key(struct btree_trans *trans,
|
static int __bch2_stripe_write_key(struct btree_trans *trans,
|
||||||
struct btree_iter *iter,
|
struct btree_iter *iter,
|
||||||
struct stripe *m,
|
struct stripe *m,
|
||||||
@ -1529,18 +1539,11 @@ static int bch2_stripes_read_fn(struct bch_fs *c, enum btree_id id,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (k.k->type == KEY_TYPE_stripe) {
|
if (k.k->type == KEY_TYPE_stripe) {
|
||||||
struct stripe *m;
|
|
||||||
|
|
||||||
ret = __ec_stripe_mem_alloc(c, k.k->p.offset, GFP_KERNEL) ?:
|
ret = __ec_stripe_mem_alloc(c, k.k->p.offset, GFP_KERNEL) ?:
|
||||||
bch2_mark_key(c, k, 0, 0, NULL, 0,
|
bch2_mark_key(c, k, 0, 0, NULL, 0,
|
||||||
BTREE_TRIGGER_NOATOMIC);
|
BTREE_TRIGGER_NOATOMIC);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
spin_lock(&c->ec_stripes_heap_lock);
|
|
||||||
m = genradix_ptr(&c->stripes[0], k.k->p.offset);
|
|
||||||
bch2_stripes_heap_insert(c, m, k.k->p.offset);
|
|
||||||
spin_unlock(&c->ec_stripes_heap_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -200,6 +200,8 @@ void bch2_ec_stop_dev(struct bch_fs *, struct bch_dev *);
|
|||||||
|
|
||||||
void bch2_ec_flush_new_stripes(struct bch_fs *);
|
void bch2_ec_flush_new_stripes(struct bch_fs *);
|
||||||
|
|
||||||
|
void bch2_stripes_heap_start(struct bch_fs *);
|
||||||
|
|
||||||
struct journal_keys;
|
struct journal_keys;
|
||||||
int bch2_stripes_read(struct bch_fs *, struct journal_keys *);
|
int bch2_stripes_read(struct bch_fs *, struct journal_keys *);
|
||||||
int bch2_stripes_write(struct bch_fs *, unsigned);
|
int bch2_stripes_write(struct bch_fs *, unsigned);
|
||||||
|
@ -1125,6 +1125,8 @@ use_clean:
|
|||||||
bch_verbose(c, "mark and sweep done");
|
bch_verbose(c, "mark and sweep done");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bch2_stripes_heap_start(c);
|
||||||
|
|
||||||
clear_bit(BCH_FS_REBUILD_REPLICAS, &c->flags);
|
clear_bit(BCH_FS_REBUILD_REPLICAS, &c->flags);
|
||||||
set_bit(BCH_FS_INITIAL_GC_DONE, &c->flags);
|
set_bit(BCH_FS_INITIAL_GC_DONE, &c->flags);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user