In case of mips bigendian machine, put_unaligned writes bigendian bytes order.
This is defined in arch/mips/include/asm/unaligned.h. So it's right use put_unaligned_le16 function instead of put_unaligned.
This patch also fixes problem fail to mount zram ext4 partition with "zram: Decompression failed! err=-1, page=0" in mips bigendian machine.
Signed-off-by: Eunbong Song <[email protected]>
---
lib/lz4/lz4defs.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/lz4/lz4defs.h b/lib/lz4/lz4defs.h
index abcecdc..dc7ef14 100644
--- a/lib/lz4/lz4defs.h
+++ b/lib/lz4/lz4defs.h
@@ -53,7 +53,7 @@ typedef struct _U64_S { u64 v; } U64_S;
#define LZ4_WRITE_LITTLEENDIAN_16(p, v) \
do { \
- put_unaligned(v, (u16 *)(p)); \
+ put_unaligned_le16(v, (u16 *)(p)); \
p += 2; \
} while (0)
#endif
--
1.7.0.1
????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m????????????I?
On Tue, Jul 22, 2014 at 02:03:22AM +0000, Eunbong Song wrote:
>
> In case of mips bigendian machine, put_unaligned writes bigendian bytes order.
> This is defined in arch/mips/include/asm/unaligned.h. So it's right use put_unaligned_le16 function instead of put_unaligned.
> This patch also fixes problem fail to mount zram ext4 partition with "zram: Decompression failed! err=-1, page=0" in mips bigendian machine.
Odd line wrapping :(
Anyway, is this a new problem? Or something that has always been there
in this compression function?
thanks,
greg k-h
> Odd line wrapping :(
Sorry, for this.
> Anyway, is this a new problem? Or something that has always been there
> in this compression function?
Actually, i have tested zram with lz4 functions in my board(mips64 big endian).
Everytime i try to mount my ext4 zram image i have failed.
After applying this patch, that problem was disappeared.
Thanks. ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m????????????I?
On Tue, Jul 22, 2014 at 02:17:52AM +0000, Eunbong Song wrote:
>
> > Odd line wrapping :(
>
> Sorry, for this.
>
> > Anyway, is this a new problem? Or something that has always been there
> > in this compression function?
>
> Actually, i have tested zram with lz4 functions in my board(mips64 big endian).
> Everytime i try to mount my ext4 zram image i have failed.
> After applying this patch, that problem was disappeared.
So it's never worked?
Did you test on a little endian machine after making this change?
> So it's never worked?
Yes, it's always failed to mount.
> Did you test on a little endian machine after making this change?
Unfortunately, i don't have little endian machine. So i couldn't test that.
Additionaly, when lz4 compress calls lz4_compressctx() function and uses LZ4_WRITE_LITTLEENDIAN_16() macro.
And When lz4 decompress calls lz4_uncompress_unknownoutputsize function and
uses LZ4_READ_LITTLEENDIAN_16 macro.
There is endian mismatch in big endian machine as i metioned before. when compress lz4 write big endian bytes order
and when decompress lz4 reads little endian bytes order.
So i means we should make there is no endian mismatch between compress and decompress operation.
Thanks. ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m????????????I?