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 86AD9C433EF for ; Fri, 10 Sep 2021 15:34:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6A34E6101A for ; Fri, 10 Sep 2021 15:34:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234470AbhIJPgE (ORCPT ); Fri, 10 Sep 2021 11:36:04 -0400 Received: from zeniv-ca.linux.org.uk ([142.44.231.140]:40486 "EHLO zeniv-ca.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232438AbhIJPgD (ORCPT ); Fri, 10 Sep 2021 11:36:03 -0400 Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mOiW7-002vpN-NE; Fri, 10 Sep 2021 15:32:39 +0000 Date: Fri, 10 Sep 2021 15:32:39 +0000 From: Al Viro To: Jens Axboe Cc: Linus Torvalds , Pavel Begunkov , Linux Kernel Mailing List , linux-fsdevel Subject: Re: [git pull] iov_iter fixes Message-ID: References: <9ae5f07f-f4c5-69eb-bcb1-8bcbc15cbd09@kernel.dk> <9855f69b-e67e-f7d9-88b8-8941666ab02f@kernel.dk> <75caf6d6-26d4-7146-c497-ed89b713d878@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <75caf6d6-26d4-7146-c497-ed89b713d878@kernel.dk> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.