diff mbox series

Btrfs-progs: receive, add debug information to write and clone commands

Message ID 20190329193526.21315-1-fdmanana@kernel.org (mailing list archive)
State New, archived
Headers show
Series Btrfs-progs: receive, add debug information to write and clone commands | expand

Commit Message

Filipe Manana March 29, 2019, 7:35 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

Currently, when operating in a more verbose mode (-vv), the receive command
does not mention any write or clone commands, unlike other commands.

This change adds debug messages for the write and clone operations, that do
not include data but only offsets and lengths, as this is actually very
useful to debug a send stream and I use it frequently.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 cmds-receive.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

David Sterba May 15, 2019, 2:21 p.m. UTC | #1
On Fri, Mar 29, 2019 at 07:35:26PM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> Currently, when operating in a more verbose mode (-vv), the receive command
> does not mention any write or clone commands, unlike other commands.
> 
> This change adds debug messages for the write and clone operations, that do
> not include data but only offsets and lengths, as this is actually very
> useful to debug a send stream and I use it frequently.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Added to devel, sorry for the delay.
diff mbox series

Patch

diff --git a/cmds-receive.c b/cmds-receive.c
index 3888149a..5d06f286 100644
--- a/cmds-receive.c
+++ b/cmds-receive.c
@@ -704,6 +704,10 @@  static int process_write(const char *path, const void *data, u64 offset,
 	if (ret < 0)
 		goto out;
 
+	if (g_verbose >= 2)
+		fprintf(stderr, "write %s - offset=%llu length=%llu\n",
+			path, offset, len);
+
 	while (pos < len) {
 		w = pwrite(rctx->write_fd, (char*)data + pos, len - pos,
 				offset + pos);
@@ -808,6 +812,11 @@  static int process_clone(const char *path, u64 offset, u64 len,
 		goto out;
 	}
 
+	if (g_verbose >= 2)
+		fprintf(stderr,
+			"clone %s - source=%s source offset=%llu offset=%llu length=%llu\n",
+			path, clone_path, clone_offset, offset, len);
+
 	clone_args.src_fd = clone_fd;
 	clone_args.src_offset = clone_offset;
 	clone_args.src_length = len;