diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-02-25 13:17:48 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:25 -0400 |
commit | 2be7b16eee9442f2c45ebde19bd3b50fcd030515 (patch) | |
tree | fd15ab6ad792d73616cc60813b6b5277d5f931ab /fs/bcachefs/util.h | |
parent | eb7bd15fe4e7a4a6cf05d9086722aad49f80c259 (diff) |
bcachefs: Convert bch2_pd_controller_print_debug() to a printbuf
Fewer random on-stack char arrays.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/util.h')
-rw-r--r-- | fs/bcachefs/util.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h index 426c3009f292..58427edcfaa4 100644 --- a/fs/bcachefs/util.h +++ b/fs/bcachefs/util.h @@ -582,7 +582,7 @@ struct bch_pd_controller { void bch2_pd_controller_update(struct bch_pd_controller *, s64, s64, int); void bch2_pd_controller_init(struct bch_pd_controller *); -size_t bch2_pd_controller_print_debug(struct bch_pd_controller *, char *); +void bch2_pd_controller_debug_to_text(struct printbuf *, struct bch_pd_controller *); #define sysfs_pd_controller_attribute(name) \ rw_attribute(name##_rate); \ @@ -605,8 +605,10 @@ do { \ sysfs_print(name##_rate_d_term, (var)->d_term); \ sysfs_print(name##_rate_p_term_inverse, (var)->p_term_inverse); \ \ - if (attr == &sysfs_##name##_rate_debug) \ - return bch2_pd_controller_print_debug(var, buf); \ + if (attr == &sysfs_##name##_rate_debug) { \ + bch2_pd_controller_debug_to_text(&out, var); \ + return out.pos - buf; \ + } \ } while (0) #define sysfs_pd_controller_store(name, var) \ |