[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YPltp39n9URglTXT@infradead.org>
Date: Thu, 22 Jul 2021 14:07:51 +0100
From: Christoph Hellwig <hch@...radead.org>
To: Jason Gunthorpe <jgg@...dia.com>
Cc: Leon Romanovsky <leon@...nel.org>,
Doug Ledford <dledford@...hat.com>,
Christoph Hellwig <hch@...radead.org>,
Maor Gottlieb <maorg@...dia.com>,
Daniel Vetter <daniel@...ll.ch>,
David Airlie <airlied@...ux.ie>,
Dennis Dalessandro <dennis.dalessandro@...nelisnetworks.com>,
dri-devel@...ts.freedesktop.org, intel-gfx@...ts.freedesktop.org,
Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
linux-kernel@...r.kernel.org, linux-rdma@...r.kernel.org,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Mike Marciniszyn <mike.marciniszyn@...nelisnetworks.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Roland Scheidegger <sroland@...are.com>,
Thomas Zimmermann <tzimmermann@...e.de>,
VMware Graphics <linux-graphics-maintainer@...are.com>,
Yishai Hadas <yishaih@...dia.com>,
Zack Rusin <zackr@...are.com>,
Zhu Yanjun <zyjzyj2000@...il.com>
Subject: Re: [PATCH rdma-next v2 1/2] lib/scatterlist: Fix wrong update of
orig_nents
On Thu, Jul 22, 2021 at 10:00:40AM -0300, Jason Gunthorpe wrote:
> this is better:
>
> struct sg_append_table state;
>
> sg_append_init(&state, sgt, gfp_mask);
>
> while (..)
> ret = sg_append_pages(&state, pages, n_pages, ..)
> if (ret)
> sg_append_abort(&state); // Frees the sgt and puts it to NULL
> sg_append_complete(&state)
>
> Which allows sg_alloc_table_from_pages() to be written as
>
> struct sg_append_table state;
> sg_append_init(&state, sgt, gfp_mask);
> ret = sg_append_pages(&state,pages, n_pages, offset, size, UINT_MAX)
> if (ret) {
> sg_append_abort(&state);
> return ret;
> }
> sg_append_complete(&state);
> return 0;
>
> And then the API can manage all of this in some sane and
> understandable way.
That would be a lot easier to use for sure. Not sure how invasive the
changes would be, though.
Powered by blists - more mailing lists