diff options
author | Miguel | 2008-04-11 21:45:51 +0200 |
---|---|---|
committer | Chris Mason | 2008-09-25 17:04:01 +0200 |
commit | a5eb62e345fc1818d0d8b6181463200a9e8dfe39 (patch) | |
tree | 2e67b0628c8312d941f52edadc6c49bd8ac4c914 /fs/btrfs/disk-io.c | |
parent | Btrfs: Fixup a few u64<->pointer casts for 32 bit (diff) | |
download | kernel-qcow2-linux-a5eb62e345fc1818d0d8b6181463200a9e8dfe39.tar.gz kernel-qcow2-linux-a5eb62e345fc1818d0d8b6181463200a9e8dfe39.tar.xz kernel-qcow2-linux-a5eb62e345fc1818d0d8b6181463200a9e8dfe39.zip |
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>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index e22960e23501..0bfcc31d94d7 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -18,13 +18,13 @@ #include <linux/fs.h> #include <linux/blkdev.h> -#include <linux/crc32c.h> #include <linux/scatterlist.h> #include <linux/swap.h> #include <linux/radix-tree.h> #include <linux/writeback.h> #include <linux/buffer_head.h> // for block_sync_page #include <linux/workqueue.h> +#include "crc32c.h" #include "ctree.h" #include "disk-io.h" #include "transaction.h" @@ -100,7 +100,7 @@ out: u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len) { - return crc32c(seed, data, len); + return btrfs_crc32c(seed, data, len); } void btrfs_csum_final(u32 crc, char *result) |