mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 19:47:08 +02:00
bcachefs: Fix evacuate_bucket tracepoint
86a494c8eef9 ("bcachefs: Kill bch2_get_next_backpointer()") dropped some
things the tracepoint emitted because bch2_evacuate_bucket() no longer
looks at the alloc key - but we did want at least some of that.
We still no longer look at the alloc key so we can't report on the
fragmentation number, but that's a direct function of dirty_sectors and
a copygc concern anyways - copygc should get its own tracepoint that
includes information from the fragmentation LRU.
But we can report on the number of sectors we moved and the bucket size.
Co-developed-by: Piotr Zalewski <pZ010001011111@proton.me>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
eae6c4a625
commit
4de2c24aa9
|
|
@ -674,8 +674,7 @@ int bch2_evacuate_bucket(struct moving_context *ctxt,
|
|||
struct bkey_buf sk;
|
||||
struct bkey_s_c k;
|
||||
struct data_update_opts data_opts;
|
||||
unsigned dirty_sectors, bucket_size;
|
||||
u64 fragmentation;
|
||||
unsigned sectors_moved = 0;
|
||||
int ret = 0;
|
||||
|
||||
struct bch_dev *ca = bch2_dev_tryget(c, bucket.inode);
|
||||
|
|
@ -748,14 +747,18 @@ int bch2_evacuate_bucket(struct moving_context *ctxt,
|
|||
data_opts.target = io_opts.background_target;
|
||||
data_opts.rewrite_ptrs = 0;
|
||||
|
||||
unsigned sectors = bp.v->bucket_len; /* move_extent will drop locks */
|
||||
unsigned i = 0;
|
||||
bkey_for_each_ptr(bch2_bkey_ptrs_c(k), ptr) {
|
||||
if (ptr->dev == bucket.inode) {
|
||||
data_opts.rewrite_ptrs |= 1U << i;
|
||||
if (ptr->cached) {
|
||||
const union bch_extent_entry *entry;
|
||||
struct extent_ptr_decoded p;
|
||||
bkey_for_each_ptr_decode(k.k, bch2_bkey_ptrs_c(k), p, entry) {
|
||||
if (p.ptr.dev == bucket.inode) {
|
||||
if (p.ptr.cached) {
|
||||
bch2_trans_iter_exit(trans, &iter);
|
||||
goto next;
|
||||
}
|
||||
data_opts.rewrite_ptrs |= 1U << i;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
|
@ -775,7 +778,8 @@ int bch2_evacuate_bucket(struct moving_context *ctxt,
|
|||
goto err;
|
||||
|
||||
if (ctxt->stats)
|
||||
atomic64_add(k.k->size, &ctxt->stats->sectors_seen);
|
||||
atomic64_add(sectors, &ctxt->stats->sectors_seen);
|
||||
sectors_moved += sectors;
|
||||
} else {
|
||||
struct btree *b;
|
||||
|
||||
|
|
@ -806,12 +810,13 @@ int bch2_evacuate_bucket(struct moving_context *ctxt,
|
|||
atomic64_add(sectors, &ctxt->stats->sectors_seen);
|
||||
atomic64_add(sectors, &ctxt->stats->sectors_moved);
|
||||
}
|
||||
sectors_moved += btree_sectors(c);
|
||||
}
|
||||
next:
|
||||
bch2_btree_iter_advance(&bp_iter);
|
||||
}
|
||||
|
||||
trace_evacuate_bucket(c, &bucket, dirty_sectors, bucket_size, fragmentation, ret);
|
||||
trace_evacuate_bucket(c, &bucket, sectors_moved, ca->mi.bucket_size, ret);
|
||||
err:
|
||||
bch2_trans_iter_exit(trans, &bp_iter);
|
||||
bch2_dev_put(ca);
|
||||
|
|
|
|||
|
|
@ -848,8 +848,8 @@ TRACE_EVENT(move_data,
|
|||
TRACE_EVENT(evacuate_bucket,
|
||||
TP_PROTO(struct bch_fs *c, struct bpos *bucket,
|
||||
unsigned sectors, unsigned bucket_size,
|
||||
u64 fragmentation, int ret),
|
||||
TP_ARGS(c, bucket, sectors, bucket_size, fragmentation, ret),
|
||||
int ret),
|
||||
TP_ARGS(c, bucket, sectors, bucket_size, ret),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(dev_t, dev )
|
||||
|
|
@ -857,7 +857,6 @@ TRACE_EVENT(evacuate_bucket,
|
|||
__field(u64, bucket )
|
||||
__field(u32, sectors )
|
||||
__field(u32, bucket_size )
|
||||
__field(u64, fragmentation )
|
||||
__field(int, ret )
|
||||
),
|
||||
|
||||
|
|
@ -867,15 +866,14 @@ TRACE_EVENT(evacuate_bucket,
|
|||
__entry->bucket = bucket->offset;
|
||||
__entry->sectors = sectors;
|
||||
__entry->bucket_size = bucket_size;
|
||||
__entry->fragmentation = fragmentation;
|
||||
__entry->ret = ret;
|
||||
),
|
||||
|
||||
TP_printk("%d,%d %llu:%llu sectors %u/%u fragmentation %llu ret %i",
|
||||
TP_printk("%d,%d %llu:%llu sectors %u/%u ret %i",
|
||||
MAJOR(__entry->dev), MINOR(__entry->dev),
|
||||
__entry->member, __entry->bucket,
|
||||
__entry->sectors, __entry->bucket_size,
|
||||
__entry->fragmentation, __entry->ret)
|
||||
__entry->ret)
|
||||
);
|
||||
|
||||
TRACE_EVENT(copygc,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user