Re: [PATCH v2 1/5] erofs: introduce meta buffer operations

From: Gao Xiang
Date: Tue Jan 04 2022 - 04:06:00 EST


Hi Chao,

On Tue, Jan 04, 2022 at 03:54:08PM +0800, Chao Yu wrote:
> On 2022/1/2 12:00, Gao Xiang wrote:
> > In order to support subpage and folio for all uncompressed files,
> > introduce meta buffer descriptors, which can be effectively stored
> > on stack, in place of meta page operations.
> >
> > This converts the uncompressed data path to meta buffers.
> >
> > Signed-off-by: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx>
> > ---
> > fs/erofs/data.c | 97 +++++++++++++++++++++++++++++++++++----------
> > fs/erofs/internal.h | 13 ++++++
> > 2 files changed, 89 insertions(+), 21 deletions(-)
> >
> > diff --git a/fs/erofs/data.c b/fs/erofs/data.c
> > index 4f98c76ec043..6495e16a50a9 100644
> > --- a/fs/erofs/data.c
> > +++ b/fs/erofs/data.c
> > @@ -22,6 +22,56 @@ struct page *erofs_get_meta_page(struct super_block *sb, erofs_blk_t blkaddr)
> > return page;
> > }
> > +void erofs_unmap_metabuf(struct erofs_buf *buf)
> > +{
> > + if (buf->kmap_type == EROFS_KMAP)
> > + kunmap(buf->page);
> > + else if (buf->kmap_type == EROFS_KMAP_ATOMIC)
> > + kunmap_atomic(buf->base);
>
> Once user calls this function, .base should be invalidated.
>
> buf->base = NULL;

Thanks for your suggestion!

Since buf->kmap_type will be switched to EROFS_NO_KMAP, so buf->base
is completely ignored (IOWs, it's unnecessary to reset buf->base..),
however I'm fine to set buf->base = NULL here either.

Thanks,
Gao Xiang

>
> Otherwise, it looks good to me.
>
> Reviewed-by: Chao Yu <chao@xxxxxxxxxx>
>
> Thanks,
>