diff options
author | Pete Zaitcev <zaitcev@kotori.zaitcev.us> | 2019-02-12 22:08:26 -0600 |
---|---|---|
committer | Tim Burke <tim@swiftstack.com> | 2019-02-13 21:25:33 +0000 |
commit | 7e97b2f808e1115425eef527899b27528f05af3a (patch) | |
tree | 205ce9a1e8e68017f18ae73a5e82e8f5150c11db /src/erasurecode.c | |
parent | 405775cba1d1ac06b86b2fab64e8f9d03ab2fd0e (diff) | |
download | liberasurecode-7e97b2f808e1115425eef527899b27528f05af3a.tar.gz |
Make our alt crc32 more portable
Apparently the author of our old crc32 assumed that shifting an int
to the right sign-extends, which is not always the case. Result is,
building and running make test on s390x fails. The fix is to force
a sign-extension using the "xor 0x80; sub 0x80" trick.
N.B. This does not cause a compatibility problem, because by a
miracle the "broken" crc32_alt was actually computing a stock
crc32, same that zlib has. Therefore, if someone, somewhere,
ran a Swift cluster on s390x with erasure coding policy,
the data in it is already stored with zlib checksums, as we
do it now anyway. This fix only permits the tests pass, which
used the bad data sample from x86.
Change-Id: Ibd5e4e6c02be00540a9648cc7e0f8efda275bf3f
Related-Change: Ib5ea2a830c7c23d66bf2ca404a3eb84ad00c5bc5
Related-Bug: 1666320
Diffstat (limited to 'src/erasurecode.c')
-rw-r--r-- | src/erasurecode.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/erasurecode.c b/src/erasurecode.c index dd59ae5..a660588 100644 --- a/src/erasurecode.c +++ b/src/erasurecode.c @@ -1045,8 +1045,7 @@ int liberasurecode_get_fragment_metadata(char *fragment, } /* Verify metadata checksum */ - if (is_invalid_fragment_header( - (fragment_header_t *) fragment)) { + if (is_invalid_fragment_header((fragment_header_t *) fragment)) { log_error("Invalid fragment header information!"); ret = -EBADHEADER; goto out; |