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 42004C433F5 for ; Fri, 10 Sep 2021 18:51:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2CC86611BD for ; Fri, 10 Sep 2021 18:51:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232404AbhIJSwK (ORCPT ); Fri, 10 Sep 2021 14:52:10 -0400 Received: from zeniv-ca.linux.org.uk ([142.44.231.140]:43852 "EHLO zeniv-ca.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229546AbhIJSv6 (ORCPT ); Fri, 10 Sep 2021 14:51:58 -0400 Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mOlZi-002y21-5p; Fri, 10 Sep 2021 18:48:34 +0000 Date: Fri, 10 Sep 2021 18:48:34 +0000 From: Al Viro To: Linus Torvalds Cc: Jens Axboe , Pavel Begunkov , Linux Kernel Mailing List , linux-fsdevel Subject: Re: [git pull] iov_iter fixes Message-ID: References: <9855f69b-e67e-f7d9-88b8-8941666ab02f@kernel.dk> <4b26d8cd-c3fa-8536-a295-850ecf052ecd@kernel.dk> <1a61c333-680d-71a0-3849-5bfef555a49f@kernel.dk> 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-kernel@vger.kernel.org On Fri, Sep 10, 2021 at 10:31:00AM -0700, Linus Torvalds wrote: > On Fri, Sep 10, 2021 at 10:26 AM Jens Axboe wrote: > > > > On 9/10/21 10:58 AM, Linus Torvalds wrote: > > > On Fri, Sep 10, 2021 at 9:56 AM Al Viro wrote: > > >> > > >> What's the point of all those contortions, anyway? You only need it for > > >> iovec case; don't mix doing that and turning it into flavour-independent > > >> primitive. > > > > > > Good point, making it specific to iovec only gets rid of a lot of > > > special cases and worries. > > > > > > This is fairly specialized, no need to always cater to every possible case. > > > > Alright, split into three patches: > > > > https://git.kernel.dk/cgit/linux-block/log/?h=iov_iter > > That looks sane to me. > > Please add some comment about how that > > i->iov -= state->nr_segs - i->nr_segs; > > actually is the right thing for all the three cases (iow how 'iov', > 'kvec' and 'bvec' all end up having a union member that acts the same > way). > > But yeah, I like how the io_uring.c code looks better this way too. > > Al, what do you think? I think that sizeof(struct bio_vec) != sizeof(struct iovec): struct bio_vec { struct page *bv_page; unsigned int bv_len; unsigned int bv_offset; }; takes 3 words on 32bit boxen. struct iovec { void __user *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */ __kernel_size_t iov_len; /* Must be size_t (1003.1g) */ }; takes 2 words on 32bit boxen.