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.8 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 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 7C045C49EA7 for ; Thu, 24 Jun 2021 02:01:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5BF8661263 for ; Thu, 24 Jun 2021 02:01:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229818AbhFXCD1 (ORCPT ); Wed, 23 Jun 2021 22:03:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229759AbhFXCD0 (ORCPT ); Wed, 23 Jun 2021 22:03:26 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BFF6C061574; Wed, 23 Jun 2021 19:01:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=0QHbmQbQHTx8CxUzqQMkfKnK4E0g0O8Q4OT44lwAo9M=; b=IveZmI3vJmiCcXAA2q0IDt8hNY RxCZRjKOZ4WlZYM7PFVhJimOZiZz1caDs6mPZMK/lQXuEqFHTT/WEnT5zfLX/roW1KX5tQLcLdlP8 XsvxwheFWGr/wCQ+Q/7D985+jHRqnCHEYjY4FD4J3E1kSB3qNK1Mr+F8jyNkYkCwGjX4YQtIrD0E7 z/Hfao/eSWJKdG0RfP1CXFzS38dlZBFyx8FyxKqxhit4ZSugMf4A30tWsHMvDO5IWBP2i/pAx4P2s HzYzwMikO2KH7ByhSpAjd4FDM55uB9UmVOzgYmvXid6REd0a7CA71Ixg3C5zQTdxJu3JbEN0RWmn9 4QSeT/qA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwEfX-00G4ne-FP; Thu, 24 Jun 2021 02:00:45 +0000 Date: Thu, 24 Jun 2021 03:00:39 +0100 From: Matthew Wilcox To: Omar Sandoval Cc: Al Viro , Linus Torvalds , Dave Chinner , linux-fsdevel , linux-btrfs , Linux API , Kernel Team , Dave Chinner Subject: Re: [PATCH RESEND x3 v9 1/9] iov_iter: add copy_struct_from_iter() Message-ID: References: <20210622220639.GH2419729@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Wed, Jun 23, 2021 at 02:58:32PM -0700, Omar Sandoval wrote: > But what you described would look more like: > > // Needs to be large enough for maximum returned header + data. > char buffer[...]; > struct iovec iov[] = { > { buffer, sizeof(buffer) }, > }; > preadv2(fd, iov, 2, -1, RWF_ENCODED); > // We should probably align the buffer. > struct encoded_iov *encoded_iov = (void *)buffer; > char *data = buffer + encoded_iov->size; > > That's a little uglier, but it should work, and allows for arbitrary > extensions. So, among these three alternatives (fixed size structure > with reserved space, variable size structure like above, or ioctl), > which would you prefer? Does that work for O_DIRECT and the required 512-byte alignment?