[PATCH] erofs: remove unneeded icur field from struct z_erofs_decompress_frontend

Yue Hu zbestahu at gmail.com
Mon Apr 17 17:44:15 AEST 2023


On Mon, 17 Apr 2023 15:12:31 +0800
Gao Xiang <hsiangkao at linux.alibaba.com> wrote:

> On 2023/4/17 15:15, Yue Hu wrote:
> > On Mon, 17 Apr 2023 15:00:25 +0800
> > Gao Xiang <hsiangkao at linux.alibaba.com> wrote:
> >   
> 
> ..
> 
> >>
> >> Although please help refine the comment below:
> >>
> >> 	/* scan & fill inplace I/O pages in the reverse order */  
> > 
> > Ok, will refine it in v2.  
> 
> I rethink this, I don't want to go far in this way, and this makes a
> O(n) scan into O(n^2) when a single inplace I/O page is added.

Yeah, i misread that, it should be global before submission, just ignore the change.

> 
> So sorry, I don't think it's a good way, although I also don't think
> `icur` is a good name and we might need to find a better name.
> 
> Thanks,
> Gao Xiang
> 
> >   
> >>
> >> Thanks,
> >> Gao Xiang
> >>  
> >>>> +    unsigned int icur = pcl->pclusterpages;
> >>>> -    while (fe->icur > 0) {
> >>>> -        if (!cmpxchg(&pcl->compressed_bvecs[--fe->icur].page,
> >>>> +    while (icur > 0) {
> >>>> +        if (!cmpxchg(&pcl->compressed_bvecs[--icur].page,
> >>>>                     NULL, bvec->page)) {
> >>>> -            pcl->compressed_bvecs[fe->icur] = *bvec;
> >>>> +            pcl->compressed_bvecs[icur] = *bvec;
> >>>>                return true;
> >>>>            }
> >>>>        }
> >>>> @@ -877,8 +876,6 @@ static int z_erofs_collector_begin(struct z_erofs_decompress_frontend *fe)
> >>>>        }
> >>>>        z_erofs_bvec_iter_begin(&fe->biter, &fe->pcl->bvset,
> >>>>                    Z_EROFS_INLINE_BVECS, fe->pcl->vcnt);
> >>>> -    /* since file-backed online pages are traversed in reverse order */
> >>>> -    fe->icur = z_erofs_pclusterpages(fe->pcl);
> >>>>        return 0;
> >>>>    }  



More information about the Linux-erofs mailing list