From patchwork Wed Jun 22 04:15:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 12890117 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 D8B15CCA47A for ; Wed, 22 Jun 2022 04:17:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356907AbiFVERH (ORCPT ); Wed, 22 Jun 2022 00:17:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356851AbiFVEQK (ORCPT ); Wed, 22 Jun 2022 00:16:10 -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 A4556165A8 for ; Tue, 21 Jun 2022 21:16:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=U4EtewnBFbTPEF12aprvcdvs76IRTF0XhXYK8SHtVQg=; b=gGubJ94ov4565wjcpkPfTWqPrq a0WAgUADlYT0dPHu+OUelNyZSQ1qwKMqhx4FlhlFPkyeqfYd8UrVbLmacxkuGqs0wGh48wq0PAry7 LohvWnBzODELjclGsHNtKK9Nv5J7bOGbJU5PZ/J06/Ar1pwbmYZ50bU0uS7zkqONYFah0+pZFuX+T UfhuS5sc79oit78p27R9Fw/7mVg/c6SnYHSs6deN1Jo1A6hzDrooIhcCIc/O6zlSNHpXtUlaDuPxY +HQzrurMm/0HNdKkiGbA7H93wZAPkF3tb44APaMpfLwcPgnBdtg3vkYudK0S0jpqU78wA1fAtQZNU AK3FM9vg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.95 #2 (Red Hat Linux)) id 1o3rma-00360c-Qr; Wed, 22 Jun 2022 04:16:00 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Jens Axboe , Christoph Hellwig , Matthew Wilcox , David Howells , Dominique Martinet , Christian Brauner Subject: [PATCH 44/44] expand those iov_iter_advance()... Date: Wed, 22 Jun 2022 05:15:52 +0100 Message-Id: <20220622041552.737754-44-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220622041552.737754-1-viro@zeniv.linux.org.uk> References: <20220622041552.737754-1-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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 a8045c97b975..79c86add8dea 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -1284,7 +1284,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; } @@ -1373,7 +1374,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))