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 470D8C433EF for ; Sat, 18 Jun 2022 05:36:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235170AbiFRFgL (ORCPT ); Sat, 18 Jun 2022 01:36:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234014AbiFRFfw (ORCPT ); Sat, 18 Jun 2022 01:35:52 -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 8C7BE66AFA for ; Fri, 17 Jun 2022 22:35:43 -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=apOAIyxxfzdCZYQVl2YZSByPZBwfRS82KC7o6YmITxU=; b=gJMhZN1uITIaiIwmi1jNTdLtpm ivhAkBls5XI31WIHUDQ4zzGJuy4jmt+vmh6PK3Sd6ARVEHJLDVRUuo1+wtD5EZZaQWScc/JJ6mHy1 fCtYeDJypXIFKlJIRtFSesdEOnsUvk1D9DLcnaB9B9qAR6aETl8R1mIgGkkpJtgF5uEPg9p1D7egh hAxAKrt6rLh4/9HTPyiPrr6eBF4REoPTEUV67lFqT65zdqWrswEtDhbJApJLzigrmEvoRnEz5zaVc AdxGL6cIsjyuTk55XLY6i/P2uLdZVBEEyClSc+VbI4Qn8PTIQEXc8UVktQekNRIvYD1mFIhpSLtfP RzqdgjTQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.95 #2 (Red Hat Linux)) id 1o2R7V-001VQn-ML; Sat, 18 Jun 2022 05:35:41 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Christoph Hellwig , Jens Axboe , Matthew Wilcox Subject: [PATCH 17/31] ITER_XARRAY: don't open-code DIV_ROUND_UP() Date: Sat, 18 Jun 2022 06:35:24 +0100 Message-Id: <20220618053538.359065-18-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220618053538.359065-1-viro@zeniv.linux.org.uk> References: <20220618053538.359065-1-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Signed-off-by: Al Viro --- lib/iov_iter.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 379a9a5fa60b..04c3a62679f8 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -1289,15 +1289,7 @@ static ssize_t iter_xarray_get_pages(struct iov_iter *i, offset = pos & ~PAGE_MASK; *_start_offset = offset; - count = 1; - if (size > PAGE_SIZE - offset) { - size -= PAGE_SIZE - offset; - count += size >> PAGE_SHIFT; - size &= ~PAGE_MASK; - if (size) - count++; - } - + count = DIV_ROUND_UP(size + offset, PAGE_SIZE); if (count > maxpages) count = maxpages; -- 2.30.2