Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4161810pxj; Tue, 25 May 2021 01:37:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+UgzVgjDe6g21kKDtpttu4Ipys4QKRxVZaT74YANIM0BzVK8qhS4P1+u0wF9OAdZkX0wX X-Received: by 2002:a17:907:98c9:: with SMTP id kd9mr11666002ejc.54.1621931835054; Tue, 25 May 2021 01:37:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621931835; cv=none; d=google.com; s=arc-20160816; b=QJSwvJk6HvMNCy5nqi/AvLVOujCct1HykEcMfGLRyD+zrru9uzashmivlyE4nQPPG8 V/LW9UhQA/vMbyiEAJs8e1iGTTYGbkWafZ0bXcawLTC5InzuUqdGabuL6NKHH2Smeogw 3u75GjjxpMLGzv5b/jAPYB66vkWPDoSHMzzuTFgOdiuJBHP+ml6nlMlQVyNfnXZN1swV pn/uIAF9yBp0uqeukxaHR+gz6ty9td1BM+YOKi/X1E86yjGQyb13g4o5zvxzz7gwRigQ nInzRiBBcfIlfishaviI00oau2xO7mxcG3xBLIfzQemOf3GTU5S+08SmehBJzgIuhTlE pi+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=uEwFf47I8Wj+8l2CBidCuWQhnNt8xqs4LY33/O8pjTU=; b=u+MvQ/aEButlADzD/XS9Aa5bB98ofNhAEEAG9dnapyC6mn6J8S3no/gen/t2noYkRP GpdQz8ktAk1WFAql92qMDi6D/hnIpvfkOHLsHxKbx+LfqBGJW7HPHKQXwE1vRIPNYQkV 8j5E+UaXaCRTNgu7T47EVOez42KEF9tdMjTeKu9eZtUdLI3k/0MxwA+txRRSMVGaTvi/ HCaOQjFERPq7NDVYCYZD6ELXiLlZIDBrT7Cb2BPJ5BknC++Z00Cq/rWU2fvHwm7Axoy3 P8HTqD/lJ5/nYPADqUFwcSxRUD5MI7NRn85euoTMUbGXtzKkn4YElbvfY3LGfUnSQEKo bSxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si2627768ede.603.2021.05.25.01.36.41; Tue, 25 May 2021 01:37:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232154AbhEYIJr (ORCPT + 99 others); Tue, 25 May 2021 04:09:47 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:3999 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231794AbhEYIJP (ORCPT ); Tue, 25 May 2021 04:09:15 -0400 Received: from dggems702-chm.china.huawei.com (unknown [172.30.72.58]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4Fq5lF5NPpzmbSD; Tue, 25 May 2021 15:47:21 +0800 (CST) Received: from dggpeml500019.china.huawei.com (7.185.36.137) by dggems702-chm.china.huawei.com (10.3.19.179) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 25 May 2021 15:49:41 +0800 Received: from huawei.com (10.175.124.27) by dggpeml500019.china.huawei.com (7.185.36.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 25 May 2021 15:49:41 +0800 From: Wu Bo To: , , , , , CC: , Subject: [PATCH 2/2] fs: direct-io: use DIV_ROUND_UP helper macro for calculations Date: Tue, 25 May 2021 16:15:20 +0800 Message-ID: <1621930520-515336-3-git-send-email-wubo40@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1621930520-515336-1-git-send-email-wubo40@huawei.com> References: <1621930520-515336-1-git-send-email-wubo40@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500019.china.huawei.com (7.185.36.137) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Wu Bo Replace open coded divisor calculations with the DIV_ROUND_UP kernel macro for better readability. Signed-off-by: Wu Bo --- fs/direct-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/direct-io.c b/fs/direct-io.c index b2e86e7..6e7d402 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -195,7 +195,7 @@ static inline int dio_refill_pages(struct dio *dio, struct dio_submit *sdio) iov_iter_advance(sdio->iter, ret); ret += sdio->from; sdio->head = 0; - sdio->tail = (ret + PAGE_SIZE - 1) / PAGE_SIZE; + sdio->tail = DIV_ROUND_UP(ret, PAGE_SIZE); sdio->to = ((ret - 1) & (PAGE_SIZE - 1)) + 1; return 0; } -- 1.8.3.1