Commit 68b6cd19 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Improve bucket_alloc tracepoint

It now includes more info - whether the bucket was for metadata or data
- and also call it in the same place as the bucket_alloc_fail
tracepoint.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent c298fd7d
...@@ -587,6 +587,8 @@ static struct open_bucket *bch2_bucket_alloc_trans(struct btree_trans *trans, ...@@ -587,6 +587,8 @@ static struct open_bucket *bch2_bucket_alloc_trans(struct btree_trans *trans,
if (!IS_ERR(ob)) if (!IS_ERR(ob))
trace_and_count(c, bucket_alloc, ca, trace_and_count(c, bucket_alloc, ca,
bch2_alloc_reserves[reserve], bch2_alloc_reserves[reserve],
may_alloc_partial,
ob->bucket,
usage.d[BCH_DATA_free].buckets, usage.d[BCH_DATA_free].buckets,
avail, avail,
bch2_copygc_wait_amount(c), bch2_copygc_wait_amount(c),
...@@ -600,6 +602,8 @@ static struct open_bucket *bch2_bucket_alloc_trans(struct btree_trans *trans, ...@@ -600,6 +602,8 @@ static struct open_bucket *bch2_bucket_alloc_trans(struct btree_trans *trans,
else else
trace_and_count(c, bucket_alloc_fail, ca, trace_and_count(c, bucket_alloc_fail, ca,
bch2_alloc_reserves[reserve], bch2_alloc_reserves[reserve],
may_alloc_partial,
0,
usage.d[BCH_DATA_free].buckets, usage.d[BCH_DATA_free].buckets,
avail, avail,
bch2_copygc_wait_amount(c), bch2_copygc_wait_amount(c),
......
...@@ -512,6 +512,8 @@ DEFINE_EVENT(bch_fs, gc_gens_end, ...@@ -512,6 +512,8 @@ DEFINE_EVENT(bch_fs, gc_gens_end,
DECLARE_EVENT_CLASS(bucket_alloc, DECLARE_EVENT_CLASS(bucket_alloc,
TP_PROTO(struct bch_dev *ca, const char *alloc_reserve, TP_PROTO(struct bch_dev *ca, const char *alloc_reserve,
bool user,
u64 bucket,
u64 free, u64 free,
u64 avail, u64 avail,
u64 copygc_wait_amount, u64 copygc_wait_amount,
...@@ -522,12 +524,15 @@ DECLARE_EVENT_CLASS(bucket_alloc, ...@@ -522,12 +524,15 @@ DECLARE_EVENT_CLASS(bucket_alloc,
u64 nouse, u64 nouse,
bool nonblocking, bool nonblocking,
const char *err), const char *err),
TP_ARGS(ca, alloc_reserve, free, avail, copygc_wait_amount, copygc_waiting_for, TP_ARGS(ca, alloc_reserve, user, bucket, free, avail,
copygc_wait_amount, copygc_waiting_for,
seen, open, need_journal_commit, nouse, nonblocking, err), seen, open, need_journal_commit, nouse, nonblocking, err),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(dev_t, dev ) __field(dev_t, dev )
__array(char, reserve, 16 ) __array(char, reserve, 16 )
__field(bool, user )
__field(u64, bucket )
__field(u64, free ) __field(u64, free )
__field(u64, avail ) __field(u64, avail )
__field(u64, copygc_wait_amount ) __field(u64, copygc_wait_amount )
...@@ -537,12 +542,14 @@ DECLARE_EVENT_CLASS(bucket_alloc, ...@@ -537,12 +542,14 @@ DECLARE_EVENT_CLASS(bucket_alloc,
__field(u64, need_journal_commit ) __field(u64, need_journal_commit )
__field(u64, nouse ) __field(u64, nouse )
__field(bool, nonblocking ) __field(bool, nonblocking )
__array(char, err, 16 ) __array(char, err, 32 )
), ),
TP_fast_assign( TP_fast_assign(
__entry->dev = ca->dev; __entry->dev = ca->dev;
strlcpy(__entry->reserve, alloc_reserve, sizeof(__entry->reserve)); strlcpy(__entry->reserve, alloc_reserve, sizeof(__entry->reserve));
__entry->user = user;
__entry->bucket = bucket;
__entry->free = free; __entry->free = free;
__entry->avail = avail; __entry->avail = avail;
__entry->copygc_wait_amount = copygc_wait_amount; __entry->copygc_wait_amount = copygc_wait_amount;
...@@ -555,9 +562,11 @@ DECLARE_EVENT_CLASS(bucket_alloc, ...@@ -555,9 +562,11 @@ DECLARE_EVENT_CLASS(bucket_alloc,
strlcpy(__entry->err, err, sizeof(__entry->err)); strlcpy(__entry->err, err, sizeof(__entry->err));
), ),
TP_printk("%d,%d reserve %s free %llu avail %llu copygc_wait %llu/%lli seen %llu open %llu need_journal_commit %llu nouse %llu nonblocking %u err %s", TP_printk("%d,%d reserve %s user %u bucket %llu free %llu avail %llu copygc_wait %llu/%lli seen %llu open %llu need_journal_commit %llu nouse %llu nonblocking %u err %s",
MAJOR(__entry->dev), MINOR(__entry->dev), MAJOR(__entry->dev), MINOR(__entry->dev),
__entry->reserve, __entry->reserve,
__entry->user,
__entry->bucket,
__entry->free, __entry->free,
__entry->avail, __entry->avail,
__entry->copygc_wait_amount, __entry->copygc_wait_amount,
...@@ -572,6 +581,8 @@ DECLARE_EVENT_CLASS(bucket_alloc, ...@@ -572,6 +581,8 @@ DECLARE_EVENT_CLASS(bucket_alloc,
DEFINE_EVENT(bucket_alloc, bucket_alloc, DEFINE_EVENT(bucket_alloc, bucket_alloc,
TP_PROTO(struct bch_dev *ca, const char *alloc_reserve, TP_PROTO(struct bch_dev *ca, const char *alloc_reserve,
bool user,
u64 bucket,
u64 free, u64 free,
u64 avail, u64 avail,
u64 copygc_wait_amount, u64 copygc_wait_amount,
...@@ -582,12 +593,15 @@ DEFINE_EVENT(bucket_alloc, bucket_alloc, ...@@ -582,12 +593,15 @@ DEFINE_EVENT(bucket_alloc, bucket_alloc,
u64 nouse, u64 nouse,
bool nonblocking, bool nonblocking,
const char *err), const char *err),
TP_ARGS(ca, alloc_reserve, free, avail, copygc_wait_amount, copygc_waiting_for, TP_ARGS(ca, alloc_reserve, user, bucket, free, avail,
copygc_wait_amount, copygc_waiting_for,
seen, open, need_journal_commit, nouse, nonblocking, err) seen, open, need_journal_commit, nouse, nonblocking, err)
); );
DEFINE_EVENT(bucket_alloc, bucket_alloc_fail, DEFINE_EVENT(bucket_alloc, bucket_alloc_fail,
TP_PROTO(struct bch_dev *ca, const char *alloc_reserve, TP_PROTO(struct bch_dev *ca, const char *alloc_reserve,
bool user,
u64 bucket,
u64 free, u64 free,
u64 avail, u64 avail,
u64 copygc_wait_amount, u64 copygc_wait_amount,
...@@ -598,7 +612,8 @@ DEFINE_EVENT(bucket_alloc, bucket_alloc_fail, ...@@ -598,7 +612,8 @@ DEFINE_EVENT(bucket_alloc, bucket_alloc_fail,
u64 nouse, u64 nouse,
bool nonblocking, bool nonblocking,
const char *err), const char *err),
TP_ARGS(ca, alloc_reserve, free, avail, copygc_wait_amount, copygc_waiting_for, TP_ARGS(ca, alloc_reserve, user, bucket, free, avail,
copygc_wait_amount, copygc_waiting_for,
seen, open, need_journal_commit, nouse, nonblocking, err) seen, open, need_journal_commit, nouse, nonblocking, err)
); );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment