erofs: move {in,out}pages into struct z_erofs_decompress_req
Subsystems (2)
PATCH 1/1 erofs: move {in,out}pages into struct z_erofs_decompress_req
It seems that all compressors need those two values, so just move them into the common structure.
struct z_erofs_lz4_decompress_ctx can be dropped too.
Signed-off-by Gao Xiang <[email protected]>
--- fs/erofs/compress.h | 2 +- fs/erofs/decompressor.c | 93 +++++++++++++-------------------- fs/erofs/decompressor_deflate.c | 8 +-- fs/erofs/decompressor_lzma.c | 8 +-- fs/erofs/decompressor_zstd.c | 8 +-- fs/erofs/zdata.c | 2 + 6 files changed, 41 insertions(+), 80 deletions(-)
fs/erofs/compress.h +1 -1
@@ -11,6 +11,7 @@struct z_erofs_decompress_req {struct super_block *sb;struct page **in, **out; +unsigned int inpages, outpages;unsigned short pageofs_in, pageofs_out;unsigned int inputsize, outputsize;
@@ -59,7 +60,6 @@ extern const struct z_erofs_decompressor *z_erofs_decomp[];struct z_erofs_stream_dctx {struct z_erofs_decompress_req *rq; -unsigned int inpages, outpages;/* # of {en,de}coded pages */ int no, ni;/* the current {en,de}coded page # */ unsigned int avail_out;/* remaining bytes in the decoded buffer */
fs/erofs/decompressor.c +35 -58
208 lines not on this page · raw message
fs/erofs/decompressor_deflate.c +1 -7
@@ -101,13 +101,7 @@ static int z_erofs_deflate_decompress(struct z_erofs_decompress_req *rq, struct page **pgpl) {struct super_block *sb = rq->sb; -struct z_erofs_stream_dctx dctx = { - .rq = rq, - .inpages =PAGE_ALIGN (rq->inputsize) >>PAGE_SHIFT , - .outpages =PAGE_ALIGN (rq->pageofs_out + rq->outputsize) - >>PAGE_SHIFT , - .no =-1 , .ni =0 , - }; +struct z_erofs_stream_dctx dctx = { .rq = rq, .no =-1 , .ni =0 };struct z_erofs_deflate *strm;int zerr, err;
fs/erofs/decompressor_lzma.c +1 -7
@@ -150,13 +150,7 @@ static int z_erofs_lzma_decompress(struct z_erofs_decompress_req *rq, struct page **pgpl) {struct super_block *sb = rq->sb; -struct z_erofs_stream_dctx dctx = { - .rq = rq, - .inpages =PAGE_ALIGN (rq->inputsize) >>PAGE_SHIFT , - .outpages =PAGE_ALIGN (rq->pageofs_out + rq->outputsize) - >>PAGE_SHIFT , - .no =-1 , .ni =0 , - }; +struct z_erofs_stream_dctx dctx = { .rq = rq, .no =-1 , .ni =0 };struct xz_buf buf = {};struct z_erofs_lzma *strm;enum xz_ret xz_err;
fs/erofs/decompressor_zstd.c +1 -7
@@ -139,13 +139,7 @@ static int z_erofs_zstd_decompress(struct z_erofs_decompress_req *rq, struct page **pgpl) {struct super_block *sb = rq->sb; -struct z_erofs_stream_dctx dctx = { - .rq = rq, - .inpages =PAGE_ALIGN (rq->inputsize) >>PAGE_SHIFT , - .outpages =PAGE_ALIGN (rq->pageofs_out + rq->outputsize) - >>PAGE_SHIFT , - .no =-1 , .ni =0 , - }; +struct z_erofs_stream_dctx dctx = { .rq = rq, .no =-1 , .ni =0 };zstd_in_buffer in_buf = {NULL ,0 ,0 };zstd_out_buffer out_buf = {NULL ,0 ,0 };struct z_erofs_zstd *strm;
fs/erofs/zdata.c +2 -0
@@ -1284,6 +1284,8 @@ static int z_erofs_decompress_pcluster(struct z_erofs_backend *be, int err) .sb = be->sb, .in = be->compressed_pages, .out = be->decompressed_pages, + .inpages = pclusterpages, + .outpages = be->nr_pages, .pageofs_in = pcl->pageofs_in, .pageofs_out = pcl->pageofs_out, .inputsize = pcl->pclustersize,
Signature · 1 line
2.43.5
Quoted 6 lines · Gao Xiang
It seems that all compressors need those two values, so just move them into the common structure.
struct z_erofs_lz4_decompress_ctxcan be dropped too.Signed-off-by Gao Xiang <[email protected]>
Reviewed-by Chao Yu <[email protected]>
Thanks,