diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2018-05-17 01:38:57 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2018-05-17 02:36:19 -0400 |
commit | ff86d4722124c300c40b85b6eb8ef2d410ab303c (patch) | |
tree | 05e54b0bf6397ecbb5e7717a7925ac6ed2645a68 /libbcachefs/extents.h | |
parent | 800408be11898f6d53ceecfd894cce8860fda26a (diff) |
Update bcachefs sources to 0906b1fb49 bcachefs: fixes for 32 bit/big endian machines
Diffstat (limited to 'libbcachefs/extents.h')
-rw-r--r-- | libbcachefs/extents.h | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/libbcachefs/extents.h b/libbcachefs/extents.h index 338e9e01..08ad9647 100644 --- a/libbcachefs/extents.h +++ b/libbcachefs/extents.h @@ -278,24 +278,38 @@ bch2_extent_crc_unpack(const struct bkey *k, const union bch_extent_crc *crc) .uncompressed_size = k->size, .live_size = k->size, }; - case BCH_EXTENT_CRC32: - return (struct bch_extent_crc_unpacked) { + case BCH_EXTENT_CRC32: { + struct bch_extent_crc_unpacked ret = (struct bch_extent_crc_unpacked) { common_fields(crc->crc32), - .csum.lo = (__force __le64) crc->crc32.csum, }; - case BCH_EXTENT_CRC64: - return (struct bch_extent_crc_unpacked) { + + *((__le32 *) &ret.csum.lo) = crc->crc32.csum; + + memcpy(&ret.csum.lo, &crc->crc32.csum, + sizeof(crc->crc32.csum)); + + return ret; + } + case BCH_EXTENT_CRC64: { + struct bch_extent_crc_unpacked ret = (struct bch_extent_crc_unpacked) { common_fields(crc->crc64), .nonce = crc->crc64.nonce, .csum.lo = (__force __le64) crc->crc64.csum_lo, - .csum.hi = (__force __le64) crc->crc64.csum_hi, }; - case BCH_EXTENT_CRC128: - return (struct bch_extent_crc_unpacked) { + + *((__le16 *) &ret.csum.hi) = crc->crc64.csum_hi; + + return ret; + } + case BCH_EXTENT_CRC128: { + struct bch_extent_crc_unpacked ret = (struct bch_extent_crc_unpacked) { common_fields(crc->crc128), .nonce = crc->crc128.nonce, .csum = crc->crc128.csum, }; + + return ret; + } default: BUG(); } |