[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YNwW83ZpXZSSPDfM@unreal>
Date: Wed, 30 Jun 2021 10:02:11 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Christoph Hellwig <hch@...radead.org>
Cc: Doug Ledford <dledford@...hat.com>,
Jason Gunthorpe <jgg@...dia.com>,
Maor Gottlieb <maorg@...dia.com>,
Dennis Dalessandro <dennis.dalessandro@...nelisnetworks.com>,
linux-kernel@...r.kernel.org, linux-rdma@...r.kernel.org,
Mike Marciniszyn <mike.marciniszyn@...nelisnetworks.com>,
Yishai Hadas <yishaih@...dia.com>,
Zhu Yanjun <zyjzyj2000@...il.com>
Subject: Re: [PATCH rdma-next v1 1/2] lib/scatterlist: Fix wrong update of
orig_nents
On Wed, Jun 30, 2021 at 07:33:17AM +0100, Christoph Hellwig wrote:
> On Wed, Jun 30, 2021 at 09:29:51AM +0300, Leon Romanovsky wrote:
> > On Wed, Jun 30, 2021 at 06:59:11AM +0100, Christoph Hellwig wrote:
> > > On Tue, Jun 29, 2021 at 11:40:01AM +0300, Leon Romanovsky wrote:
> > > > 2. Add a new field total_nents to reflect the total number of entries
> > > > in the table. This is required for the release flow (sg_free_table).
> > > > This filed should be used internally only by scatterlist.
> > >
> > > No, please don't bloat the common structure.
> >
> > Somehow we need to store that total_nents value and our internal
> > proposal was to wrap sg_table with another private structure that is
> > visible in lib/scatterlist.c only.
> >
> > Something like that:
> > struct sg_table_private {
> > struct sg_table table;
> > unsigned int total_nents;
> > };
> >
> > But it looks awkward.
>
> Well, the important point is that we only need it for the new
> way of collapsing, appending allocations. We should not burden
> it on all other users.
Another possible solution is to change __sg_alloc_table()/__sg_alloc_table_from_pages
to return total_nents and expect from the users to store it internally and pass
it later to the __sg_free_table().
Something like that.
Thanks
Powered by blists - more mailing lists