-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Btrfs: Endianess bug fix for v0.13 with kernels
Fix for a endianess BUG when using btrfs v0.13 with kernels older than 2.6.23 Problem: Has of v0.13, btrfs-progs is using crc32c.c equivalent to the one found on linux-2.6.23/lib/libcrc32c.c Since crc32c_le() changed in linux-2.6.23, when running btrfs v0.13 with older kernels we have a missmatch between the versions of crc32c_le() from btrfs-progs and libcrc32c in the kernel. This missmatch causes a bug when using btrfs on big endian machines. Solution: btrfs_crc32c() macro that when compiling for kernels older than 2.6.23, does endianess conversion to parameters and return value of crc32c(). This endianess conversion nullifies the differences in implementation of crc32c_le(). If kernel 2.6.23 or better, it calls crc32c(). Signed-off-by: Miguel Sousa Filipe <miguel.filipe@gmail.com> --- Signed-off-by: Chris Mason <chris.mason@oracle.com>
- Loading branch information
Miguel
authored and
Chris Mason
committed
Sep 25, 2008
1 parent
587f770
commit a5eb62e
Showing
3 changed files
with
24 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <asm/byteorder.h> | ||
#include <linux/crc32c.h> | ||
#include <linux/version.h> | ||
|
||
/** | ||
* implementation of crc32c_le() changed in linux-2.6.23, | ||
* has of v0.13 btrfs-progs is using the latest version. | ||
* We must workaround older implementations of crc32c_le() | ||
* found on older kernel versions. | ||
*/ | ||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) | ||
#define btrfs_crc32c(seed, data, length) \ | ||
__cpu_to_le32( crc32c( __le32_to_cpu(seed), data, length) ) | ||
#else | ||
#define btrfs_crc32c(seed, data, length) \ | ||
crc32c(seed, data, length) | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters