[PATCH v2 5/8] target: Use sgl_alloc_order() and sgl_free()
Bart Van Assche
Bart.VanAssche at wdc.com
Tue Oct 17 07:31:11 PDT 2017
On Tue, 2017-10-17 at 08:14 +0200, Hannes Reinecke wrote:
> On 10/17/2017 12:49 AM, Bart Van Assche wrote:
> > [ ... ]
> > void target_free_sgl(struct scatterlist *sgl, int nents)
> > {
> > - struct scatterlist *sg;
> > - int count;
> > -
> > - for_each_sg(sgl, sg, nents, count)
> > - __free_page(sg_page(sg));
> > -
> > - kfree(sgl);
> > + sgl_free(sgl);
> > }
> > EXPORT_SYMBOL(target_free_sgl);
> >
> > @@ -2423,42 +2417,10 @@ int
> > target_alloc_sgl(struct scatterlist **sgl, unsigned int *nents, u32 length,
> > bool zero_page, bool chainable)
> > {
> > - [ ... ]
> > + *sgl = sgl_alloc_order(length, 0, chainable, gfp, nents);
> > + return *sgl ? 0 : -ENOMEM;
> > }
> > EXPORT_SYMBOL(target_alloc_sgl);
> >
> > The calling convention from target_alloc_sgl() is decidedly dodgy.
>
> Can't we convert it into returning the sgl, and remove the first parameter?
Hello Hannes,
Another option is to remove the target_alloc_sgl() and target_free_sgl() functions
and to make LIO target drivers call sgl_alloc_order() and sgl_free_order() directly.
Do you perhaps have a preference for one of these two approaches?
Thanks,
Bart.
More information about the Linux-nvme
mailing list