diff mbox series

[2/3] btrfs-progs: receive: add debug messages when processing fallocate

Message ID 7125ba99d511229e958daa14e385224e342b8a5c.1668529099.git.fdmanana@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: receive: fix a silent data loss bug with encoded writes | expand

Commit Message

Filipe Manana Nov. 15, 2022, 4:25 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

Unlike for commands from the v1 stream, we have no debug messages logged
when processing fallocate commands, which makes it harder to debug issues.

So add log messages, when the log verbosity level is >= 3, for fallocate
commands, mentioning the value of all fields.

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

Comments

Boris Burkov Nov. 15, 2022, 8:46 p.m. UTC | #1
On Tue, Nov 15, 2022 at 04:25:25PM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> Unlike for commands from the v1 stream, we have no debug messages logged
> when processing fallocate commands, which makes it harder to debug issues.
> 
> So add log messages, when the log verbosity level is >= 3, for fallocate
> commands, mentioning the value of all fields.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Boris Burkov <boris@bur.io>
> ---
>  cmds/receive.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/cmds/receive.c b/cmds/receive.c
> index b75a5634..e6f1aeab 100644
> --- a/cmds/receive.c
> +++ b/cmds/receive.c
> @@ -1296,6 +1296,11 @@ static int process_fallocate(const char *path, int mode, u64 offset, u64 len,
>  	struct btrfs_receive *rctx = user;
>  	char full_path[PATH_MAX];
>  
> +	if (bconf.verbose >= 3)
> +		fprintf(stderr,
> +			"fallocate %s - offset=%llu, len=%llu, mode=%d\n",
> +			path, offset, len, mode);
> +
>  	ret = path_cat_out(full_path, rctx->full_subvol_path, path);
>  	if (ret < 0) {
>  		error("fallocate: path invalid: %s", path);
> -- 
> 2.35.1
>
diff mbox series

Patch

diff --git a/cmds/receive.c b/cmds/receive.c
index b75a5634..e6f1aeab 100644
--- a/cmds/receive.c
+++ b/cmds/receive.c
@@ -1296,6 +1296,11 @@  static int process_fallocate(const char *path, int mode, u64 offset, u64 len,
 	struct btrfs_receive *rctx = user;
 	char full_path[PATH_MAX];
 
+	if (bconf.verbose >= 3)
+		fprintf(stderr,
+			"fallocate %s - offset=%llu, len=%llu, mode=%d\n",
+			path, offset, len, mode);
+
 	ret = path_cat_out(full_path, rctx->full_subvol_path, path);
 	if (ret < 0) {
 		error("fallocate: path invalid: %s", path);