On Wed, 24 May 2023 18:45:48 +0800
Gao Xiang <[email protected]> wrote:

> On 2023/5/24 03:13, Yue Hu wrote:
> > From: Yue Hu <[email protected]>
> > 
> > The `end` argument is pointless if it's not backmost.  And we already
> > have `headoffset` in struct `*f`, so let's use this offset to get the
> > `end` for backmost only instead in this function.
> > 
> > Also, remove linux/prefetch.h since it's not used anymore after commit
> > 386292919c25 ("erofs: introduce readmore decompression strategy").
> > 
> > Signed-off-by: Yue Hu <[email protected]>  
> > --->   fs/erofs/zdata.c | 19 ++++++++-----------  
> >   1 file changed, 8 insertions(+), 11 deletions(-)
> > 
> > diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
> > index 5cd971bcf95e..b7ebdc8f2135 100644
> > --- a/fs/erofs/zdata.c
> > +++ b/fs/erofs/zdata.c
> > @@ -5,7 +5,6 @@
> >    * Copyright (C) 2022 Alibaba Cloud
> >    */
> >   #include "compress.h"
> > -#include <linux/prefetch.h>
> >   #include <linux/psi.h>
> >   #include <linux/cpuhotplug.h>
> >   #include <trace/events/erofs.h>
> > @@ -1825,16 +1824,16 @@ static void z_erofs_runqueue(struct 
> > z_erofs_decompress_frontend *f,
> >    */
> >   static void z_erofs_pcluster_readmore(struct z_erofs_decompress_frontend 
> > *f,
> >                                   struct readahead_control *rac,
> > -                                 erofs_off_t end,
> > -                                 struct page **pagepool,
> > -                                 bool backmost)
> > +                                 struct page **pagepool, bool backmost)
> >   {
> >     struct inode *inode = f->inode;
> >     struct erofs_map_blocks *map = &f->map;
> > -   erofs_off_t cur;
> > +   erofs_off_t cur, end;
> >     int err;
> >   
> >     if (backmost) {
> > +           end = f->headoffset +
> > +                 rac ? readahead_length(rac) : PAGE_SIZE - 1;  
> 
>               could we avoid "?:" here for readability?

Ok, let me change to use if-else branch.
And seems 'newstart' should be just `f->headoffset`.
I will send v2 later.

> 
> Thanks,
> Gao Xiang

Reply via email to