Re: [PATCH 2/7] zram: switch to crypto compress API

From: Sergey Senozhatsky
Date: Fri May 27 2016 - 04:01:10 EST


On (05/27/16 13:22), Minchan Kim wrote:
[..]
> > static void zcomp_strm_free(struct zcomp *comp, struct zcomp_strm *zstrm)
> > {
> > - if (zstrm->private)
> > - comp->backend->destroy(zstrm->private);
> > + if (!IS_ERR_OR_NULL(zstrm->private))
>
> Let's change private with tfm.

ok.

>
> > + crypto_free_comp(zstrm->private);
> > free_pages((unsigned long)zstrm->buffer, 1);
> > kfree(zstrm);
> > }
> > @@ -58,13 +55,13 @@ static struct zcomp_strm *zcomp_strm_alloc(struct zcomp *comp, gfp_t flags)
> > if (!zstrm)
> > return NULL;
> >
> > - zstrm->private = comp->backend->create(flags);
> > + zstrm->private = crypto_alloc_comp(comp->name, 0, 0);
>
> crypto_alloc_comp uses GPF_KERNEL for allocating tfm and zram uses
> GFP_KERNEL for zcomp_strm_alloc now so there is no point to pass
> gfp_t so let's clean it up.

yes, I realized that after I sent out the patch. it's basically a revert
of 75d8947a36d0c9 ("zram: pass gfp from zcomp frontend to backend"), can
do this as a separate patch in the series, as it's more of a clenup.

I also realized that passing a zcomp pointer to zcomp_strm_free() is
useless; will clean that up.

-ss