From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5349C07E9D for ; Sat, 24 Sep 2022 02:22:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232923AbiIXCWN (ORCPT ); Fri, 23 Sep 2022 22:22:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229733AbiIXCWL (ORCPT ); Fri, 23 Sep 2022 22:22:11 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A439124763 for ; Fri, 23 Sep 2022 19:22:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=2ZnV+eBC43KOeWy8+ax0A7t7+DqkuNwSAMVbzruZiTk=; b=hqcQ9Uw2BAsJrdKuQR/amfYVUd S9JZIft3A0tOIG0iEHudxoOThQa0oKQzQQgzg1HN6KILfbb8CfRNcW1nr49vHWhDLv84fwLq1veIY p6z0SNzCBYea17Q0jvuY4FJ7gLmsTe5/bEzFcwNaQqZf6SkzjbHEUNEDDHNxlVhWnVDK1GHEW6rg5 FNH98jPytkM6C6Q9pkRR2frsop41gMEDhx+/izgL8pigLgUaSO9VgMD5EBDCsuKH0bfujnYXNylv3 kgDPtHtw+szS/zHivPO1eXWhTAyR2vcolLhQd1bXE4XXxhsdGPHw11NCvLn2WlaMHbWvzaPJMeTEa kLs3DylQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1obuns-0036wI-2B; Sat, 24 Sep 2022 02:22:04 +0000 Date: Sat, 24 Sep 2022 03:22:04 +0100 From: Al Viro To: David Howells Cc: jlayton@redhat.com, smfrench@gmail.com, linux-fsdevel@vger.kernel.org Subject: Re: [RFC][PATCH] iov_iter: Add extraction functions Message-ID: References: <3750754.1662765490@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3750754.1662765490@warthog.procyon.org.uk> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Sat, Sep 10, 2022 at 12:18:10AM +0100, David Howells wrote: > Hi Al, Jeff, > > Here's a replacement for the extract_iter_to_iter() patch I had previously. > It's a WIP, some bits aren't fully implemented, though some bits I have tested > and got to work, but if you could take a look and see if you're okay with the > interface. > > I think I've addressed most of Al's comments. The page-pinning is conditional > on certain types of iterator, and a number of the iterator types just extract > to the same thing. It should now handle kvec-class iterators that refer to > vmalloc'd data. > > I've also added extraction to scatterlist (which I'll need for doing various > crypto things) and extraction to ib_sge which could be used in cifs/smb RDMA, > bypassing the conversion-to-scatterlist step. > > As mentioned, there are bits that aren't fully implemented, let alone tested. IDGI. Essentially, you are passing a callback disguised as enum, only to lose any type safety. How is it better than "iov_iter_get_pages2() into a fixed-sized array and handle the result" done in a loop? No need to advance it (iov_iter_get_page2() auto-advances), *way* fewer conditional branches and no need to share anything between the 3 functions you are after... > +ssize_t extract_iter_to_sg(struct iov_iter *iter, size_t len, > + struct sg_table *sgtable, bool *pages_pinned) Your *pages_pinned is user_backed_iter(iter), isn't it?