On 10.05.19 г. 14:15 ч., Johannes Thumshirn wrote:
> Add boilerplate code for directly including the crypto framework.
>
> This helps us flipping the switch for new algorithms.
>
> Signed-off-by: Johannes Thumshirn
Reviewed-by: Nikolay Borisov
> ---
> fs/btrfs/ctree.h | 11 +++
>
On 10.05.19 г. 14:15 ч., Johannes Thumshirn wrote:
> Commit 9678c54388b6 ("btrfs: Remove custom crc32c init code") removed the
> btrfs_crc32c() function, because it was a duplicate of the crc32c() library
> function we already have in the kernel.
>
> Resurrect it as a shim wrapper over crc32c()
On 10.05.19 г. 14:15 ч., Johannes Thumshirn wrote:
> btrfsic_test_for_metadata() directly calls the crc32c() library function
> for calculating the CRC32C checksum, but then uses btrfs_csum_final() to
> invert the result.
>
> To ease further refactoring and development around checksumming in BT
On 10 May 2019, at 9:45, Chris Mason wrote:
> On 10 May 2019, at 7:15, Johannes Thumshirn wrote:
>
>> Currently btrfs_csum_data() relied on the crc32c() wrapper around the
>> crypto
>> framework for calculating the CRCs.
>>
>> As we have our own crypto_shash structure in the fs_info now, we can
On 10 May 2019, at 7:15, Johannes Thumshirn wrote:
> Currently btrfs_csum_data() relied on the crc32c() wrapper around the
> crypto
> framework for calculating the CRCs.
>
> As we have our own crypto_shash structure in the fs_info now, we can
> directly call into the crypto framework without goin
On 10.05.19 г. 14:15 ч., Johannes Thumshirn wrote:
> Now that we have already checked for a valid checksum type before calling
> btrfs_check_super_csum(), it can be simplified even further.
>
> While at it get rid of the implicit size assumption of the resulting
> checksum as well.
>
> Signed-
On 10.05.19 г. 14:15 ч., Johannes Thumshirn wrote:
> Currently btrfs is only supporting CRC32C as checksumming algorithm. As
> this is about to change provide a function to validate the checksum type in
> the superblock against all possible algorithms.
>
> This makes adding new algorithms easie
On 10.05.19 г. 14:15 ч., Johannes Thumshirn wrote:
> Check for supported superblock checksum type before doing the actual
> checksum validation of the superblock read from disk.
This is rather terse, how does it improve the code and what was the
current status quo (e.g before this patch).
>
>
On 10.05.19 г. 14:15 ч., Johannes Thumshirn wrote:
> Add a small helper for btrfs_print_data_csum_error() which formats the
> checksum according to it's type for pretty printing.
>
> Signed-off-by: Johannes Thumshirn
Reviewed-by: Nikolay Borisov
> ---
> fs/btrfs/btrfs_inode.h | 28
On 10.05.19 г. 14:15 ч., Johannes Thumshirn wrote:
> The CRC checksum in the free space cache is not dependant on the super
> block's csum_type field but always a CRC32C.
>
> So use btrfs_crc32c() and btrfs_crc32c_final() instead of btrfs_csum_data()
> and btrfs_csum_final() for computing these
On 10.05.19 г. 16:25 ч., Nikolay Borisov wrote:
>
>
> On 10.05.19 г. 14:15 ч., Johannes Thumshirn wrote:
>> BTRFS has the implicit assumption that a checksum in btrfs_orderd_sums is 4
>> bytes. While this is true for CRC32C, it is not for any other checksum.
>>
>> Change the data type to be a
On 10.05.19 г. 14:15 ч., Johannes Thumshirn wrote:
> BTRFS has the implicit assumption that a checksum in btrfs_orderd_sums is 4
> bytes. While this is true for CRC32C, it is not for any other checksum.
>
> Change the data type to be a byte array and adjust loop index calculation
> accordingly.
On 10.05.19 г. 14:15 ч., Johannes Thumshirn wrote:
> Like btrfs_crc32c() btrfs_extref_hash() is only a shim wrapper over the
> crc32c() library function. So we can just use btrfs_crc32c() instead of
> btrfs_extref_hash().
>
> Signed-off-by: Johannes Thumshirn
I agree with Chris' feedback on t
On 10 May 2019, at 7:15, Johannes Thumshirn wrote:
> Like btrfs_crc32c() btrfs_name_hash() is only a shim wrapper over the
> crc32c() library function. So we can just use btrfs_crc32c() instead
> of
> btrfs_name_hash().
Reading through the rest of the series, but I think using
btrfs_name_hash()
On 10.05.19 г. 14:15 ч., Johannes Thumshirn wrote:
> Now that we everything in place, we can add SHA-256 as another checksum
> algorithm.
>
> SHA-256 was taken as it was the cryptographically strongest algorithm that
> can fit into the 32 Bytes we have left.
>
> Signed-off-by: Johannes Thumshi
On Tue, May 07, 2019 at 10:19:21AM +0300, Nikolay Borisov wrote:
> Here is v2 of factoring out common code when flushing ordered extent. The main
> change in this version is the switch from inode to btrfs_inode for function
> interfaces as per David's feedback.
>
> Nikolay Borisov (3):
> btrf
On Tue, May 07, 2019 at 10:23:46AM +0300, Nikolay Borisov wrote:
> The first thing code does in check_can_nocow is trying to block
> concurrent snapshots. If this fails (due to snpashot already being in
> progress) the function returns ENOSPC which makes no sense. Instead
> return EAGAIN. Despite t
On Thu, May 09, 2019 at 06:11:11PM +0300, Nikolay Borisov wrote:
> Signed-off-by: Nikolay Borisov
Added to 5.3 queue, thanks.
Like btrfs_crc32c() btrfs_name_hash() is only a shim wrapper over the
crc32c() library function. So we can just use btrfs_crc32c() instead of
btrfs_name_hash().
Signed-off-by: Johannes Thumshirn
---
fs/btrfs/ctree.h| 5 -
fs/btrfs/dir-item.c | 10 +-
fs/btrfs/inode.c
btrfs_print_data_csum_error() still assumed checksums to be 32 bit in size.
Make it size agnostic.
Signed-off-by: Johannes Thumshirn
---
fs/btrfs/btrfs_inode.h | 6 +++---
fs/btrfs/compression.c | 2 +-
fs/btrfs/inode.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --gi
Check for supported superblock checksum type before doing the actual
checksum validation of the superblock read from disk.
Signed-off-by: Johannes Thumshirn
---
fs/btrfs/disk-io.c | 8
1 file changed, 8 insertions(+)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index ab13282d91
Like btrfs_crc32c() btrfs_extref_hash() is only a shim wrapper over the
crc32c() library function. So we can just use btrfs_crc32c() instead of
btrfs_extref_hash().
Signed-off-by: Johannes Thumshirn
---
fs/btrfs/ctree.h | 9 -
fs/btrfs/inode-item.c | 6 +++---
fs/btrfs/tree-log.c
The CRC checksum in the free space cache is not dependant on the super
block's csum_type field but always a CRC32C.
So use btrfs_crc32c() and btrfs_crc32c_final() instead of btrfs_csum_data()
and btrfs_csum_final() for computing these checksums.
Signed-off-by: Johannes Thumshirn
---
fs/btrfs/fr
btrfsic_test_for_metadata() directly calls the crc32c() library function
for calculating the CRC32C checksum, but then uses btrfs_csum_final() to
invert the result.
To ease further refactoring and development around checksumming in BTRFS
convert to calling btrfs_csum_data(), which is a wrapper aro
Currently btrfs is only supporting CRC32C as checksumming algorithm. As
this is about to change provide a function to validate the checksum type in
the superblock against all possible algorithms.
This makes adding new algorithms easier as there are fewer places to adjust
when adding new algorithms
Add boilerplate code for directly including the crypto framework.
This helps us flipping the switch for new algorithms.
Signed-off-by: Johannes Thumshirn
---
fs/btrfs/ctree.h | 11 +++
fs/btrfs/disk-io.c | 49 ++---
2 files changed, 53 inser
Now that we everything in place, we can add SHA-256 as another checksum
algorithm.
SHA-256 was taken as it was the cryptographically strongest algorithm that
can fit into the 32 Bytes we have left.
Signed-off-by: Johannes Thumshirn
---
fs/btrfs/btrfs_inode.h | 3 +++
fs/btrfs/ctree.h
Later patches will need the fs_info to get the checksum function in
btrfs_csum_data() and btrfs_csum_final().
Signed-off-by: Johannes Thumshirn
---
fs/btrfs/check-integrity.c | 4 ++--
fs/btrfs/compression.c | 4 ++--
fs/btrfs/disk-io.c | 18 ++
fs/btrfs/disk-io.h
Now that we have already checked for a valid checksum type before calling
btrfs_check_super_csum(), it can be simplified even further.
While at it get rid of the implicit size assumption of the resulting
checksum as well.
Signed-off-by: Johannes Thumshirn
---
fs/btrfs/disk-io.c | 37 +++
btrfs_csum_data() and btrfs_csum_final() still have assumptions on the
checksums' type and size. Remove it so we can plumb in more types.
Signed-off-by: Johannes Thumshirn
---
fs/btrfs/check-integrity.c | 6 ++---
fs/btrfs/compression.c | 13 ++-
fs/btrfs/disk-io.c | 58
BTRFS has the implicit assumption that a checksum in btrfs_orderd_sums is 4
bytes. While this is true for CRC32C, it is not for any other checksum.
Change the data type to be a byte array and adjust loop index calculation
accordingly.
Signed-off-by: Johannes Thumshirn
---
fs/btrfs/compression.c
Add a small helper for btrfs_print_data_csum_error() which formats the
checksum according to it's type for pretty printing.
Signed-off-by: Johannes Thumshirn
---
fs/btrfs/btrfs_inode.h | 28
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/btrf
BTRFS has the implicit assumption that a checksum in compressed_bio is 4
bytes. While this is true for CRC32C, it is not for any other checksum.
Change the data type to be a byte array and adjust loop index calculation
accordingly.
Signed-off-by: Johannes Thumshirn
---
fs/btrfs/compression.c |
Currently btrfs_csum_data() relied on the crc32c() wrapper around the crypto
framework for calculating the CRCs.
As we have our own crypto_shash structure in the fs_info now, we can
directly call into the crypto framework without going trough the wrapper.
Signed-off-by: Johannes Thumshirn
---
f
This patchset add support for adding new checksum types in BTRFS.
Currently BTRFS only supports CRC32C as data and metadata checksum, which is
good if you only want to detect errors due to data corruption in hardware.
But CRC32C isn't able cover other use-cases like de-duplication or
cryptographi
Commit 9678c54388b6 ("btrfs: Remove custom crc32c init code") removed the
btrfs_crc32c() function, because it was a duplicate of the crc32c() library
function we already have in the kernel.
Resurrect it as a shim wrapper over crc32c() to make following
transformations of the checksumming code in b
36 matches
Mail list logo