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=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 7499AC49EA5 for ; Thu, 24 Jun 2021 21:07:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 56591613C8 for ; Thu, 24 Jun 2021 21:07:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232300AbhFXVJn (ORCPT ); Thu, 24 Jun 2021 17:09:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232163AbhFXVJn (ORCPT ); Thu, 24 Jun 2021 17:09:43 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 902ECC061574 for ; Thu, 24 Jun 2021 14:07:22 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id k8so9600429lja.4 for ; Thu, 24 Jun 2021 14:07:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zAsYzzhXkdofQZ/91vxC7T2pQLg/Al6Inx2IRm0Ut3U=; b=UhgrjmazbjVyroDGAIMCaeMq5+n4Zq0zIRTShHEICkP3b4QusYEcd395MUEp8AFCQx pZlB6wuYan6cRqYD5qIM9Csv3iJOOilTEZiCgxQS1D+CqOSIuFTCsEE+d9Qip5KXOrRx 3AN8UMYj0rqX8g6GxPrgltXzQqGcgVwxVdXIg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zAsYzzhXkdofQZ/91vxC7T2pQLg/Al6Inx2IRm0Ut3U=; b=f52xyTiDgu04KnTBeTnRaMhkfTAyEOz8f3idUvkXAMxOxr0DlXEbaQtr5sgYTG503q fjZnGdGxvTE4U1FmIlgkXAVt55hdjB4a6NbTP3VnlLYGIacX3XHOtmDQ/3rimtrp8siq 1CKdbzdyDnU0GJn2SWLb9b11lYaQcqMkIX47wwLI/HUjE/NurjyfVgdtGSMwe9ifWdTB eAT7Z/pGxA2rZD472vQ5rN1DM6r9jBMkSZqSxjslRhyNN5E7tgmDw5udCHU2pDvQ6Vtd h92RLUh+TIyfwNlgOxUBAQun9oDS2Rtr26BGmzy7yl9IVwcr8VLeKiXmz96agBFle1xk Kx5Q== X-Gm-Message-State: AOAM533nqz8Ec5+aIecQV+kCJZqhj1Soz6pAeXu1YPsD033K8LPNvEtk mMTMoFOAzU79+2QJ21eNtKABziRqjEgxC02xofo= X-Google-Smtp-Source: ABdhPJxvCxc1DJ89/UupNJZILFrLqdg59JIwyD2/hxc5Dn+MGh+0Bnj024oQZ/Zolc4PedcrJEVFzg== X-Received: by 2002:a05:651c:a07:: with SMTP id k7mr5597461ljq.477.1624568840791; Thu, 24 Jun 2021 14:07:20 -0700 (PDT) Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com. [209.85.208.177]) by smtp.gmail.com with ESMTPSA id w24sm323482lfa.143.2021.06.24.14.07.19 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 14:07:19 -0700 (PDT) Received: by mail-lj1-f177.google.com with SMTP id k8so9600330lja.4 for ; Thu, 24 Jun 2021 14:07:19 -0700 (PDT) X-Received: by 2002:a2e:a276:: with SMTP id k22mr5247591ljm.465.1624568838796; Thu, 24 Jun 2021 14:07:18 -0700 (PDT) MIME-Version: 1.0 References: <20210622220639.GH2419729@dread.disaster.area> In-Reply-To: From: Linus Torvalds Date: Thu, 24 Jun 2021 14:07:02 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RESEND x3 v9 1/9] iov_iter: add copy_struct_from_iter() To: Omar Sandoval Cc: Matthew Wilcox , Al Viro , Dave Chinner , linux-fsdevel , linux-btrfs , Linux API , Kernel Team , Dave Chinner Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Thu, Jun 24, 2021 at 11:28 AM Omar Sandoval wrote: > > I'll suggest the fixed-size struct encoded_iov again, then. If we're > willing to give up some of the flexibility of a variable size, then > userspace can always put the fixed-size structure in its own iovec or > include it inline with the data, depending on what's more convenient and > whether it's using O_DIRECT. I really would prefer to have the separate pointer to it. Fixed size doesn't help. It's still "mixed in" unless you have a clearly separate pointer. Sure, user space *could* use a separate iov entry if it wants to, but then it becomes a user choice rather than part of the design. That separate data structure would be the only way to do it for a ioctl() interface, but in the readv/writev world the whole separate "first iov entry" does that too. I also worry that this "raw compressed data" thing isn't the only thing people will want to do. I could easily see some kind of "end-to-end CRC read/write" where the user passes in not just the data, but also checksums for it to validate it (maybe because you're doing a file copy and had the original checksums, but also maybe because user space simply has a known good copy and doesn't want errors re-introduced due to memory corruption). And I continue to think that this whole issue isn't all that different from the FSVERITY thing. Of course, the real take-away is that "preadv2/pwritev2()" is a horrible interface. It should have been more extensible, rather than the lazy "just add another flag argument". I think we finally may have gotten a real extensible interface right with openat2(), and that "open_how" thing, but maybe I'm being naive and it will turn out that that wasn't so great either. Maybe we'll some day end up with a "preadv3()" that has an extensible "struct io_how" argument. Interfaces are hard. Linus