mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
bcachefs: bch2_mark_key() now takes bch_data_type
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
647d7b60b1
commit
a7c7a3092e
@ -123,13 +123,14 @@ static u8 bch2_gc_mark_key(struct bch_fs *c, enum bkey_type type,
|
||||
|
||||
switch (type) {
|
||||
case BKEY_TYPE_BTREE:
|
||||
bch2_mark_key(c, k, c->opts.btree_node_size, true, pos, NULL,
|
||||
bch2_mark_key(c, k, c->opts.btree_node_size,
|
||||
BCH_DATA_BTREE, pos, NULL,
|
||||
0, flags|
|
||||
BCH_BUCKET_MARK_MAY_MAKE_UNAVAILABLE|
|
||||
BCH_BUCKET_MARK_GC_LOCK_HELD);
|
||||
break;
|
||||
case BKEY_TYPE_EXTENTS:
|
||||
bch2_mark_key(c, k, k.k->size, false, pos, NULL,
|
||||
bch2_mark_key(c, k, k.k->size, BCH_DATA_USER, pos, NULL,
|
||||
0, flags|
|
||||
BCH_BUCKET_MARK_MAY_MAKE_UNAVAILABLE|
|
||||
BCH_BUCKET_MARK_GC_LOCK_HELD);
|
||||
@ -398,7 +399,8 @@ static void bch2_mark_pending_btree_node_frees(struct bch_fs *c)
|
||||
for_each_pending_btree_node_free(c, as, d)
|
||||
if (d->index_update_done)
|
||||
bch2_mark_key(c, bkey_i_to_s_c(&d->key),
|
||||
c->opts.btree_node_size, true, pos,
|
||||
c->opts.btree_node_size,
|
||||
BCH_DATA_BTREE, pos,
|
||||
&stats, 0,
|
||||
BCH_BUCKET_MARK_MAY_MAKE_UNAVAILABLE|
|
||||
BCH_BUCKET_MARK_GC_LOCK_HELD);
|
||||
|
@ -211,7 +211,7 @@ found:
|
||||
struct bch_fs_usage tmp = { 0 };
|
||||
|
||||
bch2_mark_key(c, bkey_i_to_s_c(&d->key),
|
||||
-c->opts.btree_node_size, true, b
|
||||
-c->opts.btree_node_size, BCH_DATA_BTREE, b
|
||||
? gc_pos_btree_node(b)
|
||||
: gc_pos_btree_root(as->btree_id),
|
||||
&tmp, 0, 0);
|
||||
@ -290,7 +290,7 @@ static void bch2_btree_node_free_ondisk(struct bch_fs *c,
|
||||
BUG_ON(!pending->index_update_done);
|
||||
|
||||
bch2_mark_key(c, bkey_i_to_s_c(&pending->key),
|
||||
-c->opts.btree_node_size, true,
|
||||
-c->opts.btree_node_size, BCH_DATA_BTREE,
|
||||
gc_phase(GC_PHASE_PENDING_DELETE),
|
||||
&stats, 0, 0);
|
||||
/*
|
||||
@ -1098,7 +1098,7 @@ static void bch2_btree_set_root_inmem(struct btree_update *as, struct btree *b)
|
||||
__bch2_btree_set_root_inmem(c, b);
|
||||
|
||||
bch2_mark_key(c, bkey_i_to_s_c(&b->key),
|
||||
c->opts.btree_node_size, true,
|
||||
c->opts.btree_node_size, BCH_DATA_BTREE,
|
||||
gc_pos_btree_root(b->btree_id),
|
||||
&stats, 0, 0);
|
||||
|
||||
@ -1186,7 +1186,7 @@ static void bch2_insert_fixup_btree_ptr(struct btree_update *as, struct btree *b
|
||||
|
||||
if (bkey_extent_is_data(&insert->k))
|
||||
bch2_mark_key(c, bkey_i_to_s_c(insert),
|
||||
c->opts.btree_node_size, true,
|
||||
c->opts.btree_node_size, BCH_DATA_BTREE,
|
||||
gc_pos_btree_node(b), &stats, 0, 0);
|
||||
|
||||
while ((k = bch2_btree_node_iter_peek_all(node_iter, b)) &&
|
||||
@ -1967,7 +1967,7 @@ static void __bch2_btree_node_update_key(struct bch_fs *c,
|
||||
bch2_btree_node_lock_write(b, iter);
|
||||
|
||||
bch2_mark_key(c, bkey_i_to_s_c(&new_key->k_i),
|
||||
c->opts.btree_node_size, true,
|
||||
c->opts.btree_node_size, BCH_DATA_BTREE,
|
||||
gc_pos_btree_root(b->btree_id),
|
||||
&stats, 0, 0);
|
||||
bch2_btree_node_free_index(as, NULL,
|
||||
|
@ -512,15 +512,13 @@ static void bch2_mark_pointer(struct bch_fs *c,
|
||||
struct bkey_s_c_extent e,
|
||||
const struct bch_extent_ptr *ptr,
|
||||
struct bch_extent_crc_unpacked crc,
|
||||
s64 sectors, enum s_alloc type,
|
||||
s64 sectors, enum bch_data_type data_type,
|
||||
struct bch_fs_usage *stats,
|
||||
u64 journal_seq, unsigned flags)
|
||||
{
|
||||
struct bucket_mark old, new;
|
||||
struct bch_dev *ca = bch_dev_bkey_exists(c, ptr->dev);
|
||||
struct bucket *g = PTR_BUCKET(ca, ptr);
|
||||
enum bch_data_type data_type = type == S_META
|
||||
? BCH_DATA_BTREE : BCH_DATA_USER;
|
||||
u64 v;
|
||||
|
||||
if (crc.compression_type) {
|
||||
@ -596,7 +594,7 @@ static void bch2_mark_pointer(struct bch_fs *c,
|
||||
}
|
||||
|
||||
void bch2_mark_key(struct bch_fs *c, struct bkey_s_c k,
|
||||
s64 sectors, bool metadata,
|
||||
s64 sectors, enum bch_data_type data_type,
|
||||
struct gc_pos pos,
|
||||
struct bch_fs_usage *stats,
|
||||
u64 journal_seq, unsigned flags)
|
||||
@ -643,14 +641,14 @@ void bch2_mark_key(struct bch_fs *c, struct bkey_s_c k,
|
||||
struct bkey_s_c_extent e = bkey_s_c_to_extent(k);
|
||||
const struct bch_extent_ptr *ptr;
|
||||
struct bch_extent_crc_unpacked crc;
|
||||
enum s_alloc type = metadata ? S_META : S_DIRTY;
|
||||
enum s_alloc type = data_type == BCH_DATA_USER
|
||||
? S_DIRTY : S_META;
|
||||
unsigned replicas = 0;
|
||||
|
||||
BUG_ON(metadata && bkey_extent_is_cached(e.k));
|
||||
BUG_ON(!sectors);
|
||||
|
||||
extent_for_each_ptr_crc(e, ptr, crc) {
|
||||
bch2_mark_pointer(c, e, ptr, crc, sectors, type,
|
||||
bch2_mark_pointer(c, e, ptr, crc, sectors, data_type,
|
||||
stats, journal_seq, flags);
|
||||
replicas += !ptr->cached;
|
||||
}
|
||||
|
@ -218,8 +218,8 @@ void bch2_mark_metadata_bucket(struct bch_fs *, struct bch_dev *,
|
||||
#define BCH_BUCKET_MARK_GC_WILL_VISIT (1 << 2)
|
||||
#define BCH_BUCKET_MARK_GC_LOCK_HELD (1 << 3)
|
||||
|
||||
void bch2_mark_key(struct bch_fs *, struct bkey_s_c, s64, bool, struct gc_pos,
|
||||
struct bch_fs_usage *, u64, unsigned);
|
||||
void bch2_mark_key(struct bch_fs *, struct bkey_s_c, s64, enum bch_data_type,
|
||||
struct gc_pos, struct bch_fs_usage *, u64, unsigned);
|
||||
|
||||
void bch2_recalc_sectors_available(struct bch_fs *);
|
||||
|
||||
|
@ -1071,7 +1071,7 @@ static void bch2_add_sectors(struct extent_insert_state *s,
|
||||
if (!sectors)
|
||||
return;
|
||||
|
||||
bch2_mark_key(c, k, sectors, false, gc_pos_btree_node(b),
|
||||
bch2_mark_key(c, k, sectors, BCH_DATA_USER, gc_pos_btree_node(b),
|
||||
&s->stats, s->trans->journal_res.seq, 0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user