Re: [PATCH] scatterlist: Speed up for_each_sg() loop macro

From: Sultan Alsawaf
Date: Mon Oct 28 2019 - 12:37:36 EST


On Mon, Oct 28, 2019 at 09:28:16AM -0700, Christoph Hellwig wrote:
> And there is nothing forcing a particular layout, there just happens
> to be a layout that the generic allocator gives you. I'm not even
> sure the original patch handles the SCSI case of small inlines segments
> properly.

I'm doubtful; are there really sg users that craft their own sglists and then
use for_each_sg() on them? But like I mentioned in the email I sent a
few minutes ago, this can be alleviated with a more comprehensive version of
this patch that alters all for_each_sg() users and thus ensures that only
sg_table pointers can be used with the macro. Anyone who would munge their own
sg_table together would simply be insane :)

Or there could be a separate macro for iterating through each sg in an sg_table.
There are lots of ways to go about this.

Sultan