From patchwork Fri Apr 21 19:58:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13220637 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 782EAC77B7E for ; Fri, 21 Apr 2023 19:58:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 46F726B0072; Fri, 21 Apr 2023 15:58:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E4E36B007B; Fri, 21 Apr 2023 15:58:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D525F6B0072; Fri, 21 Apr 2023 15:58:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 9C6106B007D for ; Fri, 21 Apr 2023 15:58:22 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5C94514090D for ; Fri, 21 Apr 2023 19:58:22 +0000 (UTC) X-FDA: 80706460044.27.996B831 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf02.hostedemail.com (Postfix) with ESMTP id AF55180014 for ; Fri, 21 Apr 2023 19:58:19 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=qTRjtG4X; spf=none (imf02.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682107099; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=RlYZtMcWmG/W2kDdFWLbtYt9Jiujn88dB6HTCMaouxI=; b=1VgkJCa6c5PaM8vNWYXymz7s9/IT0Vco/cs57FfP/yDVGEqkoQGnp2+eJN1IJL5C+yMrfv olMteksPM5mpr7SclcjWslFjyMD6sdajpDVdvffZ6uJGhtME+9UiaENwAj4adZGBzeifr6 Epb3/lQ15XBPuI51Cc5MFQNrmqthoWc= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=qTRjtG4X; spf=none (imf02.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682107099; a=rsa-sha256; cv=none; b=rkTxAvdO5725kY6d2QJYwrairnd+qEOtZWD/qtiVTu8JqjoC//kSYVMO9Si9NX/SHFCEIf E4+9DqPLWE2SFtNnwlbYT/gNFsoFZAfWYlJyc/gz4ZsHeABqmUXQqUK0msC6qoMc4xA6NY 6ZwHSW0K9CWYooxG+M1wi4fW86OJ824= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=RlYZtMcWmG/W2kDdFWLbtYt9Jiujn88dB6HTCMaouxI=; b=qTRjtG4XiiUGR6XLhcw+SFktov LoDASQYMHVLj3TTg5Lw0jryhjP4LqtTs5LsbGN8HjKQwWO9XJb2N6gJoJdU2Kbxy3omeTFZdCuvu9 gYsf5oHp7r0+jNOMXyus067c8U1t8hqR7BaZ7XU9tE5o5lpKgnd7lXd/DLUlJ0pBQsJr0jx9OR/47 1fBRNIc53lCZDX5v1jMR7xMlrxsp2KBuUX3ZJS59UrN9p8IgGGDnMRpYh9885bwZV49u+cfeaApWm 7EbwnxAkoRXz2ALy5RYREPDptZqMo4YNQcuh2gLrKyg50PFZ75wR7Mef75Ihe/+CAH3kPwfVf6eN9 vxETgCxw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1ppwtU-00BlaX-1a; Fri, 21 Apr 2023 19:58:08 +0000 From: Luis Chamberlain To: axboe@kernel.dk, agk@redhat.com, snitzer@kernel.org, philipp.reisner@linbit.com, lars.ellenberg@linbit.com, christoph.boehmwalder@linbit.com, hch@infradead.org, djwong@kernel.org, minchan@kernel.org, senozhatsky@chromium.org Cc: patches@lists.linux.dev, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, dm-devel@redhat.com, drbd-dev@lists.linbit.com, linux-kernel@vger.kernel.org, willy@infradead.org, hare@suse.de, p.raghav@samsung.com, da.gomez@samsung.com, kbusch@kernel.org, mcgrof@kernel.org Subject: [PATCH 1/5] dm integrity: simplify by using PAGE_SECTORS_SHIFT Date: Fri, 21 Apr 2023 12:58:03 -0700 Message-Id: <20230421195807.2804512-2-mcgrof@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230421195807.2804512-1-mcgrof@kernel.org> References: <20230421195807.2804512-1-mcgrof@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: AF55180014 X-Stat-Signature: szk186tatsa5et4fefs6dgajacoujg7u X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1682107099-163088 X-HE-Meta: U2FsdGVkX1+2UBrqTH5xeQzsBj4BWyrbbctoeTmYiBWByuJGnN2y+fcoH41B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mmJO+Sgdn+aCCK5JChdSp7jEKIFycoqfG+QhxnW7DMCLS2MeOmKKgc5AUVxJpWUo6nuU1cl0qkFcbk5XJi+dazT3UDiUacxtp4H/73PJCeqFsF33DPUrtaSiBxmC5jcRhx8wDeFelSy5QdrP9Ub9UzCToSjGLtwc6oXk0JBqqm9rCVOJZGxGRGJWojzyWFbuA1thVreuM9Hgi8Oc9JWTsswQjEtHYq1w1bwuHezUhYQf1LDq/a6FrgwzTmj/TCj4eB5h7Fpx7xnQIOxITmu+iys1PBA6isQRoB9f75/9Hd/zCqNVCwHPUaiQRc X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The PAGE_SHIFT - SECTOR_SHIFT constant be replaced with PAGE_SECTORS_SHIFT defined in linux/blt_types.h, which is included by linux/blkdev.h. This produces no functional changes. Signed-off-by: Luis Chamberlain --- drivers/md/dm-integrity.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c index 31838b13ea54..a179265970dd 100644 --- a/drivers/md/dm-integrity.c +++ b/drivers/md/dm-integrity.c @@ -752,7 +752,7 @@ static void page_list_location(struct dm_integrity_c *ic, unsigned int section, sector = section * ic->journal_section_sectors + offset; - *pl_index = sector >> (PAGE_SHIFT - SECTOR_SHIFT); + *pl_index = sector >> (PAGE_SECTORS_SHIFT); *pl_offset = (sector << SECTOR_SHIFT) & (PAGE_SIZE - 1); } @@ -1077,7 +1077,7 @@ static void rw_journal_sectors(struct dm_integrity_c *ic, blk_opf_t opf, return; } - pl_index = sector >> (PAGE_SHIFT - SECTOR_SHIFT); + pl_index = sector >> (PAGE_SECTORS_SHIFT); pl_offset = (sector << SECTOR_SHIFT) & (PAGE_SIZE - 1); io_req.bi_opf = opf; @@ -1201,7 +1201,7 @@ static void copy_from_journal(struct dm_integrity_c *ic, unsigned int section, u sector = section * ic->journal_section_sectors + JOURNAL_BLOCK_SECTORS + offset; - pl_index = sector >> (PAGE_SHIFT - SECTOR_SHIFT); + pl_index = sector >> (PAGE_SECTORS_SHIFT); pl_offset = (sector << SECTOR_SHIFT) & (PAGE_SIZE - 1); io_req.bi_opf = REQ_OP_WRITE; @@ -3765,7 +3765,7 @@ static int create_journal(struct dm_integrity_c *ic, char **error) ic->commit_ids[3] = cpu_to_le64(0x4444444444444444ULL); journal_pages = roundup((__u64)ic->journal_sections * ic->journal_section_sectors, - PAGE_SIZE >> SECTOR_SHIFT) >> (PAGE_SHIFT - SECTOR_SHIFT); + PAGE_SIZE >> SECTOR_SHIFT) >> (PAGE_SECTORS_SHIFT); journal_desc_size = journal_pages * sizeof(struct page_list); if (journal_pages >= totalram_pages() - totalhigh_pages() || journal_desc_size > ULONG_MAX) { *error = "Journal doesn't fit into memory"; @@ -4542,7 +4542,7 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned int argc, char **argv spin_lock_init(&bbs->bio_queue_lock); sector = i * (BITMAP_BLOCK_SIZE >> SECTOR_SHIFT); - pl_index = sector >> (PAGE_SHIFT - SECTOR_SHIFT); + pl_index = sector >> (PAGE_SECTORS_SHIFT); pl_offset = (sector << SECTOR_SHIFT) & (PAGE_SIZE - 1); bbs->bitmap = lowmem_page_address(ic->journal[pl_index].page) + pl_offset;