Skip to contentSkip to conversation

erofs: fix the per-CPU buffer decompression for small output size

PATCH In review Yue Hu 3 participants 6 messages Oct 13, 2021 – Oct 14, 2021 EROFS file system

lore
Share & tools
lore

Yue Hu

author reviewer
#0 lore raw

PATCH 1/1 erofs: fix the per-CPU buffer decompression for small output size

From: Yue Hu <[email protected]>

Note that z_erofs_lz4_decompress() will return a positive value if decompression succeeds. However, we do not copy_from_pcpubuf() due to !ret. Let's fix it.

---
 fs/erofs/decompressor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/erofs/decompressor.c +1 -1
index a5bc4b1..e4cab4e 100644
@@ -326,7 +326,7 @@ static int z_erofs_decompress_generic(struct z_erofs_decompress_req *rq,
 
 			rq->inplace_io = false;
 			ret = alg->decompress(rq, dst);
-			if (!ret)
+			if (ret > 0)
 				copy_from_pcpubuf(rq->out, dst, rq->pageofs_out,
 						  rq->outputsize);
 
Signature · 1 line
1.9.1
#1 lore raw

Hi Yue,

Quoted 7 lines · Yue Hu

From: Yue Hu <[email protected]>

Note that z_erofs_lz4_decompress() will return a positive value if decompression succeeds. However, we do not copy_from_pcpubuf() due to !ret. Let's fix it.

Thanks for catching this. This is a valid issue, but it has no real impact to the current kernels since such pcluster in practice will be !inplace_io and trigger "if (nrpages_out == 1 && !rq->inplace_io) {" above for upstream strategies.

Our customized lz4 implementation will return 0 if success instead, so it has no issue to our previous products as well.

For such cases, how about updating z_erofs_lz4_decompress() to return 0 if success instead rather than outputsize. Since I'll return 0 if success for LZMA as well.

Thanks,
Gao Xiang

#2 lore raw
Quoted 16 lines · Gao Xiang

Hi Yue,

Quoted 7 lines · Yue Hu

From: Yue Hu <[email protected]>

Note that z_erofs_lz4_decompress() will return a positive value if decompression succeeds. However, we do not copy_from_pcpubuf() due to !ret. Let's fix it.

Thanks for catching this. This is a valid issue, but it has no real impact to the current kernels since such pcluster in practice will be !inplace_io and trigger "if (nrpages_out == 1 && !rq->inplace_io) {" above for upstream strategies.

Quoted 6 lines

Our customized lz4 implementation will return 0 if success instead, so it has no issue to our previous products as well.

For such cases, how about updating z_erofs_lz4_decompress() to return 0 if success instead rather than outputsize. Since I'll return 0 if success for LZMA as well.

In addition, I'm fine to getting rid of such path as well, since it has no real impact to our current upstream decompression strategy.

If it has some use cases due to decompression strategy change, we could re-add it with some evaluation (some real numbers) later.

Thanks,
Gao Xiang

Quoted 3 lines

Thanks,
Gao Xiang

#3 lore raw
In reply to Gao Xiang

Hi Xiang,

Quoted 11 lines · On Wed, 13 Oct 2021 19:51:55 +0800 Gao Xiang <[email protected]>…

Hi Yue,

Quoted 7 lines · Yue Hu

From: Yue Hu <[email protected]>

Note that z_erofs_lz4_decompress() will return a positive value if decompression succeeds. However, we do not copy_from_pcpubuf() due to !ret. Let's fix it.

Quoted 7 lines

Thanks for catching this. This is a valid issue, but it has no real impact to the current kernels since such pcluster in practice will be !inplace_io and trigger "if (nrpages_out == 1 && !rq->inplace_io) {" above for upstream strategies.

Our customized lz4 implementation will return 0 if success instead, so it has no issue to our previous products as well.

Yes, i just find the issue when i try to implement a new feature of tail-packing inline compressed data. No problem in my current version.

Thanks.

Quoted 7 lines

For such cases, how about updating z_erofs_lz4_decompress() to return 0 if success instead rather than outputsize. Since I'll return 0 if success for LZMA as well.

Thanks,
Gao Xiang

#4 lore raw
Quoted 21 lines · Yue Hu

Hi Xiang,

Quoted 16 lines · On Wed, 13 Oct 2021 19:51:55 +0800 Gao Xiang <[email protected]>…

Hi Yue,

Quoted 7 lines · Yue Hu

From: Yue Hu <[email protected]>

Note that z_erofs_lz4_decompress() will return a positive value if decompression succeeds. However, we do not copy_from_pcpubuf() due to !ret. Let's fix it.

Thanks for catching this. This is a valid issue, but it has no real impact to the current kernels since such pcluster in practice will be !inplace_io and trigger "if (nrpages_out == 1 && !rq->inplace_io) {" above for upstream strategies.

Quoted 5 lines
Quoted 2 lines

Our customized lz4 implementation will return 0 if success instead, so it has no issue to our previous products as well.

Yes, i just find the issue when i try to implement a new feature of tail-packing inline compressed data. No problem in my current version.

Yeah, please help update the return value of z_erofs_lz4_decompress() and get rid of such unneeded fast path.

Thanks,
Gao Xiang

Quoted 11 lines

Thanks.

Quoted 7 lines

For such cases, how about updating z_erofs_lz4_decompress() to return 0 if success instead rather than outputsize. Since I'll return 0 if success for LZMA as well.

Thanks,
Gao Xiang

#5 lore raw
Quoted 22 lines · On Thu, 14 Oct 2021 00:03:02 +0800 Gao Xiang <[email protected]>…
Quoted 21 lines · Yue Hu

Hi Xiang,

Quoted 16 lines · On Wed, 13 Oct 2021 19:51:55 +0800 Gao Xiang <[email protected]>…

Hi Yue,

Quoted 7 lines · Yue Hu

From: Yue Hu <[email protected]>

Note that z_erofs_lz4_decompress() will return a positive value if decompression succeeds. However, we do not copy_from_pcpubuf() due to !ret. Let's fix it.

Thanks for catching this. This is a valid issue, but it has no real impact to the current kernels since such pcluster in practice will be !inplace_io and trigger "if (nrpages_out == 1 && !rq->inplace_io) {" above for upstream strategies.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Our customized lz4 implementation will return 0 if success instead, so it has no issue to our previous products as well.

Yes, i just find the issue when i try to implement a new feature of tail-packing inline compressed data. No problem in my current version.

Yeah, please help update the return value of z_erofs_lz4_decompress() and get rid of such unneeded fast path.

OK, will update in next version.

Thanks.

Quoted 15 lines

Thanks,
Gao Xiang

Quoted 11 lines

Thanks.

Quoted 7 lines

For such cases, how about updating z_erofs_lz4_decompress() to return 0 if success instead rather than outputsize. Since I'll return 0 if success for LZMA as well.

Thanks,
Gao Xiang