Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1564456pxb; Fri, 10 Sep 2021 08:37:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJ//0LbKgT7DkBAcFadP4emNOfkBrOFMJeW0uJJ1OjwFh5kb56FuiFug84wNiNbLh8Pn0B X-Received: by 2002:a5d:9693:: with SMTP id m19mr7716566ion.72.1631288272416; Fri, 10 Sep 2021 08:37:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631288272; cv=none; d=google.com; s=arc-20160816; b=ZTsP4URDU6OQCRwHzlQ00tLW9q9L/hlj5Sww4d/kQnGZHk0vpZHE07LCNAIjRKmP2Z VimoNyUzpUcbxF9NhZwj3wJP3H7/QaY048M0pMcVNr5MEEXVHgSC3t0l/rKMXEldPmzo ttip3OeCgSLY7JjopqEp6vyrm9eMVgSz6Tv26YE1uLxctHvxHNzbZvAOnU5vgx1q2UdU N9ccZsfsutRBOFN3kW9Jx3sxqpO/WmebuOuu7rE3F7GrksHqnk775wg5LGVbbGJzuLCF jSB4nJZg2tncmKZxuz/xMyt9l3mDL1Vu2TEaqIfsJixVgr/KSUktD19pGtJaDvNmF6+u 00tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=v1J6ZRL9rnQLsh0jTSRi3bJtquun0M6KglgHKt3w7+Q=; b=BE5hbyZQNwszU4+PRmAHFGDEa+9OeK614oqEkccY7S1Bo3l4tiYpZo4m9UoqHXf9sA /4HRiMv8LyGRioYlPlP39wTO/gPqvO/+UJdw2XV15jxCOJJDaKIGxokoU5dE+YFJjaxu nZrTHPprv+PSPowHOwHmH19ZwXegc4P6JopcMwZnxP9wW4wblN/pdUSn7W/5xguUvxuU WhqrteszZuxQ2gSQ8s2YusriX6USC3X9+Bx/gmXvS/aQeWGYE1nlNovoxZWRARd6iWg+ HfLCQK2oWsdGkJXXWh+xv8YJZ7f0MMeTh0LgWz4ffng+FFpDUoFFlcQTXMEXRWG6bYwA IVUQ== ARC-Authentication-Results: i=1; mx.google.com; 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 r17si5177473iln.147.2021.09.10.08.37.40; Fri, 10 Sep 2021 08:37:52 -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; 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 S234463AbhIJPgD (ORCPT + 99 others); Fri, 10 Sep 2021 11:36:03 -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.