f2fs: merge lz4hc_compress_pages() to lz4_compress_pages()
PATCH v2 1/1 f2fs: merge lz4hc_compress_pages() to lz4_compress_pages()
Remove unnecessary lz4hc_compress_pages().
---
v2:
-rebase
fs/f2fs/compress.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-)
fs/f2fs/compress.c +4 -20
@@ -264,34 +264,18 @@ static void lz4_destroy_compress_ctx(struct compress_ctx *cc) cc->private =NULL ; } -#ifdef CONFIG_F2FS_FS_LZ4HC -static int lz4hc_compress_pages (struct compress_ctx *cc) +static int lz4_compress_pages (struct compress_ctx *cc) { -unsigned char level =F2FS_I (cc->inode)->i_compress_level;int len; +#ifdef CONFIG_F2FS_FS_LZ4HC +unsigned char level =F2FS_I (cc->inode)->i_compress_level;if (level) len =LZ4_compress_HC (cc->rbuf, cc->cbuf->cdata, cc->rlen, cc->clen, level, cc->private); else - len =LZ4_compress_default (cc->rbuf, cc->cbuf->cdata, cc->rlen, - cc->clen, cc->private); -if (!len) -return -EAGAIN ; - - cc->clen = len; -return 0 ; -} -#endif - -static int lz4_compress_pages (struct compress_ctx *cc) -{ -int len; - -#ifdef CONFIG_F2FS_FS_LZ4HC -return lz4hc_compress_pages (cc);#endif - len =LZ4_compress_default (cc->rbuf, cc->cbuf->cdata, cc->rlen, + len =LZ4_compress_default (cc->rbuf, cc->cbuf->cdata, cc->rlen, cc->clen, cc->private);if (!len)return -EAGAIN ;
Signature · 8 lines
2.35.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao Yu
maintainerQuoted 7 lines · Yangtao Li
fs/f2fs/compress.c +2
-0+#ifdef CONFIG_F2FS_FS_LZ4HC +unsigned char level =F2FS_I (cc->inode)->i_compress_level;if (level) len =LZ4_compress_HC (cc->rbuf, cc->cbuf->cdata, cc->rlen, cc->clen, level, cc->private);else
[snip]
Quoted 1 line
#endif
[snip]
fs/f2fs/compress.c static void lz4_destroy_compress_ctx(struct compress_ctx *cc) · line 278
Quoted 1 line
fs/f2fs/compress.c +1
-0+ len = LZ4_compress_default(cc->rbuf, cc->cbuf->cdata, cc->rlen,
It's weired that whole else xxx; statement is split by #endif.
What about?
unsigned char level = 0;
#if
...
#endif if (!level) len = LZ4_compress_default()
Thanks,
Quoted 3 lines
cc->clen,cc->private);
if (!len)
return-EAGAIN;
Jaegeuk Kim
maintainerQuoted 20 lines · Chao Yu
Quoted 6 lines · Yangtao Li
(quoted diff) +2
-0+#ifdef CONFIG_F2FS_FS_LZ4HC + unsigned char level = F2FS_I(cc->inode)->i_compress_level; if (level) len = LZ4_compress_HC(cc->rbuf, cc->cbuf->cdata, cc->rlen, cc->clen, level, cc->private); else[snip]
Quoted 1 line
#endif[snip]
Review
Quoted 1 line
(quoted diff) +1
-0+ len = LZ4_compress_default(cc->rbuf, cc->cbuf->cdata, cc->rlen,It's weired that whole else xxx; statement is split by #endif.
What about?
Quoted 7 lines
unsigned char level = 0;#if
...#endif if (!level) len = LZ4_compress_default()
I modified like this.
fs/f2fs/compress.c +8 -6
@@ -266,17 +266,19 @@ static void lz4_destroy_compress_ctx(struct compress_ctx *cc)static int lz4_compress_pages (struct compress_ctx *cc) { -int len; -#ifdef CONFIG_F2FS_FS_LZ4HC +int len = -EINVAL ;unsigned char level =F2FS_I (cc->inode)->i_compress_level; -if (level) +if (!level) + len =LZ4_compress_default (cc->rbuf, cc->cbuf->cdata, cc->rlen, + cc->clen, cc->private); +#ifdef CONFIG_F2FS_FS_LZ4HC + else len =LZ4_compress_HC (cc->rbuf, cc->cbuf->cdata, cc->rlen, cc->clen, level, cc->private); - else#endif - len =LZ4_compress_default (cc->rbuf, cc->cbuf->cdata, cc->rlen, - cc->clen, cc->private); +if (len <0 ) +return len;if (!len)return -EAGAIN ;
Quoted 6 lines
Thanks,
Quoted 3 lines
cc->clen,cc->private);
if (!len)
return-EAGAIN;
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 49 lines · Jaegeuk Kim
Quoted 20 lines · Chao Yu
Quoted 6 lines · Yangtao Li
fs/f2fs/compress.c +2
-0+#ifdef CONFIG_F2FS_FS_LZ4HC +unsigned char level =F2FS_I (cc->inode)->i_compress_level;if (level) len =LZ4_compress_HC (cc->rbuf, cc->cbuf->cdata, cc->rlen, cc->clen, level, cc->private);else [snip]
Quoted 1 line
#endif[snip]
fs/f2fs/compress.c static void lz4_destroy_compress_ctx(struct compress_ctx *cc) · line 273
Quoted 1 line
fs/f2fs/compress.c +1
-0+ len = LZ4_compress_default(cc->rbuf, cc->cbuf->cdata, cc->rlen,It's weired that whole else xxx; statement is split by #endif.
What about?
Quoted 7 lines
unsigned char level = 0;#if
...#endif if (!level) len = LZ4_compress_default()I modified like this.
fs/f2fs/compress.c +6
-3@@ -266,17 +266,19 @@ static void lz4_destroy_compress_ctx(struct compress_ctx *cc)static int lz4_compress_pages (struct compress_ctx *cc) { -int len; -#ifdef CONFIG_F2FS_FS_LZ4HC +int len = -EINVAL ;unsigned char level =F2FS_I (cc->inode)->i_compress_level; -if (level) +if (!level) + len =LZ4_compress_default (cc->rbuf, cc->cbuf->cdata, cc->rlen, + cc->clen, cc->private); +#ifdef CONFIG_F2FS_FS_LZ4HC + else len = LZ4_compress_HC(cc->rbuf, cc->cbuf->cdata, cc->rlen,
fs/f2fs/compress.c static void lz4_destroy_compress_ctx(struct compress_ctx *cc) · line 284
Quoted 10 lines
fs/f2fs/compress.c +2
-3cc->clen, level, cc->private); - else#endif - len =LZ4_compress_default (cc->rbuf, cc->cbuf->cdata, cc->rlen, - cc->clen, cc->private); +if (len <0 ) +return len;if (!len)return -EAGAIN ;
Better.
Thanks,