[PATCH] erofs: remove end parameter from z_erofs_pcluster_readmore()

Yue Hu zbestahu at gmail.com
Wed May 24 21:15:49 AEST 2023


On Wed, 24 May 2023 18:45:48 +0800
Gao Xiang <hsiangkao at linux.alibaba.com> wrote:

> On 2023/5/24 03:13, Yue Hu wrote:
> > From: Yue Hu <huyue2 at coolpad.com>
> > 
> > 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 <huyue2 at coolpad.com>  
> > --->   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



More information about the Linux-erofs mailing list