summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/clock.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-07-25 23:06:11 +0200
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 23:08:43 +0200
commit7807e143849e0f86fce6ce7d4907412915d29918 (patch)
tree410c1bdd413ebaf858d72bb6e33ec8ad152f5937 /fs/bcachefs/clock.c
parentbcachefs: Remove some uses of PAGE_SIZE in the btree code (diff)
downloadlinux-7807e143849e0f86fce6ce7d4907412915d29918.tar.xz
linux-7807e143849e0f86fce6ce7d4907412915d29918.zip
bcachefs: Convert various code to printbuf
printbufs know how big the buffer is that was allocated, so we can get rid of the random PAGE_SIZEs all over the place. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/clock.c')
-rw-r--r--fs/bcachefs/clock.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/bcachefs/clock.c b/fs/bcachefs/clock.c
index 163058173252..869ba1887757 100644
--- a/fs/bcachefs/clock.c
+++ b/fs/bcachefs/clock.c
@@ -152,9 +152,8 @@ void __bch2_increment_clock(struct io_clock *clock, unsigned sectors)
timer->fn(timer);
}
-ssize_t bch2_io_timers_show(struct io_clock *clock, char *buf)
+void bch2_io_timers_to_text(struct printbuf *out, struct io_clock *clock)
{
- struct printbuf out = _PBUF(buf, PAGE_SIZE);
unsigned long now;
unsigned i;
@@ -162,12 +161,10 @@ ssize_t bch2_io_timers_show(struct io_clock *clock, char *buf)
now = atomic_long_read(&clock->now);
for (i = 0; i < clock->timers.used; i++)
- pr_buf(&out, "%ps:\t%li\n",
+ pr_buf(out, "%ps:\t%li\n",
clock->timers.data[i]->fn,
clock->timers.data[i]->expire - now);
spin_unlock(&clock->timer_lock);
-
- return out.pos - buf;
}
void bch2_io_clock_exit(struct io_clock *clock)