bcachefs: printbuf improvements
authorKent Overstreet <kent.overstreet@linux.dev>
Wed, 10 Apr 2024 18:32:45 +0000 (14:32 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 8 May 2024 21:29:17 +0000 (17:29 -0400)
commitacce32a51e6c32e0ad8f921f9af2226e6750bb51
tree9e62ed6dbf8eb0e8b2e6c648f6a19e0ce8c05162
parent62606398d5d718186d914d8f30be34177dc3f26d
bcachefs: printbuf improvements

- fix assorted (harmless) off-by-one errors
- we were inconsistent on whether out->pos stays <= out->size on
  overflow; now it does, and printbuf.overflow exists to indicate if a
  printbuf has overflowed
- factor out printbuf_advance_pos()
- printbuf_nul_terminate_reserved(); use this to reduce the number of
  printbuf_make_room() calls

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/printbuf.c
fs/bcachefs/printbuf.h