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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9676C48BDF for ; Fri, 18 Jun 2021 19:42:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A96A1613E9 for ; Fri, 18 Jun 2021 19:42:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231553AbhFRToy (ORCPT ); Fri, 18 Jun 2021 15:44:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229768AbhFRToy (ORCPT ); Fri, 18 Jun 2021 15:44:54 -0400 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C2B8C061574; Fri, 18 Jun 2021 12:42:44 -0700 (PDT) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1luKO1-009jgu-QW; Fri, 18 Jun 2021 19:42:41 +0000 Date: Fri, 18 Jun 2021 19:42:41 +0000 From: Al Viro To: Linus Torvalds Cc: Omar Sandoval , linux-fsdevel , linux-btrfs , Linux API , Kernel Team Subject: Re: [PATCH RESEND x3 v9 1/9] iov_iter: add copy_struct_from_iter() Message-ID: References: <6caae597eb20da5ea23e53e8e64ce0c4f4d9c6d2.1623972519.git.osandov@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Fri, Jun 18, 2021 at 11:50:25AM -0700, Linus Torvalds wrote: > I think that you may need it to be based on Al's series for that to > work, which might be inconvenient, though. > > One other non-code issue: particularly since you only handle a subset > of the iov_iter cases, it would be nice to have an explanation for > _why_ those particular cases. > > IOW, have some trivial explanation for each of the cases. "iovec" is > for regular read/write, what triggers the kvec and bvec cases? > > But also, the other way around. Why doesn't the pipe case trigger? No > splice support? Pipe ones are strictly destinations - they can't be sources. So if you see it called for one of those, you've a bug. Xarray ones are *not* - they can be sources, and that's missing here. Much more unpleasant, though, is that this thing has hard dependency on nr_seg == 1 *AND* openly suggests the use of iov_iter_single_seg_count(), which is completely wrong. That sucker has some weird users left (as of #work.iov_iter), but all of them are actually due to API deficiencies and I very much hope to kill that thing off. Why not simply add iov_iter_check_zeroes(), that would be called after copy_from_iter() and verified that all that's left in the iterator consists of zeroes? Then this copy_struct_from_...() would be trivial to express through those two. And check_zeroes would also be trivial, especially on top of #work.iov_iter. With no calls of iov_iter_advance() at all, while we are at it... IDGI... Omar, what semantics do you really want from that primitive?