public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Boris Burkov <boris@bur.io>
To: fdmanana@kernel.org
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/3] btrfs-progs: receive: add debug messages when processing encoded writes
Date: Tue, 15 Nov 2022 12:45:47 -0800	[thread overview]
Message-ID: <Y3P6e7h+/5C8/Vl8@zen> (raw)
In-Reply-To: <90290fe5047d688d8eecdc1357e9379252ae5352.1668529099.git.fdmanana@suse.com>

On Tue, Nov 15, 2022 at 04:25:24PM +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 encoded write commands, which makes it harder to debug
> issues.
> 
> So add log messages, when the log verbosity level is >= 3, for encoded
> write commands, mentioning the value of all fields and also log when we
> fallback from an encoded write to the decompress and write approach.
> 
> The log messages look like this:
> 
>   encoded_write f3 - offset=33792, len=4096, unencoded_offset=33792, unencoded_file_len=31744, unencoded_len=65536, compression=1, encryption=0
>   encoded_write f3 - falling back to decompress and write due to errno 22 ("Invalid argument")
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Boris Burkov <boris@bur.io>
> ---
>  cmds/receive.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/cmds/receive.c b/cmds/receive.c
> index 6f475544..b75a5634 100644
> --- a/cmds/receive.c
> +++ b/cmds/receive.c
> @@ -1246,6 +1246,13 @@ static int process_encoded_write(const char *path, const void *data, u64 offset,
>  		.encryption = encryption,
>  	};
>  
> +	if (bconf.verbose >= 3)
> +		fprintf(stderr,
> +"encoded_write %s - offset=%llu, len=%llu, unencoded_offset=%llu, unencoded_file_len=%llu, unencoded_len=%llu, compression=%u, encryption=%u\n",
> +			path, offset, len, unencoded_offset, unencoded_file_len,
> +			unencoded_len, compression, encryption);
> +
> +
>  	if (encryption) {
>  		error("encoded_write: encryption not supported");
>  		return -EOPNOTSUPP;
> @@ -1271,6 +1278,10 @@ static int process_encoded_write(const char *path, const void *data, u64 offset,
>  			error("encoded_write: writing to %s failed: %m", path);
>  			return ret;
>  		}
> +		if (bconf.verbose >= 3)
> +			fprintf(stderr,
> +"encoded_write %s - falling back to decompress and write due to errno %d (\"%m\")\n",
> +				path, errno);
>  	}
>  
>  	return decompress_and_write(rctx, data, offset, len, unencoded_file_len,
> -- 
> 2.35.1
> 

  reply	other threads:[~2022-11-15 20:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15 16:25 [PATCH 0/3] btrfs-progs: receive: fix a silent data loss bug with encoded writes fdmanana
2022-11-15 16:25 ` [PATCH 1/3] btrfs-progs: receive: add debug messages when processing " fdmanana
2022-11-15 20:45   ` Boris Burkov [this message]
2022-11-15 16:25 ` [PATCH 2/3] btrfs-progs: receive: add debug messages when processing fallocate fdmanana
2022-11-15 20:46   ` Boris Burkov
2022-11-15 16:25 ` [PATCH 3/3] btrfs-progs: receive: fix silent data loss after fall back from encoded write fdmanana
2022-11-15 20:45   ` Boris Burkov
2022-11-15 16:37 ` [PATCH 0/3] btrfs-progs: receive: fix a silent data loss bug with encoded writes Christoph Anton Mitterer
2022-11-15 16:47   ` Filipe Manana
2022-11-15 16:53     ` Christoph Anton Mitterer
2022-11-16 10:50       ` Filipe Manana
2022-11-16 17:03         ` Christoph Anton Mitterer
2022-11-15 16:50 ` there should be some better way to inform interested people about data corruption issues Christoph Anton Mitterer
2022-11-23 18:55 ` [PATCH 0/3] btrfs-progs: receive: fix a silent data loss bug with encoded writes David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y3P6e7h+/5C8/Vl8@zen \
    --to=boris@bur.io \
    --cc=fdmanana@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox