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 82B2AC49EA2 for ; Fri, 18 Jun 2021 19:50:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 70609613C1 for ; Fri, 18 Jun 2021 19:50:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232246AbhFRTwO (ORCPT ); Fri, 18 Jun 2021 15:52:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229591AbhFRTwO (ORCPT ); Fri, 18 Jun 2021 15:52:14 -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 A3254C061574; Fri, 18 Jun 2021 12:50:04 -0700 (PDT) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1luKUz-009jmj-GB; Fri, 18 Jun 2021 19:49:53 +0000 Date: Fri, 18 Jun 2021 19:49:53 +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-fsdevel@vger.kernel.org On Fri, Jun 18, 2021 at 07:42:41PM +0000, Al Viro wrote: > 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? And for pity sake, let's not do that EXPORT_SYMBOL_GPL() posturing there. If it's a sane general-purpose API, it doesn't matter who uses it; if it's not, it shouldn't be exported in the first place. It can be implemented via the already exported primitives, so it's not as if we prevented anyone from doing an equivalent...