diff mbox

btrfs-progs: check: fix missing newlines

Message ID 93c639e51b05a52d8cab650f0c8eb3d5fd0ef5bc.1479328997.git.osandov@fb.com (mailing list archive)
State Accepted
Headers show

Commit Message

Omar Sandoval Nov. 16, 2016, 8:54 p.m. UTC
From: Omar Sandoval <osandov@fb.com>

Also, the other progress messages go to stderr, so "checking extents"
probably should, as well.

Fixes: c7a1f66a205f ("btrfs-progs: check: switch some messages to common helpers")
Signed-off-by: Omar Sandoval <osandov@fb.com>
---
As a side note, it seems almost completely random whether we print to
stdout or stderr for any given message. That could probably use some
cleaning up for consistency. A quick run of e2fsck indicated that it
prints almost everything on stdout except for usage and administrative
problems. xfs_repair just seems to put everything in stderr. I
personally like the e2fsck approach. Anyone have any preference?

 cmds-check.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Sterba Nov. 18, 2016, 6:51 p.m. UTC | #1
On Wed, Nov 16, 2016 at 12:54:32PM -0800, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@fb.com>
> 
> Also, the other progress messages go to stderr, so "checking extents"
> probably should, as well.
> 
> Fixes: c7a1f66a205f ("btrfs-progs: check: switch some messages to common helpers")
> Signed-off-by: Omar Sandoval <osandov@fb.com>
> ---
> As a side note, it seems almost completely random whether we print to
> stdout or stderr for any given message. That could probably use some
> cleaning up for consistency. A quick run of e2fsck indicated that it
> prints almost everything on stdout except for usage and administrative
> problems. xfs_repair just seems to put everything in stderr. I
> personally like the e2fsck approach. Anyone have any preference?

Cleaning up the messages is ongoing work, most error messages have been
converted. In case of 'check', I think that stdout is good to capture
normal and error messages (so no error messages are accidentally lost if
the user runs just "check > log" instead of "check >& log").

For that printf is still the way to print them. Besides the verbosity
level could be improved, we've had complaints about that since ever.

Patch applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/cmds-check.c b/cmds-check.c
index 57c4300..3fb3bd7 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -11467,13 +11467,13 @@  int cmd_check(int argc, char **argv)
 	}
 
 	if (!ctx.progress_enabled)
-		printf("checking extents");
+		fprintf(stderr, "checking extents\n");
 	if (check_mode == CHECK_MODE_LOWMEM)
 		ret = check_chunks_and_extents_v2(root);
 	else
 		ret = check_chunks_and_extents(root);
 	if (ret)
-		printf("Errors found in extent allocation tree or chunk allocation");
+		error("errors found in extent allocation tree or chunk allocation");
 
 	ret = repair_root_items(info);
 	if (ret < 0)