Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1320278pxb; Wed, 6 Apr 2022 14:58:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWv4renwLQFYK+sHtf9fEboM/Rux2eW0+09NOFPHICZMGfLbuEN7yJ7jaJv8N4VHbJgJMs X-Received: by 2002:a63:907:0:b0:374:b3c2:2df2 with SMTP id 7-20020a630907000000b00374b3c22df2mr8639944pgj.614.1649282297185; Wed, 06 Apr 2022 14:58:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649282297; cv=none; d=google.com; s=arc-20160816; b=BOQrV85/TuLTfpHWLWPiHc3eX+AB/I1Q5kbE2qrl9PuULrEKVy+0tY5TQDiVkp1q+P sZvZMv7YdBXlyUd5ayNzKmr8l/wcvlfzCQreyRIST/sWoZLtcfTxQismx8XcW6mD8oIP AlC0ah+02/HXuHDOmX2z6yf7PWlioBetaydJ6apy4U/2XwiVga8Co9jLTSjql6Tb9iO4 xpzvTWoQg9rc0eU4FpYPLuwkZYAQT0rI6YES0GbZonPST3QtNpwDxX2R8OtRrFt4EzOU 7nsHAuh/Wo/KEpiHqwjOTVkSkNwvoe4cR8eoQA5hFNhlLXYY7Fhet3VAMUURpC3bqxZe RW/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8LQaWUct48NS9KOzqSJyG6Q8nrCLvO/0d/8JaBy+8UI=; b=Ka3ZS4dKJ5wMlf3MvfwOryyIGFwViHswp8ASApCfuQB/wvDWDZrAnYK62m88O2Ja6s QH3xN7c3uBkeLigMxkYIbo9u6URNUiC+aXqiejVdRcnfcGIVzbwBl2Q7dre1uKbHAAoY rsrdxiKXar/YPgWa1VQDxkmkiVIgJPc2dZb/k92CEBiyTQk4dAIGqab7nXGDTBbCGY8u qF3zaufYc3+CNj1CiJ4vASmKcbbL71YURuTUUs1TxdzMkUO+gwtpzMPVksW7B7qgOHrg tWiH/q2Xf+Hgs5difhbwMf1tG4FPicplkVu7MvjEqA8+6YcQV0aZN/glVBiIgQIS6Mkq 66ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linbit-com.20210112.gappssmtp.com header.s=20210112 header.b=8TLmi9yB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc1-20020a170902930100b00153b2d164f2si16060728plb.250.2022.04.06.14.58.01; Wed, 06 Apr 2022 14:58:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linbit-com.20210112.gappssmtp.com header.s=20210112 header.b=8TLmi9yB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232079AbiDFUxP (ORCPT + 99 others); Wed, 6 Apr 2022 16:53:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230028AbiDFUvj (ORCPT ); Wed, 6 Apr 2022 16:51:39 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBCA53CBF38 for ; Wed, 6 Apr 2022 12:07:36 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id r13so6261381ejd.5 for ; Wed, 06 Apr 2022 12:07:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linbit-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8LQaWUct48NS9KOzqSJyG6Q8nrCLvO/0d/8JaBy+8UI=; b=8TLmi9yBHa5xfLlHJtNCWx/79qp4+wuKkyxTxgSZtFc2EXW66RIEfopio1Yw+IBGtI 6zrd5FaUZBKsPWNz7OcfX4S8P/YnO6QAQsUVEIP8ecGjtCTCwGvutCrVx7+QzVtjDmo4 vDA3YxoKJixzsVnvWjfdYRN2iLRa7hBuqURTaxUrLei+2EAA1QYn6SdisYjJFh1oalQT WfnTDmBuLl53v1JN5NavC3N5mpE2QkeT9bRWdMFUesnvBV4W9OLhmzE2tQUrooRgOY0p iIRanPlPSedLVXDBbtP2wmNAqqk05QBOTOzOTgU/fqykRCZGO+fJcwCyjEQD0Nlp/ijn gYCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8LQaWUct48NS9KOzqSJyG6Q8nrCLvO/0d/8JaBy+8UI=; b=HMl2dxhm1ztvYn51KQn0l+inIAsZr4xujhtli9V3YvdanxOmMscWuSTl8oJ01wDqsp j0fkw2B9w0WGdOCIKeOcih/syT/SBJolTIN3rmy+VNr451OeuvS3mobC2YwbvXAwHbhi usRis/qTPy9s1L/W47I2LTeJO/YlsuNxeYmvR7SsJpDO8D6fKPeTa/QOvJe/dXdOgWOx +zMsJnO3s1H2rD4778HmKg5R0XOjWKIPHhIxnuKXRLqO+kQtwcbXYa0Y2viQlssJNuXe hOJfr+NyLdMYER51krS/SfW4fFAPTvYPewvbPRWOASTCxr2H62exBgV5/MyYbtB9U6lA tj2g== X-Gm-Message-State: AOAM5310AatH1HBjbm6oZ7zoEaE9Zyt1PNGHp8jPVxDS1RuMKMTjXK+B hDlV1aBpkaeuL54DLIVTFdGCKw== X-Received: by 2002:a17:907:1c9e:b0:6e0:2fed:869a with SMTP id nb30-20020a1709071c9e00b006e02fed869amr9619973ejc.122.1649272055250; Wed, 06 Apr 2022 12:07:35 -0700 (PDT) Received: from localhost (85-127-190-169.dsl.dynamic.surfer.at. [85.127.190.169]) by smtp.gmail.com with ESMTPSA id q2-20020a170906144200b006ceb8723de9sm6853732ejc.120.2022.04.06.12.07.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 12:07:34 -0700 (PDT) From: =?UTF-8?q?Christoph=20B=C3=B6hmwalder?= To: Jens Axboe Cc: drbd-dev@lists.linbit.com, linux-kernel@vger.kernel.org, Lars Ellenberg , Philipp Reisner , linux-block@vger.kernel.org, Cai Huoqing , =?UTF-8?q?Christoph=20B=C3=B6hmwalder?= Subject: [PATCH 4/7] drbd: Make use of PFN_UP helper macro Date: Wed, 6 Apr 2022 21:07:12 +0200 Message-Id: <20220406190715.1938174-5-christoph.boehmwalder@linbit.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220406190715.1938174-1-christoph.boehmwalder@linbit.com> References: <20220406190715.1938174-1-christoph.boehmwalder@linbit.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cai Huoqing it's a refactor to make use of PFN_UP helper macro Signed-off-by: Cai Huoqing Reviewed-by: Christoph Böhmwalder --- drivers/block/drbd/drbd_bitmap.c | 2 +- drivers/block/drbd/drbd_receiver.c | 4 ++-- drivers/block/drbd/drbd_worker.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c index df25eecf80af..9e060e49b3f8 100644 --- a/drivers/block/drbd/drbd_bitmap.c +++ b/drivers/block/drbd/drbd_bitmap.c @@ -683,7 +683,7 @@ int drbd_bm_resize(struct drbd_device *device, sector_t capacity, int set_new_bi } } - want = ALIGN(words*sizeof(long), PAGE_SIZE) >> PAGE_SHIFT; + want = PFN_UP(words*sizeof(long)); have = b->bm_number_of_pages; if (want == have) { D_ASSERT(device, b->bm_pages != NULL); diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 911c26753556..c6c1843452ba 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -364,7 +364,7 @@ drbd_alloc_peer_req(struct drbd_peer_device *peer_device, u64 id, sector_t secto struct drbd_device *device = peer_device->device; struct drbd_peer_request *peer_req; struct page *page = NULL; - unsigned nr_pages = (payload_size + PAGE_SIZE -1) >> PAGE_SHIFT; + unsigned nr_pages = PFN_UP(payload_size); if (drbd_insert_fault(device, DRBD_FAULT_AL_EE)) return NULL; @@ -1631,7 +1631,7 @@ int drbd_submit_peer_request(struct drbd_device *device, sector_t sector = peer_req->i.sector; unsigned data_size = peer_req->i.size; unsigned n_bios = 0; - unsigned nr_pages = (data_size + PAGE_SIZE -1) >> PAGE_SHIFT; + unsigned nr_pages = PFN_UP(data_size); /* TRIM/DISCARD: for now, always use the helper function * blkdev_issue_zeroout(..., discard=true). diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index 0f9956f4e9c4..af3051dd8912 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c @@ -1030,7 +1030,7 @@ static void move_to_net_ee_or_free(struct drbd_device *device, struct drbd_peer_ { if (drbd_peer_req_has_active_page(peer_req)) { /* This might happen if sendpage() has not finished */ - int i = (peer_req->i.size + PAGE_SIZE -1) >> PAGE_SHIFT; + int i = PFN_UP(peer_req->i.size); atomic_add(i, &device->pp_in_use_by_net); atomic_sub(i, &device->pp_in_use); spin_lock_irq(&device->resource->req_lock); -- 2.35.1