Commit f1ca1abf authored by Kent Overstreet's avatar Kent Overstreet
Browse files

bcachefs: pull out time_stats.[ch]



prep work for lifting out of fs/bcachefs/

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent cdce1094
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ bcachefs-y := \
	super-io.o		\
	sysfs.o			\
	tests.o			\
	time_stats.o		\
	thread_with_file.o	\
	trace.o			\
	two_state_shared_lock.o	\
+4 −9
Original line number Diff line number Diff line
@@ -236,8 +236,7 @@ static struct open_bucket *__try_alloc_bucket(struct bch_fs *c, struct bch_dev *
		if (cl)
			closure_wait(&c->open_buckets_wait, cl);

		track_event_change(&c->times[BCH_TIME_blocked_allocate_open_bucket],
				   &c->blocked_allocate_open_bucket, true);
		track_event_change(&c->times[BCH_TIME_blocked_allocate_open_bucket], true);
		spin_unlock(&c->freelist_lock);
		return ERR_PTR(-BCH_ERR_open_buckets_empty);
	}
@@ -263,11 +262,8 @@ static struct open_bucket *__try_alloc_bucket(struct bch_fs *c, struct bch_dev *
	ca->nr_open_buckets++;
	bch2_open_bucket_hash_add(c, ob);

	track_event_change(&c->times[BCH_TIME_blocked_allocate_open_bucket],
			   &c->blocked_allocate_open_bucket, false);

	track_event_change(&c->times[BCH_TIME_blocked_allocate],
			   &c->blocked_allocate, false);
	track_event_change(&c->times[BCH_TIME_blocked_allocate_open_bucket], false);
	track_event_change(&c->times[BCH_TIME_blocked_allocate], false);

	spin_unlock(&c->freelist_lock);
	return ob;
@@ -555,8 +551,7 @@ static struct open_bucket *bch2_bucket_alloc_trans(struct btree_trans *trans,
			goto again;
		}

		track_event_change(&c->times[BCH_TIME_blocked_allocate],
				   &c->blocked_allocate, true);
		track_event_change(&c->times[BCH_TIME_blocked_allocate], true);

		ob = ERR_PTR(-BCH_ERR_freelist_empty);
		goto err;
+1 −2
Original line number Diff line number Diff line
@@ -212,6 +212,7 @@
#include "recovery_types.h"
#include "sb-errors_types.h"
#include "seqmutex.h"
#include "time_stats.h"
#include "util.h"

#ifdef CONFIG_BCACHEFS_DEBUG
@@ -924,8 +925,6 @@ struct bch_fs {
	/* ALLOCATOR */
	spinlock_t		freelist_lock;
	struct closure_waitlist	freelist_wait;
	u64			blocked_allocate;
	u64			blocked_allocate_open_bucket;

	open_bucket_idx_t	open_buckets_freelist;
	open_bucket_idx_t	open_buckets_nr_free;
+1 −2
Original line number Diff line number Diff line
@@ -566,8 +566,7 @@ static int __journal_res_get(struct journal *j, struct journal_res *res,
		ret = -BCH_ERR_journal_res_get_blocked;

	if (ret == JOURNAL_ERR_max_in_flight &&
	    track_event_change(&c->times[BCH_TIME_blocked_journal_max_in_flight],
			       &j->max_in_flight_start, true)) {
	    track_event_change(&c->times[BCH_TIME_blocked_journal_max_in_flight], true)) {

		struct printbuf buf = PRINTBUF;
		prt_printf(&buf, "seq %llu\n", journal_cur_seq(j));
+1 −2
Original line number Diff line number Diff line
@@ -1680,8 +1680,7 @@ static CLOSURE_CALLBACK(journal_write_done)
		bch2_journal_reclaim_fast(j);
		bch2_journal_space_available(j);

		track_event_change(&c->times[BCH_TIME_blocked_journal_max_in_flight],
				   &j->max_in_flight_start, false);
		track_event_change(&c->times[BCH_TIME_blocked_journal_max_in_flight], false);

		journal_wake(j);
	}
Loading