All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: "Dāvis Mosāns" <davispuh@gmail.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2] btrfs-progs: Fix checksum output for "checksum verify failed"
Date: Fri, 5 Mar 2021 17:30:31 +0100	[thread overview]
Message-ID: <20210305163031.GZ7604@twin.jikos.cz> (raw)
In-Reply-To: <20210303191843.6878-1-davispuh@gmail.com>

On Wed, Mar 03, 2021 at 09:18:44PM +0200, Dāvis Mosāns wrote:
> Currently only single checksum byte is outputted.
> This fixes it so that full checksum is outputted.
> 
> Signed-off-by: Dāvis Mosāns <davispuh@gmail.com>
> ---
>  kernel-shared/disk-io.c | 32 +++++++++++++++++++++++++++-----
>  1 file changed, 27 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel-shared/disk-io.c b/kernel-shared/disk-io.c
> index 6f584986..10b2421e 100644
> --- a/kernel-shared/disk-io.c
> +++ b/kernel-shared/disk-io.c
> @@ -160,10 +160,30 @@ int btrfs_csum_data(u16 csum_type, const u8 *data, u8 *out, size_t len)
>  	return -1;
>  }
>  
> +int btrfs_format_csum(u16 csum_type, u16 csum_size, const char *data, char *output)
> +{
> +	int i;
> +	int position = 0;
> +	int direction = 1;
> +	if (csum_type == BTRFS_CSUM_TYPE_CRC32 ||
> +		csum_type == BTRFS_CSUM_TYPE_XXHASH) {
> +		position = csum_size - 1;
> +		direction = -1;
> +	}

Per the discussion, I've dropped the direction variable and added the
"0x" prefix. The csum_size does not need to be passed, though it's
available in the caller's context. The type should be enough and then
the function can find the size independently.

Updated patch added to devel, thanks.

      reply	other threads:[~2021-03-05 16:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-27 20:07 [PATCH] btrfs-progs: Fix checksum output for "checksum verify failed" Dāvis Mosāns
2021-03-02 14:17 ` David Sterba
2021-03-03 19:39   ` Dāvis Mosāns
2021-03-05 16:10     ` David Sterba
2021-03-03 19:18 ` [PATCH v2] " Dāvis Mosāns
2021-03-05 16:30   ` David Sterba [this message]

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=20210305163031.GZ7604@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=davispuh@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.