Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2725175rwi; Fri, 28 Oct 2022 10:24:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6AxieUOfCuDoAqPn7eosUU+e6OLzI4M7FTHRqGIt01COkvoIQm/K9+7rfBWsbIJ2i83Y44 X-Received: by 2002:a17:90b:4d0e:b0:1f7:ae99:4d7f with SMTP id mw14-20020a17090b4d0e00b001f7ae994d7fmr17253906pjb.200.1666977867839; Fri, 28 Oct 2022 10:24:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666977867; cv=none; d=google.com; s=arc-20160816; b=LmQJRdgZh5ECifxBG1keiFvk5ZepjIQh/UI0ZFSCK4mVH2yUMnSf1oQVDGvlE/rqmd 9CRnAfVqJY9usUELDA6RscnuDT7/nQH3p311Uau3gep2wXLBaKuD708bzE/4ZTItz4LJ 0RUKQlL67MybmoWk1jnyCQ9vWxfVLC/NIiDrqLJzKwbyzMQGssSLxINywWTJyV6EJaP0 bH1sr9AslMir3k5GhwsGGUVP+yD+tqbP2GUpSyvF6DU2DWA6xsqoZbMAxJkp7bDZyMIY MfXpw9BShlUbtonxqRBpgSYKiw8/R0mMfW0cdwWATr9b5viysbchMUSnlUXjw6tzHFG5 JLYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=SGoG4+kkpjFKIiC1aB206pNaNNu8WHtjUzbD9QY9Ydk=; b=0PM6tCPlYCZfkqxTfKhnnCHvoY3r/A7QGXESRPhbcxJaHv5xu9H9juYkDrmhyCdRpq 1hjz3e87uWpY6IcTZLj0SKHQ6GFWBrNgukSA4D/CNtFT32DYh9GiXGmzsnYaodcGMilD lGemrb+QsYVTYw5Ru5RXrHqSUYpw/tytSeVkLcUhlYjzCwAbT3lHiZG+YoQBVQASGJ51 b8DRvkFz48Mk8XfRcKltQY+CBM2iTHLRzefl5Lhy1ioxZHn/ENn9+4Ghmz8JbXCms+Zr 6hOmaZtJULXEtQ4Xcfv794XL4eOc4VoF8HlR0XbtBmAPajjZRM1zw+VLRn96fV7lZdar OYRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=AHLpWHbv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j70-20020a638049000000b004600f27528fsi5848982pgd.175.2022.10.28.10.24.15; Fri, 28 Oct 2022 10:24:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=AHLpWHbv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231425AbiJ1RMO (ORCPT + 99 others); Fri, 28 Oct 2022 13:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231398AbiJ1RLt (ORCPT ); Fri, 28 Oct 2022 13:11:49 -0400 Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C10196AA2B for ; Fri, 28 Oct 2022 10:10:10 -0700 (PDT) Received: by mail-qk1-x72a.google.com with SMTP id o28so1183932qkl.4 for ; Fri, 28 Oct 2022 10:10:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=SGoG4+kkpjFKIiC1aB206pNaNNu8WHtjUzbD9QY9Ydk=; b=AHLpWHbvaJj6iAHcMzE5M/XFIEJbvJiM188nPc4sZcuDlddbnWJj2scjftscU4cF4x 7ek2zIay9rBYB96uXxrfVQTv5OfVuThw3qxUxjLeEdzSlmmCOyQ3PY8Gh2POJX82KNSM 0yIW2D4UUkVkaewo1+mavlSqKbWHmteTLXE9Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SGoG4+kkpjFKIiC1aB206pNaNNu8WHtjUzbD9QY9Ydk=; b=pI06dJL0onfYOeBrb6EbzbThtSXqkiVmOnQPapyv7KO9+9XFnlmfrWNTKffksVQ6qb XbA6bYENLo+xZKn4O0ZbEpxJ72JHSNb/PUbwWSCNx6uon3PSQYK5Pjy5gmbGK99pGdsS GojeSUC6TkmaT4WqapW5NM/ZyO+6cvzl7y8FpENdZ/w8QaUsxYON8lsXUsEOxETe3k7g b5XOQrV7bUw2qExzgXMMXbx06Z7PKqlMHJ3oIaSPPd7xbEgS6ADdXZO9fFHMwWrhmXbX nC2edpgsvwaytESPQgmSatprpN7xKaW2o2P1RkYyliWU/2Ewy1m2HHsP6Fn6HnOkz1nG pIiA== X-Gm-Message-State: ACrzQf3I+HxQXwv5G0/K4wcHzwuLIRgwVXoqNQl0Vy/Gp+EjblfshZZk ZJP6Znskm9uyik31VI/WcWhXytYtq0tyMg== X-Received: by 2002:a05:620a:1204:b0:6ec:db32:18c1 with SMTP id u4-20020a05620a120400b006ecdb3218c1mr169497qkj.401.1666977009318; Fri, 28 Oct 2022 10:10:09 -0700 (PDT) Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com. [209.85.219.172]) by smtp.gmail.com with ESMTPSA id w22-20020a05620a0e9600b006b8e63dfffbsm1390997qkm.58.2022.10.28.10.10.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Oct 2022 10:10:08 -0700 (PDT) Received: by mail-yb1-f172.google.com with SMTP id 187so6850053ybe.1 for ; Fri, 28 Oct 2022 10:10:08 -0700 (PDT) X-Received: by 2002:a25:bb44:0:b0:6bb:a336:7762 with SMTP id b4-20020a25bb44000000b006bba3367762mr192268ybk.501.1666977007965; Fri, 28 Oct 2022 10:10:07 -0700 (PDT) MIME-Version: 1.0 References: <20221028023352.3532080-1-viro@zeniv.linux.org.uk> <20221028023352.3532080-12-viro@zeniv.linux.org.uk> <65441.1666976522@warthog.procyon.org.uk> In-Reply-To: <65441.1666976522@warthog.procyon.org.uk> From: Linus Torvalds Date: Fri, 28 Oct 2022 10:09:51 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 12/12] use less confusing names for iov_iter direction initializers To: David Howells Cc: Al Viro , Christoph Hellwig , willy@infradead.org, dchinner@redhat.com, Steve French , Shyam Prasad N , Rohith Surabattula , Jeff Layton , Ira Weiny , linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 28, 2022 at 10:02 AM David Howells wrote: > > Linus Torvalds wrote: > > > Honestly, I think the *real* fix would be a type-based one. Don't do > > > > iov_iter_kvec(&iter, ITER_DEST, ... > > > > at all, but instead have two different kinds of 'struct iov_iter': one > > as a destination (iov_iter_dst), and one as a source (iov_iter_src), > > Or maybe something along the lines of iov_iter_into_kvec() and > iov_iter_from_kvec()? For the type-based ones, you would need that to initialize the two cases. But without the type-based approach, it ends up being yet another case of "you just have to use the right name, and if you don't, you won't know until the dynamic WARN_ON() tells you". And the dynamic WARN_ON() (or, WARN_ON_ONCE(), as it should be) is great, but only for the drivers that get active testing by developers and robots. Which leaves potentially a _lot_ of random code that ends up being wrong for years. I really like static checking that actually gets noticed by the compiler when you get it wrong. It may not be entirely realistic in this situation, but it would be really nice to try... Linus