diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-03-18 20:42:10 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:08:18 +0300 |
commit | 49a67206e4e481a097a3586fbd88ce0deb646307 (patch) | |
tree | 73509ee2096664eb52e935301f50fd5730ea6b70 /fs/bcachefs/alloc_foreground.c | |
parent | 7c648fe8991a267886b262e8988546ec87ad926e (diff) | |
download | linux-49a67206e4e481a097a3586fbd88ce0deb646307.tar.xz |
bcachefs: Add more time stats for being blocked on allocator
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/alloc_foreground.c')
-rw-r--r-- | fs/bcachefs/alloc_foreground.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/bcachefs/alloc_foreground.c b/fs/bcachefs/alloc_foreground.c index ba0640e3f981..334bc6576b3a 100644 --- a/fs/bcachefs/alloc_foreground.c +++ b/fs/bcachefs/alloc_foreground.c @@ -246,6 +246,10 @@ struct open_bucket *bch2_bucket_alloc(struct bch_fs *c, struct bch_dev *ca, if (unlikely(c->open_buckets_nr_free <= open_buckets_reserved(reserve))) { if (cl) closure_wait(&c->open_buckets_wait, cl); + + if (!c->blocked_allocate_open_bucket) + c->blocked_allocate_open_bucket = local_clock(); + spin_unlock(&c->freelist_lock); trace_open_bucket_alloc_fail(ca, reserve); return ERR_PTR(-OPEN_BUCKETS_EMPTY); @@ -276,6 +280,9 @@ struct open_bucket *bch2_bucket_alloc(struct bch_fs *c, struct bch_dev *ca, if (cl) closure_wait(&c->freelist_wait, cl); + if (!c->blocked_allocate) + c->blocked_allocate = local_clock(); + spin_unlock(&c->freelist_lock); trace_bucket_alloc_fail(ca, reserve); @@ -301,6 +308,20 @@ out: bucket_io_clock_reset(c, ca, bucket, WRITE); spin_unlock(&ob->lock); + if (c->blocked_allocate_open_bucket) { + bch2_time_stats_update( + &c->times[BCH_TIME_blocked_allocate_open_bucket], + c->blocked_allocate_open_bucket); + c->blocked_allocate_open_bucket = 0; + } + + if (c->blocked_allocate) { + bch2_time_stats_update( + &c->times[BCH_TIME_blocked_allocate], + c->blocked_allocate); + c->blocked_allocate = 0; + } + spin_unlock(&c->freelist_lock); bch2_wake_allocator(ca); |