[PATCH] erofs-utils: change temporal buffer to non static

Gao Xiang hsiangkao at linux.alibaba.com
Mon Apr 8 21:24:36 AEST 2024


Hi Yifan,

On 2024/4/8 18:34, Yifan Zhao wrote:
> 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.


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

> 
> 
> Thanks,
> 
> Yifan Zhao
> 
> On 4/8/24 5:16 PM, Noboru Asai wrote:
>> In multi-threaded mode, each thread must use a different buffer in tryrecompress_trailing
>> function, so change this buffer to non static.
>>
>> Signed-off-by: Noboru Asai <asai at sijam.com>
>> ---
>>   lib/compress.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/compress.c b/lib/compress.c
>> index 641fde6..7415fda 100644
>> --- a/lib/compress.c
>> +++ b/lib/compress.c
>> @@ -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;


More information about the Linux-erofs mailing list