Benjamin Brumaire
2008-May-03 08:46 UTC
[zfs-discuss] Endian relevance for decoding lzjb blocks
I ''m trying to decode a lzjb compressed blocks and I have some hard times regarding big/little endian. I''m on x86 working with build 77. #zdb -uuuu ztest ... rootbp = [L0 DMU objset] 400L/200P DVA[0]=<0:e0c98e00:200> ... ## zdb -R ztest:c0d1s4:e0c98e00:200: Found vdev: /dev/dsk/c0d1s4 ztest:c0d1s4:e0c98e00:200: 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef 000000: 00000003020e0a00 dd0304050020b601 .......... ..... 000010: c505048404040504 35b558231002047c ........|...#X.5 Looking at this blocks with dd: dd if=/dev/dsk/c0d1s4 iseek=7374023 bs=512 count=1 | od -x 0000000: 0a00 020e 0003 0000 b601 0020 0405 dd03 od -x is responsible for swapping every two bytes. I have on disk 0000000: 000a 0e02 0300 0000 01b6 0200 0504 03dd Comparing with the zdb output is every 8 bytes reversed. Now I don''t know how to pass this to my lzjb decoding programm? Should I read the 512 bytes and pass them: - from the end - from the start and reverse every 8 bytes - or something else thanks for any advice bbr This message posted from opensolaris.org
max at bruningsystems.com
2008-May-03 11:12 UTC
[zfs-discuss] Endian relevance for decoding lzjb blocks
Hi Benjamin, Benjamin Brumaire wrote:> I ''m trying to decode a lzjb compressed blocks and I have some hard times regarding big/little endian. I''m on x86 working with build 77. > > #zdb -uuuu ztest > ... > rootbp = [L0 DMU objset] 400L/200P DVA[0]=<0:e0c98e00:200> > ... > > ## zdb -R ztest:c0d1s4:e0c98e00:200: > Found vdev: /dev/dsk/c0d1s4 > > ztest:c0d1s4:e0c98e00:200: > 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef > 000000: 00000003020e0a00 dd0304050020b601 .......... ..... > 000010: c505048404040504 35b558231002047c ........|...#X.5 > >Using the modified zdb, you should be able to do: # zdb -R ztest:c0d1s4:e0c98e00:200:d,lzjb,400 2>/tmp/foo Then you can od /tmp/foo. I am not sure what happens if you run zdb with a zfs file system that is different endianess from the machine on which you are running zdb. It may just work... The "d:lzjb:400" says to use lzjb decompression with a logical (after decompression) size of 0x400 bytes. It dumps raw data to stderr, hence the "2>/tmp/foo". max> Looking at this blocks with dd: > dd if=/dev/dsk/c0d1s4 iseek=7374023 bs=512 count=1 | od -x > 0000000: 0a00 020e 0003 0000 b601 0020 0405 dd03 > > od -x is responsible for swapping every two bytes. I have on disk > 0000000: 000a 0e02 0300 0000 01b6 0200 0504 03dd > > Comparing with the zdb output is every 8 bytes reversed. > > Now I don''t know how to pass this to my lzjb decoding programm? > > Should I read the 512 bytes and pass them: > - from the end > - from the start and reverse every 8 bytes > - or something else > > thanks for any advice > > bbr > > > This message posted from opensolaris.org > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss > >