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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D75BC433EF for ; Sat, 18 Jun 2022 11:15:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233683AbiFRLPE (ORCPT ); Sat, 18 Jun 2022 07:15:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232966AbiFRLOz (ORCPT ); Sat, 18 Jun 2022 07:14:55 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DFFC22B06 for ; Sat, 18 Jun 2022 04:14:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=c9Qc1yz17z0wRLxAuSUHXx+qnX2+o4P0wDFDhEoDKVM=; b=ZX+x/rON+NV9Ts5ZFwTjJ4Cjme fxV8yDrqqox0aa8oF1HtEQrtsTf8fTBDKyfmuEPmlFolDvuXf7nPy2jO4wC3EqSCr97CZjvwXDZzZ 5UUBk+/JfYxJ1NEfH6F2yiF6LqW89yJHcA8SdGA1/cm0GPNoR2ky9NBgQJyt8HxinaiLmuo6yU9Nf t/SCu6nyG1YOMujoYStHGXeKsARrqWQJeUykEjrimw3FffcZekISRI9krvAOv56P0XizQYYskOJOc hUclGwJU89JgTKrmqLFevMw/hcOLKRWuEfvTr+7N6O89L5OVSZR8q36qY3DZJ6HBFM26LYLJ3hjBJ VvjSOXNQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.95 #2 (Red Hat Linux)) id 1o2WPl-001alH-HR; Sat, 18 Jun 2022 11:14:53 +0000 Date: Sat, 18 Jun 2022 12:14:53 +0100 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Christoph Hellwig , Jens Axboe , Matthew Wilcox Subject: Re: [PATCH 31/31] expand those iov_iter_advance()... Message-ID: References: <20220618053538.359065-1-viro@zeniv.linux.org.uk> <20220618053538.359065-32-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220618053538.359065-32-viro@zeniv.linux.org.uk> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org [braino fixed] >From fe8e2809c7db0ec65403b31b50906f3f481a9b10 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 11 Jun 2022 04:04:33 -0400 Subject: [PATCH 31/31] expand those iov_iter_advance()... Signed-off-by: Al Viro --- lib/iov_iter.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 68a2e2a68aa1..38e7605a6794 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -1279,7 +1279,8 @@ static ssize_t iter_xarray_get_pages(struct iov_iter *i, return 0; maxsize = min_t(size_t, nr * PAGE_SIZE - offset, maxsize); - iov_iter_advance(i, maxsize); + i->iov_offset += maxsize; + i->count -= maxsize; return maxsize; } @@ -1367,7 +1368,13 @@ static ssize_t __iov_iter_get_pages_alloc(struct iov_iter *i, for (int k = 0; k < n; k++) get_page(p[k] = page + k); maxsize = min_t(size_t, maxsize, n * PAGE_SIZE - *start); - iov_iter_advance(i, maxsize); + i->count -= maxsize; + i->iov_offset += maxsize; + if (i->iov_offset == i->bvec->bv_len) { + i->iov_offset = 0; + i->bvec++; + i->nr_segs--; + } return maxsize; } if (iov_iter_is_pipe(i)) -- 2.30.2