erofs-utils: change temporal buffer to non static
PATCH 1/1 erofs-utils: change temporal buffer to non static
In multi-threaded mode, each thread must use a different buffer in tryrecompress_trailing function, so change this buffer to non static.
--- lib/compress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/compress.c +1 -1
@@ -447,7 +447,7 @@ static void tryrecompress_trailing(struct z_erofs_compress_sctx *ctx, void *out, unsigned int *compressedsize) { struct erofs_sb_info *sbi = ctx->ictx->inode->sbi; -static char tmp[Z_EROFS_PCLUSTER_MAX_SIZE ]; +char tmp[Z_EROFS_PCLUSTER_MAX_SIZE ];unsigned int count;int ret = *compressedsize;
Signature · 1 line
2.44.0
Hi Noboru,
AFAIK, this tryrecompress_trailing is only used when may_inline is true, indicating that
this segment is the last one in the file. In the current inner-file implementation, it means
that only one worker will use the tmp buffer at a given time.
In fact, the static modifier is removed in the first version of the patchset, but the change
is reversed during the review. I think Xiang may share his opinion about this.
Thanks,
Yifan Zhao
Quoted 21 lines · Noboru Asai
In multi-threaded mode, each thread must use a different buffer in
tryrecompress_trailingfunction, so change this buffer to non static.Signed-off-by Noboru Asai <[email protected]>--- lib/compress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/compress.c +1
-1@@ -447,7 +447,7 @@ static void tryrecompress_trailing(struct z_erofs_compress_sctx *ctx, void *out, unsigned int *compressedsize) { struct erofs_sb_info *sbi = ctx->ictx->inode->sbi; -static char tmp[Z_EROFS_PCLUSTER_MAX_SIZE ]; +char tmp[Z_EROFS_PCLUSTER_MAX_SIZE ];unsigned int count;int ret = *compressedsize;
Hi Yifan,
Quoted 5 lines · Yifan Zhao
Hi Noboru,
AFAIK, this
tryrecompress_trailingis only used whenmay_inlineis true, indicating that
Quoted 8 lines
this segment is the last one in the file. In the current inner-file implementation, it means
that only one worker will use the
tmpbuffer at a given time.In fact, the
staticmodifier is removed in the first version of the patchset, but the changeis reversed during the review. I think Xiang may share his opinion about this.
Yes, I think it will impact inter-file implementation, but that doesn't matter since we'll finally enable this. So I will apply this first :)
Thanks,
Gao Xiang
Quoted 27 lines
Thanks,
Yifan Zhao
Quoted 20 lines · Noboru Asai
In multi-threaded mode, each thread must use a different buffer in
tryrecompress_trailingfunction, so change this buffer to non static.Signed-off-by Noboru Asai <[email protected]>---
lib/compress.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)lib/compress.c +1
-1@@ -447,7 +447,7 @@ static void tryrecompress_trailing(struct z_erofs_compress_sctx *ctx, void *out, unsigned int *compressedsize) { struct erofs_sb_info *sbi = ctx->ictx->inode->sbi; - static char tmp[Z_EROFS_PCLUSTER_MAX_SIZE]; + char tmp[Z_EROFS_PCLUSTER_MAX_SIZE]; unsigned int count; int ret = *compressedsize;
Quoted 4 lines · Noboru Asai
In multi-threaded mode, each thread must use a different buffer in
tryrecompress_trailingfunction, so change this buffer to non static.Signed-off-by Noboru Asai <[email protected]>
Thanks for catching this!
Thanks,
Gao Xiang