Re: [PATCH 0/1] cover-letter/lz4: Implement lz4 with dynamic offset length.
Hello, >> (Added cover letter to avoid much text in patch description) >> >> LZ4 specification defines 2 byte offset length for 64 KB data. >> But in case of ZRAM we compress data per page and in most of >> architecture PAGE_SIZE is 4KB. So we can decide offset length based >> on actual offset value. For this we can reserve 1 bit to decide offset >> length (1 byte or 2 byte). 2 byte required only if ofsset is greater than >> 127, >> else 1 byte is enough. > >So what happens if I compress the data on a system with no dyn >offset and then send it over the network to a machine which has >dyn offset? Or, say, I have a USB stick with a compression enabled >FS, store files on a dyn offset enabled PC and then mount that USB >stick on a machine with no dyn offset support. And vice versa. lz4_dyn is not an extension of LZ4 so there is no backward compatibility. Consider this as a different algorithm adapted from LZ4 for better compression ratio. Thanks Maninder Singh
Re: [PATCH 1/1] lz4: Implement lz4 with dynamic offset length.
Hi, >> diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c >> index 4ed0a78..5bc5aab 100644 >> --- a/drivers/block/zram/zcomp.c >> +++ b/drivers/block/zram/zcomp.c >> @@ -17,11 +17,15 @@ >> #include >> >> #include "zcomp.h" >> +#define KB(1 << 10) >> >> static const char * const backends[] = { >> "lzo", >> #if IS_ENABLED(CONFIG_CRYPTO_LZ4) >> "lz4", >> +#if (PAGE_SIZE < (32 * KB)) >> +"lz4_dyn", >> +#endif > >This is not the list of supported algorithms. It's the list of >recommended algorithms. You can configure zram to use any of >available and known to Crypto API algorithms. Including lz4_dyn >on PAGE_SIZE > 32K systems. > >-ss Yes, we want to integrate new compression(lz4_dyn) for ZRAM only if PAGE_SIZE is less than 32KB to get maximum benefit. so we added lz4_dyn to available list of ZRAM compression alhorithms. Thanks, Manider Singh