diff options
| author | Kent Overstreet <[email protected]> | 2025-03-26 17:21:11 +0000 |
|---|---|---|
| committer | Kent Overstreet <[email protected]> | 2025-03-29 02:31:47 +0000 |
| commit | 1ece53237e83edb12cb6c1a8b91f54735e64d95f (patch) | |
| tree | d75fec57aa2673a24e64c471e42c2db801e73c1b /fs/bcachefs/printbuf.c | |
| parent | bcachefs: Add an "ignore unknown" option to bch2_parse_mount_opts() (diff) | |
| download | kernel-1ece53237e83edb12cb6c1a8b91f54735e64d95f.tar.gz kernel-1ece53237e83edb12cb6c1a8b91f54735e64d95f.zip | |
bcachefs: Consistent indentation of multiline fsck errors
Add the new helper printbuf_indent_add_nextline(), and use it in
__bch2_fsck_err() to centralize setting the indentation of multiline
fsck errors.
Signed-off-by: Kent Overstreet <[email protected]>
Diffstat (limited to 'fs/bcachefs/printbuf.c')
| -rw-r--r-- | fs/bcachefs/printbuf.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/bcachefs/printbuf.c b/fs/bcachefs/printbuf.c index 4cf5a2af1e6f..3302bbc78a09 100644 --- a/fs/bcachefs/printbuf.c +++ b/fs/bcachefs/printbuf.c @@ -277,6 +277,25 @@ void bch2_printbuf_indent_add(struct printbuf *buf, unsigned spaces) } /** + * bch2_printbuf_indent_add_nextline() - add to the current indent level for + * subsequent lines + * + * @buf: printbuf to control + * @spaces: number of spaces to add to the current indent level + * + * Subsequent lines - not the current line - will be indented by @spaces more + * spaces. + */ +void bch2_printbuf_indent_add_nextline(struct printbuf *buf, unsigned spaces) +{ + if (WARN_ON_ONCE(buf->indent + spaces < buf->indent)) + spaces = 0; + + buf->indent += spaces; + buf->has_indent_or_tabstops = true; +} + +/** * bch2_printbuf_indent_sub() - subtract from the current indent level * * @buf: printbuf to control |
