diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-11-09 22:49:03 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2019-11-09 22:49:03 -0500 |
commit | 1f7098c22213bbe66896f390a529223468a3986e (patch) | |
tree | 4f791db0a1cd2bfa9c568b46ffed73ce641c8d57 /libbcachefs/clock.h | |
parent | f597e81aab00d0f5174f104f967cbf20da7c51c7 (diff) |
Update bcachefs sources to b1a4dc53be bcachefs: Set lost+found mode to 0700
Diffstat (limited to 'libbcachefs/clock.h')
-rw-r--r-- | libbcachefs/clock.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libbcachefs/clock.h b/libbcachefs/clock.h index 5cb043c5..bfbbca8a 100644 --- a/libbcachefs/clock.h +++ b/libbcachefs/clock.h @@ -6,7 +6,18 @@ void bch2_io_timer_add(struct io_clock *, struct io_timer *); void bch2_io_timer_del(struct io_clock *, struct io_timer *); void bch2_kthread_io_clock_wait(struct io_clock *, unsigned long, unsigned long); -void bch2_increment_clock(struct bch_fs *, unsigned, int); + +void __bch2_increment_clock(struct io_clock *); + +static inline void bch2_increment_clock(struct bch_fs *c, unsigned sectors, + int rw) +{ + struct io_clock *clock = &c->io_clock[rw]; + + if (unlikely(this_cpu_add_return(*clock->pcpu_buf, sectors) >= + IO_CLOCK_PCPU_SECTORS)) + __bch2_increment_clock(clock); +} void bch2_io_clock_schedule_timeout(struct io_clock *, unsigned long); |