Re: [PATCH] f2fs: compress: fix zstd data corruption

2020-05-11 Thread Chao Yu
Hi Jaegeuk, I think we need this patch in order to avoid writebacking incomplete data compressed by zstd. On 2020/5/8 9:16, Chao Yu wrote: > During zstd compression, ZSTD_endStream() may return non-zero value > because distination buffer is full, but there is still compressed data > remained in i

Re: [f2fs-dev] [PATCH] f2fs: compress: fix zstd data corruption

2020-05-07 Thread Daeho Jeong
Great, thanks for checking~! :) 2020년 5월 8일 (금) 오후 3:42, Chao Yu 님이 작성: > > On 2020/5/8 11:30, Daeho Jeong wrote: > > I am a little bit confused. > > > > In compress_log=2 (4 pages), > > > > Every compression algorithm will set the cc->nr_cpages to 5 pages like > > below. > > > > max_len

Re: [f2fs-dev] [PATCH] f2fs: compress: fix zstd data corruption

2020-05-07 Thread Chao Yu
On 2020/5/8 11:30, Daeho Jeong wrote: > I am a little bit confused. > > In compress_log=2 (4 pages), > > Every compression algorithm will set the cc->nr_cpages to 5 pages like below. > >         max_len = COMPRESS_HEADER_SIZE + cc->clen; >         cc->nr_cpages = DIV_ROUND_UP(max_len, PAGE_SIZE)

Re: [f2fs-dev] [PATCH] f2fs: compress: fix zstd data corruption

2020-05-07 Thread Chao Yu
Hi Daeho, On 2020/5/8 9:28, Daeho Jeong wrote: > Hi Chao, > > IIUC, you are trying not to use ZSTD_compressBound() to save the memory > space. Am I right? > > Then, how about LZ4_compressBound() for LZ4 and lzo1x_worst_compress() for > LZO? Oops, it looks those limits were wrongly used... #def

[PATCH] f2fs: compress: fix zstd data corruption

2020-05-07 Thread Chao Yu
During zstd compression, ZSTD_endStream() may return non-zero value because distination buffer is full, but there is still compressed data remained in intermediate buffer, it means that zstd algorithm can not save at last one block space, let's just writeback raw data instead of compressed one, thi