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 5E908C43334 for ; Tue, 28 Jun 2022 11:54:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344706AbiF1Ly3 (ORCPT ); Tue, 28 Jun 2022 07:54:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343940AbiF1Ly0 (ORCPT ); Tue, 28 Jun 2022 07:54:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69A3B3120F for ; Tue, 28 Jun 2022 04:54:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 07A7D60C52 for ; Tue, 28 Jun 2022 11:54:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F52EC3411D; Tue, 28 Jun 2022 11:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656417265; bh=1Q4++zpLkRFe/UIhP6KJ0fKCw4wahMqTAY4KpRGuu/8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=fzaCgTyIZOsWpgFfJLp7JznhfOu/ui8TGTNJmwyk39QY2M4Ll3XSpDoHlKX8Rb/zI sPJLmKhuJHAv4Nm670/rYv8MX8Ywq7pc0iANz7jbspia4ipVf/b1Kt5LXcyMtCIRNX fLPdKCAgeY04+ZLMcuZpCAnUEy9yR686eTNhzuaS5btCl24p19Sy7e2OYmpCfmCLvs HUbAwUGt5aFi+jps9aspYlRgHzaQiw2AbYfRZs/yUrNqcAIQ2i24om2pf3pfQ3fPAG eLP+n3dFhqveHSPJKLmKLqXuhpQmwd5Y3UME/n6oWXPGl/mzSr/ksWblBOQ5n8SFYP g3U2uZfYblJog== Message-ID: Subject: Re: [PATCH 29/44] ITER_XARRAY: don't open-code DIV_ROUND_UP() From: Jeff Layton To: Al Viro , linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Jens Axboe , Christoph Hellwig , Matthew Wilcox , David Howells , Dominique Martinet , Christian Brauner Date: Tue, 28 Jun 2022 07:54:23 -0400 In-Reply-To: <20220622041552.737754-29-viro@zeniv.linux.org.uk> References: <20220622041552.737754-1-viro@zeniv.linux.org.uk> <20220622041552.737754-29-viro@zeniv.linux.org.uk> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.2 (3.44.2-1.fc36) MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Wed, 2022-06-22 at 05:15 +0100, Al Viro wrote: > Signed-off-by: Al Viro > --- > lib/iov_iter.c | 10 +--------- > 1 file changed, 1 insertion(+), 9 deletions(-) >=20 > diff --git a/lib/iov_iter.c b/lib/iov_iter.c > index 811fa09515d8..92a566f839f9 100644 > --- a/lib/iov_iter.c > +++ b/lib/iov_iter.c > @@ -1289,15 +1289,7 @@ static ssize_t iter_xarray_get_pages(struct iov_it= er *i, > offset =3D pos & ~PAGE_MASK; > *_start_offset =3D offset; > =20 > - count =3D 1; > - if (size > PAGE_SIZE - offset) { > - size -=3D PAGE_SIZE - offset; > - count +=3D size >> PAGE_SHIFT; > - size &=3D ~PAGE_MASK; > - if (size) > - count++; > - } > - > + count =3D DIV_ROUND_UP(size + offset, PAGE_SIZE); > if (count > maxpages) > count =3D maxpages; > =20 Reviewed-by: Jeff Layton