Skip to content

Commit 597e295

Browse files
taigerhuhsiangkao
authored andcommitted
erofs: fold in z_erofs_decompress()
No need this helper since it's just a simple wrapper for decompress method and only one caller. So, let's fold in directly instead. Signed-off-by: Yue Hu <[email protected]> Reviewed-by: Gao Xiang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Gao Xiang <[email protected]>
1 parent 7877cb9 commit 597e295

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

fs/erofs/compress.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ static inline bool erofs_page_is_managed(const struct erofs_sb_info *sbi,
8989

9090
int z_erofs_fixup_insize(struct z_erofs_decompress_req *rq, const char *padbuf,
9191
unsigned int padbufsize);
92-
int z_erofs_decompress(struct z_erofs_decompress_req *rq,
93-
struct page **pagepool);
92+
extern const struct z_erofs_decompressor erofs_decompressors[];
9493

9594
/* prototypes for specific algorithms */
9695
int z_erofs_lzma_decompress(struct z_erofs_decompress_req *rq,

fs/erofs/decompressor.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ static int z_erofs_transform_plain(struct z_erofs_decompress_req *rq,
363363
return 0;
364364
}
365365

366-
static struct z_erofs_decompressor decompressors[] = {
366+
const struct z_erofs_decompressor erofs_decompressors[] = {
367367
[Z_EROFS_COMPRESSION_SHIFTED] = {
368368
.decompress = z_erofs_transform_plain,
369369
.name = "shifted"
@@ -383,9 +383,3 @@ static struct z_erofs_decompressor decompressors[] = {
383383
},
384384
#endif
385385
};
386-
387-
int z_erofs_decompress(struct z_erofs_decompress_req *rq,
388-
struct page **pagepool)
389-
{
390-
return decompressors[rq->alg].decompress(rq, pagepool);
391-
}

fs/erofs/zdata.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1283,6 +1283,8 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,
12831283
struct erofs_sb_info *const sbi = EROFS_SB(be->sb);
12841284
struct z_erofs_pcluster *pcl = be->pcl;
12851285
unsigned int pclusterpages = z_erofs_pclusterpages(pcl);
1286+
const struct z_erofs_decompressor *decompressor =
1287+
&erofs_decompressors[pcl->algorithmformat];
12861288
unsigned int i, inputsize;
12871289
int err2;
12881290
struct page *page;
@@ -1326,7 +1328,7 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,
13261328
else
13271329
inputsize = pclusterpages * PAGE_SIZE;
13281330

1329-
err = z_erofs_decompress(&(struct z_erofs_decompress_req) {
1331+
err = decompressor->decompress(&(struct z_erofs_decompress_req) {
13301332
.sb = be->sb,
13311333
.in = be->compressed_pages,
13321334
.out = be->decompressed_pages,

0 commit comments

Comments
 (0)