Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1564227pxb; Fri, 10 Sep 2021 08:37:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBmP9f5uVXmMByQbROTHb8DjechiYSlvEzAW8yqZcQLaA8hgFBqS+rf09xIvXr0JViebpq X-Received: by 2002:a6b:3e84:: with SMTP id l126mr7734014ioa.151.1631288255696; Fri, 10 Sep 2021 08:37:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631288255; cv=none; d=google.com; s=arc-20160816; b=lURAmXMxkwF6jgOhrgq1ZbIJyYuYqsxYlgafzEjWWqy5iXTYvQtEbFHEgMP3GNPQ+J 0GWD7ImunppQLkl7H4xjs/huRgLRHzasEE7/ELPFVa+FXKapzeCdtKlVD+iPBmL+15XW H0RI6AvlADDOwtiYeObiifVsazhd5lSwcLfAAGk4ysYPMNrUEE7noa4MBxaktEktelCn 66CfwhtUe9BidLCaH2dPkYFXvBo9H/UrnpTY5w5FcQmIQelIm04NfcHLyepmILQjPU0O lXhVEKVgXkvLn9ko10YsHQ3KQQQHmpKV9fbhZJ20YQfsbLo32Kh7Qs7nrVeUdZP1KFQ1 c9wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=gyzTKbWVdKw+duqrxX3upWkRtBAW8/OkSW9a+m+CMLc=; b=CjjNZ/I7bayEKWpSLU4OsTJq24ISi0sjctHFqxrEISrl0s7d02jWAQywnvULvLNiKg 9l+0GCteu1G/4s/GfT/C4qdVRVU5t29j1huijLjrb+OV24FfUvbtO/yG0KFaC6VpqA2R VGY7ud+2dZxPQE8eAtevS7Uw1KPhcvUUTb7S6q/RbCZs4Em8Tljw/25uKIdeqf4tjFnc 5QIZETuemiEoJErZLR3JUAbnnr6nvew1R8F8AvH9lrK4SXIwPkYLj1EMJs3OXpBVZaOg Pec38Czn+Jq+90Cy6xh0ext/ETtJi+SzMkXJGkywysylFPNRZeokxPncWXWQlbc2oMdN jPiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=gcdu5td+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 123si796544jay.90.2021.09.10.08.37.23; Fri, 10 Sep 2021 08:37:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=gcdu5td+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234497AbhIJPhT (ORCPT + 99 others); Fri, 10 Sep 2021 11:37:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232438AbhIJPhT (ORCPT ); Fri, 10 Sep 2021 11:37:19 -0400 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FE52C061574 for ; Fri, 10 Sep 2021 08:36:08 -0700 (PDT) Received: by mail-io1-xd30.google.com with SMTP id q3so2851021iot.3 for ; Fri, 10 Sep 2021 08:36:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=gyzTKbWVdKw+duqrxX3upWkRtBAW8/OkSW9a+m+CMLc=; b=gcdu5td+Rm0+7hdaU82rZ/4mqpy4DsK/VK8JXp6rJ4R8/arEGTp8iE3/wJS75uGwFx 1/Iz3YN1Yd4+mr6xjfsOfXrL6IKKeTJe5q0p1cnXB9vMeQh7MBA/16j2DFQUCilF+Uby lhapYk6cbBMvoRvl12V0oZSf5V1zKQ6YyVnOtl+T6CICiLCfKESi71f8IkTlkXCdKdX1 MvIN48iC0tgFzOLJD8itI3UyteVO3VxDPZQt9Ptzm/Gs9SJvz4rqr836b55MDkHHh9OP z7CAn8pSrtMgE7jscAbo5QA+dFYxwnB9aVARuG9xYjVIM62ZbjkGKP9sKzR0XLF2AAWa H0Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=gyzTKbWVdKw+duqrxX3upWkRtBAW8/OkSW9a+m+CMLc=; b=J2XsxoV8kxsM0N9hxBzhjlqzhSItEmGhNsrcF5CI4fzHxhyzMAanQhdPNLGr3n0Y6j yKHEPO/n+MxL3bPY8y//E7zA7sprCyehF7+hQhBS8oMK9+xszOY1MlY49NPxWnGhHi75 GmLxsKKvUbVSxBDfq/ZTI27m4Dj8xUy2Q8IlwfLXMBdwngi8s0gk7vemNrQkf2OG32fr hGZKzdojrnY3ViibgMr+/5yjXdp3f8UYGwuUjNuIUOFkcFDva9dyV1jXhqwYfg+gXFsz xiiCshV5se58ttt/rBBQqK41xsPa3st9Ggoz1MU31jKRfkwlBniwEAMn/PzLf30gt5/K JnVA== X-Gm-Message-State: AOAM533Hp0lk8NCUwEs3N4jaCQQIiV5fISOfYGUvaI9BwWUeit8HEbDH uKaNB26y2v3aDA7pl5/Ky8l2cZnyUQTmQXcg6Ow= X-Received: by 2002:a5e:da01:: with SMTP id x1mr7823595ioj.43.1631288167484; Fri, 10 Sep 2021 08:36:07 -0700 (PDT) Received: from [192.168.1.30] ([207.135.234.126]) by smtp.gmail.com with ESMTPSA id t14sm2613590ilu.67.2021.09.10.08.36.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Sep 2021 08:36:06 -0700 (PDT) Subject: Re: [git pull] iov_iter fixes To: Al Viro Cc: Linus Torvalds , Pavel Begunkov , Linux Kernel Mailing List , linux-fsdevel References: <9ae5f07f-f4c5-69eb-bcb1-8bcbc15cbd09@kernel.dk> <9855f69b-e67e-f7d9-88b8-8941666ab02f@kernel.dk> <75caf6d6-26d4-7146-c497-ed89b713d878@kernel.dk> From: Jens Axboe Message-ID: <565e8aa7-27e7-4c3c-1a84-4181194c74d8@kernel.dk> Date: Fri, 10 Sep 2021 09:36:06 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/10/21 9:32 AM, Al Viro wrote: > On Fri, Sep 10, 2021 at 09:08:02AM -0600, Jens Axboe wrote: > >>> You actually can cut it down even more - nr_segs + iov remains constant >>> all along, so you could get away with just 3 words here... I would be >> >> Mmm, the iov pointer remains constant? Maybe I'm missing your point, but >> the various advance functions are quite happy to increment iter->iov or >> iter->bvec, so we need to restore them. From a quick look, looks like >> iter->nr_segs is modified for advancing too. >> >> What am I missing? > > i->iov + i->nr_segs does not change - the places incrementing the former > will decrement the latter by the same amount. So it's enough to store > either of those - the other one can be recovered by subtracting the > saved value from the current i->iov + i->nr_segs. Ahh, clever. Yes that should work just fine. Let me test that and send out a proposal. Thanks Al. -- Jens Axboe