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; From patchwork Fri Apr 21 19:58:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13220636 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 07E7DC77B7F for ; Fri, 21 Apr 2023 19:58:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1E5BF6B0080; Fri, 21 Apr 2023 15:58:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F34656B007E; Fri, 21 Apr 2023 15:58:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A9E9B6B007B; Fri, 21 Apr 2023 15:58:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 4E3226B0078 for ; Fri, 21 Apr 2023 15:58:22 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 13F761A02AF for ; Fri, 21 Apr 2023 19:58:22 +0000 (UTC) X-FDA: 80706460044.19.12831E6 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf17.hostedemail.com (Postfix) with ESMTP id 71F5140018 for ; Fri, 21 Apr 2023 19:58:19 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=ngzYAuBK; spf=none (imf17.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=YNaeywPG0hf9vLC0oGzgXUzMq14M1rf2z1Pu3jCjc18=; b=IV3KQcncddbehHwfXezs5WFEeM5Ac48AQTK2ro07LlOH/RqLP9/XsJUrzsZBJ57EB2JSvW FprWmj4JqvUSWJpNduhfcWIHAMNeLgBFQ0bV6wByqxVF9rtqnoc++FJIn2a4ArJGnSBJ1V kc4+6xEQvjGfD0PJXJplE7j8SryEsxM= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=ngzYAuBK; spf=none (imf17.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=1g8CnJJrZs9wj1qyjp+oO6/gN5malpJi9bfmkcWPFFs6UKqBsH134TyLsZIvgSbPJg4JCI 16JiuzLRrHDarQ3/zF2vKM1PRPRWvYciY5NvzGNGOMZ+KQSVkO8vJKKJn2aXZi85tkV4ZR cl6Y8q94HoPJ0MCepsLWqWjfLDp1Gfg= 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=YNaeywPG0hf9vLC0oGzgXUzMq14M1rf2z1Pu3jCjc18=; b=ngzYAuBKDLAoLCg9a3fSYyxaF7 Psmp6RNidLp/Hoz9Sz3Yaw4hJW6ICtW0d4gYHRtDbEVmUURusmziBCiUS8bTLXRjIGpepiBVYvy4V AwpjQ3WoHeBlc3DLTnq8Mlk6ISbisM8Dq/dyJwP58qth31M8tqk7cOBV5m4mcx0Eb3/Yq37hx40Q1 sTKkHJsz0qslYzsxgNwgcjkPJnjnr4qcRujKf1sQeDcoSvwEN+/9SSuTrxHTTWDLBYGm0TSLjdm/O l/CPxIM1wE772UFBPe1DRj82PuNz0beeob2viWswsRu9DrjB2lpvHI+yRXpn9Gc4ldGRFkXpKwslh E2nlol0A==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1ppwtU-00BlaZ-1j; 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 2/5] drbd: use PAGE_SECTORS_SHIFT and PAGE_SECTORS Date: Fri, 21 Apr 2023 12:58:04 -0700 Message-Id: <20230421195807.2804512-3-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-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: zrpmon5k9kp67qpp1ngtx3tmsndb9imi X-Rspamd-Queue-Id: 71F5140018 X-HE-Tag: 1682107099-776099 X-HE-Meta: U2FsdGVkX1+ChppXusbDgE37l16U9BQeTBzlE8UnDyVtPlr23qQ2HZo3ewryZe0Gnu7ft/K2kDts0GJxXx4XbsXue8Km63J+gZDgMTr7cTlRbwCyL913DzoKfHaqUmlHK9SDGAsymE5HmV1fpJPRjS0vUDK+H34Ny4vKWDKxym7D/IaApl9tK7LJBBAJ/acHWPdlHvcmkghlM1lFU4I7XaOtbEFz3J6JfVCuSxbOke9yUoPSM0sY4Mc45fVERho8E4PMjgX/YHmPPyGKPP5QLeW9BEvil/9RirHTu0pIQX7sNvSEDHudstkxh6En1uK18/3kE+GQ+5bpUmmxB9HyKFCLzdRM6Fk4+QvyeenuWhv3OvL4Rw2MUVRNe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spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Replace common constants with generic versions. This produces no functional changes. Signed-off-by: Luis Chamberlain Acked-by: Christoph Böhmwalder --- drivers/block/drbd/drbd_bitmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c index 6ac8c54b44c7..b556e6634f13 100644 --- a/drivers/block/drbd/drbd_bitmap.c +++ b/drivers/block/drbd/drbd_bitmap.c @@ -1000,7 +1000,7 @@ static void bm_page_io_async(struct drbd_bm_aio_ctx *ctx, int page_nr) __must_ho unsigned int len; first_bm_sect = device->ldev->md.md_offset + device->ldev->md.bm_offset; - on_disk_sector = first_bm_sect + (((sector_t)page_nr) << (PAGE_SHIFT-SECTOR_SHIFT)); + on_disk_sector = first_bm_sect + (((sector_t)page_nr) << PAGE_SECTORS_SHIFT); /* this might happen with very small * flexible external meta data device, @@ -1008,7 +1008,7 @@ static void bm_page_io_async(struct drbd_bm_aio_ctx *ctx, int page_nr) __must_ho last_bm_sect = drbd_md_last_bitmap_sector(device->ldev); if (first_bm_sect <= on_disk_sector && last_bm_sect >= on_disk_sector) { sector_t len_sect = last_bm_sect - on_disk_sector + 1; - if (len_sect < PAGE_SIZE/SECTOR_SIZE) + if (len_sect < PAGE_SECTORS) len = (unsigned int)len_sect*SECTOR_SIZE; else len = PAGE_SIZE; From patchwork Fri Apr 21 19:58:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13220633 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 35EA5C77B7F for ; Fri, 21 Apr 2023 19:58:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AAC1D6B0078; Fri, 21 Apr 2023 15:58:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 982216B0072; Fri, 21 Apr 2023 15:58:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7AD236B007D; Fri, 21 Apr 2023 15:58:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 5A6BF6B007B for ; Fri, 21 Apr 2023 15:58:22 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1CD57140925 for ; Fri, 21 Apr 2023 19:58:22 +0000 (UTC) X-FDA: 80706460044.21.2D00977 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf12.hostedemail.com (Postfix) with ESMTP id 116ED40007 for ; Fri, 21 Apr 2023 19:58:18 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=PPDW9v79; spf=none (imf12.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=hmvMFrifaP2CWzwzaleGenI7Qmq7A3BDCDXiJa7DZeY=; b=CDnf15TpHfGQYn8163kuWNg/ps93qwJWT/V/9OUQFt6h744rG6b+Mb83+LfhKxz6gluNqZ q/+Obd/51ebP13r5FAIcPikSAcGKdOt3Sc4j3IOVIXbcrQ2gNblQA6Bh3IV97ZV9DHhHG3 J1h43e9mISfcbx/uxF6hvxPaOLbdNTc= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=PPDW9v79; spf=none (imf12.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=RgmA5SNxnAzv3vgfA+nA51tgZuLWWlZKEiapQ5u+rRMIg4tgYOD8P2D4ghcTD9tLJ7cRjO JedMAy5kCU4CHR+GPPEWMomlJc2BalDvgmA2czlHFNcOiJRWy3NVqnhijyQS0k+r8fhFCv oJavFC0CW7FoC3Oa+Apn/zEwMIKUWt0= 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=hmvMFrifaP2CWzwzaleGenI7Qmq7A3BDCDXiJa7DZeY=; b=PPDW9v79Yn0Yj4ggnf7g8Mg9q5 Xtl7diAuW97jY5PnrakPeKx7uEQritarSJ5Gy6GeiZKStBUOWkuqgoi2ruOuqQt8wRD8LH5r3jzFM 1TqV+37Fs6Y24l1+JsPwzN5IYGgcCOdgYYejZpB1GtTwrlpp6Nu0hWrIsmytKQxPVb4kEobOD2hL6 /l0IFzM7poLdy5jK5pZZWVKxfurtC0xwjMBvNGWDaEWzFOWcTBB/p7F+L2GKWhtaoYF96Qj3AALTI Oi6Otl6ldN6hH+qNoTIBLDC/qTCgXrQtH5ZgqPsm0RrQZj6/zPyrIWxvLeyNztXQS0FsjDsYZzZsT E44jXZfw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1ppwtU-00Blab-1s; 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 3/5] iomap: simplify iomap_init() with PAGE_SECTORS Date: Fri, 21 Apr 2023 12:58:05 -0700 Message-Id: <20230421195807.2804512-4-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-Stat-Signature: on4dbsh1cyjpeou698hcemcj3zoprk55 X-Rspam-User: X-Rspamd-Queue-Id: 116ED40007 X-Rspamd-Server: rspam06 X-HE-Tag: 1682107098-114156 X-HE-Meta: U2FsdGVkX18c69Mv+IMpOZF7RWlrT7nmpIWOmRWtLUSy9oxhzHHnvmyYeffDm7nIwHk6LVQNfdCluHWbZSKcEL0r0OGgFl9GxjKAJG6NBEn/g6QM7KbBifjRkjFU+J/JkRHpBHUoS/eGhVWTMlPg88XKxQXLOnZW4eZoz5MJNzeXNIgW8Esw00SwoVIKK5pY2zdZl95Y9xrAXGZxRfnGehTNnfJsNMF1fnNreoCNF0IVixv03NepswJPKAOMhEruRRGw1J0NYlFhowIkVdIeGqx73WdFSu7yytg4cI+xdeGo3p/MCqzgy+k2xAyWgm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U23BcOcR8XiW2OryDOkwXR3rzX+Er35+As87jKiRmMsubAD3b 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: Just use the PAGE_SECTORS generic define. This produces no functional changes. While at it use left shift to simplify this even further. Signed-off-by: Luis Chamberlain --- fs/iomap/buffered-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 063133ec77f4..ba2824f405df 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1819,7 +1819,7 @@ EXPORT_SYMBOL_GPL(iomap_writepages); static int __init iomap_init(void) { - return bioset_init(&iomap_ioend_bioset, 4 * (PAGE_SIZE / SECTOR_SIZE), + return bioset_init(&iomap_ioend_bioset, PAGE_SECTORS << 2, offsetof(struct iomap_ioend, io_inline_bio), BIOSET_NEED_BVECS); } From patchwork Fri Apr 21 19:58:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13220634 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 DF490C77B78 for ; Fri, 21 Apr 2023 19:58:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C90E36B0074; Fri, 21 Apr 2023 15:58:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BCC196B007B; Fri, 21 Apr 2023 15:58:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E5906B0075; Fri, 21 Apr 2023 15:58:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 776486B0074 for ; Fri, 21 Apr 2023 15:58:21 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 4CCBA120679 for ; Fri, 21 Apr 2023 19:58:21 +0000 (UTC) X-FDA: 80706460002.26.9F2EA1A Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf10.hostedemail.com (Postfix) with ESMTP id A8E51C001C for ; Fri, 21 Apr 2023 19:58:19 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=M3lCN4A3; spf=none (imf10.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=rOZRHuibMtt5KERv5AEsnq/lMb+u0m8NO1I1gwGHC/2Kw45ijdQYAUUr5N6ZBUNs3bTl8/ 1JAdtc8Fz9n/qbhCTfXhBiI1E7qZdw0mlEI2tu66BkH08WPbyxMRUCX8NjK8Pmf4qerTKU bm2c5wgaxv9tuphFua3DpVdN2UUwK28= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=M3lCN4A3; spf=none (imf10.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=E+NZJmg2wGtl9UTyedalDySM8eWxNnKVjwcpkkZSi1c=; b=XR4B9EUB2nYyi75Jo8l+9jxLeMoFDpwFbwt6Q46aUbpfuWR+kZ3D5l6G0JK1qFJnRa2WD3 yNq57Prj3n7jAimj53lgtqig3ETOKCR6dnslPqkk6Q1qfzTox81L9+b3A8FgRLvAGWSv32 9PpzXNx19BZ6gqTdui3lNDxFA/ihD6w= 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=E+NZJmg2wGtl9UTyedalDySM8eWxNnKVjwcpkkZSi1c=; b=M3lCN4A3ri6P3e3ql42mx4susg ysa14KlGQHDbxNKzxNvsD94HuAELu2p+zrjKlfbdBVsg5FEEQlOH97ONbcWpYtpat3BgqnGrCJ4eZ 7+JQDAfqvEamJvGO7RL0gSWM3Ly2D8INxLWliXrW9XPqtUhtBLOeZtABHPaHsMO6qxBZa79RVQWNR zNd/7tjUHFnBVj6gorqgr2cHySz2Quouq7qe9bY5mLcEOQdPtCOhWKHBAQK/WIhsI0c9ybOjJrP/c Rc2dRw8rPaDAZsO66xngjm08/KUreyeoN8QeYOiqGG8RnmDzeoTnC67Bs2LXR6rXWcYvCGGgJrPlz pqV0K7oQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1ppwtU-00Blad-21; 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 4/5] dm bufio: simplify by using PAGE_SECTORS_SHIFT Date: Fri, 21 Apr 2023 12:58:06 -0700 Message-Id: <20230421195807.2804512-5-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-Rspam-User: X-Rspamd-Queue-Id: A8E51C001C X-Rspamd-Server: rspam01 X-Stat-Signature: wajsq5ronbu7k83gpgehryp9ohhynkua X-HE-Tag: 1682107099-458855 X-HE-Meta: U2FsdGVkX1+PMdyFWLM+68rT6p3YP0TbwqRR9LViTKjGClysckO7+/RVjxQfw9cVR7nITPRpv1PFbUyeQCeCzdoO1RGcCSpDtsWzX6/P46Nb8pIqyVf6t0OZ92dpCTKBl30IBsT3sLsWuqJQqII28ZgfLReDXjucykcPeSj85AVQ4wIOB9bSKE4qy7xuFaSk0NaE19twn3d/e6GgiVYM7ZHinvQtpWf37lnye4yqhKPTQPJDElBawdtiYBIoZk30wGg5k7nWc2wEc/ADlORI0XFznS7IJsI7fYC82j/FQjtrG03x9YkNU7tl3DcmEC4TmRTyzvxQeJSfGl1+wCeshRaqOg+kh2C/oI8d9ggHUxJpkWsxHo3FbGJVzSwRMk1F3a+2C0W8c2O/Jrg8f8PLdm+j2C+mZO7xspZAMfRmuZHfIzR9QBZcEvQXjQ828O674R+crI2uJjCV4pw/P1wiKiAq00BIjzf04S+T5sH3vq5zgZtaWbK1OGywWQfeqfHcWjz6A4o7e+hocFhc8k4BqYUhrQTfS3kaEoo0GtZFku13SeG6XYlCRzMjCPAi2Zz5g9GM9NLUhNdUA8yZ9xwsp1Pjxi9gqj7AzPdpIo1OfhG7WYKEyDGqjQprWOTtMedcZyN1wDWifDeNX/BiF3jx3NmJSO44g9nQq6O+ukvADmSE9bkGBSFICamrwOHHj3D176nHeik1UAS0B5RzHxVnQQYIpsDWpTgf7GmePI68lEXI3EVjJ8yNjmOqHAM0nQR0rhzX4yEbOyrJB+S/pTxZ9peX0Q/kKYBb59JMYcgEyZYdEftVx4mJJlBreH11rVw3D9HO8GSjiNcw2GSaYNA2Nx6+r8iWsXGb8WPrzdHvhEQVONNHLcKxkOti1FnXo7CiUlRi68d56WlXkQ6C21uWBWMBknA8uMlkxPSBz4/pc0jGwgwm1oVVayaDe6lXRG1Hifdk/ll7PuocWcKqNOP PLY9lM2r MYoEQVzCktgxfuHN1Ru/YqR1E0vtHj9eB1r/2XztZWHjxHefzOEXZqBpo/kn8+3IAiWIh3A8LrHfPCVoq0iQeIFOoZB64J+cuzCw240f+XxloobxbvIWtuVve+SMkVc5j2tFriA3Nf4YrczURr5bZyRN6flydqQIH5lvfWijrfd036INUQ1vgcYakGlPtV3p+mK5UZ1YyDzT5cVpz4cBiYCUsL8FBbTWWExJCTGiGIW0e8sYxEvzqs1RNpKIqwFRk18RCgdRLwmQ7QqZmSUc/aMQzXtl0rg5EFCIUXDLnrkXS9DqbUnxxsMO1SCkc25JMnFsXSMMGjKdr+2A57M6zWbba7pkvl3efk+Yl19PNSeTVa0a2mhlvWvbpKkLSWQaRqD5mmyNGdnXgDHzzYuj7UNRfr/dlong6P2ZL4qr/D7yvMDEayUKr9nxgxK470gCAN3t2 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-bufio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index eea977662e81..08c4730e1819 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c @@ -1152,7 +1152,7 @@ static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask, gfp_mask & __GFP_NORETRY) { *data_mode = DATA_MODE_GET_FREE_PAGES; return (void *)__get_free_pages(gfp_mask, - c->sectors_per_block_bits - (PAGE_SHIFT - SECTOR_SHIFT)); + c->sectors_per_block_bits - (PAGE_SECTORS_SHIFT)); } *data_mode = DATA_MODE_VMALLOC; @@ -1190,7 +1190,7 @@ static void free_buffer_data(struct dm_bufio_client *c, case DATA_MODE_GET_FREE_PAGES: free_pages((unsigned long)data, - c->sectors_per_block_bits - (PAGE_SHIFT - SECTOR_SHIFT)); + c->sectors_per_block_bits - (PAGE_SECTORS_SHIFT)); break; case DATA_MODE_VMALLOC: From patchwork Fri Apr 21 19:58:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13220635 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 9A3E3C7618E for ; Fri, 21 Apr 2023 19:58:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D5FA86B007D; Fri, 21 Apr 2023 15:58:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C907C6B0075; Fri, 21 Apr 2023 15:58:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 90DBB6B007E; Fri, 21 Apr 2023 15:58:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 423116B0075 for ; Fri, 21 Apr 2023 15:58:22 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 29747160680 for ; Fri, 21 Apr 2023 19:58:22 +0000 (UTC) X-FDA: 80706460044.22.5B4B36A Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf11.hostedemail.com (Postfix) with ESMTP id 7F1C94001B for ; Fri, 21 Apr 2023 19:58:19 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=DzgJIkzU; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=none (imf11.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org 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=74KqhpMHp5ljBuyIWW+6b9AuPyxaDpBnVwotQeAK7X8=; b=ii1Gpb5x+QGBh+8bqs8vHMNjD+GxPRALa6fIkt0TS1KDDjpjbjitUwxLcNi5cvaiPwPzMS sauzyXsedm2af3eGJ91J+Q87CmnRMnUHo0pfspX84mfK0bRKmEU6yN9fWVPRtrCUhDI1PF zP7hrNe0q2qZw/WQhFfJ79L/SlvHNEY= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=DzgJIkzU; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=none (imf11.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682107099; a=rsa-sha256; cv=none; b=yO5ijxgmtNxgw2BSv1VhUYLWrprIKvFLnMqvXjruT8z70CDNEFRsKFSVYbkJOSRYB2qyDh 0VQetqb/KYpYlfC4cek88AUJdNy9vkszlpy0mwS8584PrQ0hFuVcUV7+9ZnmTIjg95nBp7 lXyq1gurJ4RwZeYXjJqiz2BfMHgoVEI= 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=74KqhpMHp5ljBuyIWW+6b9AuPyxaDpBnVwotQeAK7X8=; b=DzgJIkzUgKZlS2lZbWSyNPJKAX fJ02zvtu2wcM2DrLnEL1z7nGFJhWQvwx0ZwBONfF2vKqh9gW2iMSwkRFRy6mbGiWHd/jSQ2su2LMY Vg1njHfWWwn48um+f7MBerBHqbIfnt/XRDZ3iutZDQy8hUwy8N6Yh3vKPnhAmFE3nYJoRwN79EvZv tdJt0bXHBK0ddw7cry5Xwc3+fl7vlOOZWg4mFRKw3odez/kARFEZf3yQSfwQCVqea4Y8Q7KXQrNON m0DQiRTZm1Zq/OK4LTgJgai/TEYyHmUWvunLdAzqFTvAbW2mmA8qG/Di14CugGU7PsPFRhpLOzysJ 0Eq2Rsmw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1ppwtU-00Blaf-2A; 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 5/5] zram: use generic PAGE_SECTORS and PAGE_SECTORS_SHIFT Date: Fri, 21 Apr 2023 12:58:07 -0700 Message-Id: <20230421195807.2804512-6-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-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 7F1C94001B X-Stat-Signature: 51h43mfss4bcd8753cepw9yox9a3uoqc X-HE-Tag: 1682107099-679301 X-HE-Meta: U2FsdGVkX180hcf5E20zioIfIygexumQF1IBGu+MBWgti+kM2xBEbuSxm09V1XsvXp0HG1oe6gbRQRLpE3/uMyLXEKwUkBu+dVm2TvGyfMzpoMaeMbcythzf4F0NXWB/6Gpcn19az8Gbd1VpjooEZq7/JQ2QKPVjkDy+H+rBJgJm8I3r+HYlUo8C6gT3Hs7RAWpEb76IpUpLNkIg+S1xaH/G1vavR75fyziw6WimichauBRShXu+kTOB8w3/azo91I3zQ4RMO63zA/y+go9tjWCdKoyxbk2+rmNytlfa7fly2bztsMRHYLfwSJGrZnpgeFkD7eHRY4KCV3V7kcKxBEexpM6Q/XnfFnS0vpO/BUPCkmUiPO0SUZjxESnBsjYufmS9lKpRIU3SHysfsM22qeon3sX0y92mPHLIjdGWeTn2BBVQc9/nlSIY0FveL9mBoaJaBH3y0JOE0oB+7jSp/596HBPS7tju3XlrdVNISG7gdstnGcScCQstZNzclEvmzLlzhQfGZqZf+FdvQIJ8x5riaRfov5rXkdVqWUMfzKiTdW9g70aHagPyCretXX0XXwMHpl6mE73Q2NLuCXlZGRiGFcoAmU48C9F0iFKFJ52vNw4FQdIgdehSEW/+CnASIPeWybc9GbcQ7DFfurfdxgodQiLNve2i42iGtlD9+zZmc4k2q2AwtGc/lvU6a9F5U3/+5Y56oL60/2GKVIhAmVpLD2rPTCxNjjchi+XVJpf1tfc5tZcCTCxsTZBnyrpJQEKWEzWIj8fS2nvgLZaraMx+lBlmt55UEX5GdD4C2WdwZmfdP0jx53aLYxxDQ45c4F5dIqVqlPcPeMPXu2RPlDiKvCnO7hLpWUiRjvezTHvE1lckUR3b//ALUo9n/G5riUt7U6ChJyk2RHEpwTDtgxbSYfj034WH6l6JOWxme7K11hDAyiQQd2XYs+diui+uGLeYdGasMaVF6L1dAx2 XtGUy2hA alycsn7O4+RcfZ+gwZrWgL7+nxirtQQtikN9bXwN+TbnERb2p/Q9oFhUcTMxQRv3QHdamXGszcV361btdhn2OMS99MgBGx33yLr/lqoZ0VbOyavMypvKeVa1D1pioJkPoffaR00o8IRXnFm4akgF6NdiwOoWOjNTTpJJMygM/Bbk2v0hsOhTFkJ5nb2xVXb2syY4baTrI48Q0Wgf0qPgy/zW0HSj3qcppjkFLPiQ0y19nQOhmzz/CDHzZJeqnp//WuQj8SHhyTM8QzzO/9CzepjxfuL3sKan9gZtTfHEDyyZvg1L/c9xO0Gh7oPE6ZcmSHZ24PAn1IlIe4CAUxFo95mSHbo9UU2kVYXO8/qsEyQyvBagwK4DF1aGrZAlAcQcZ2lJUq0RaYe5kzyjwSEZKl0R7YRhv5rNE1lld5xJN92W/Mxzhi962Wjy1ydgSvcfWslKg 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: Instead of re-defining the already existing constants use the provided ones: So replace: o SECTORS_PER_PAGE_SHIFT with PAGE_SECTORS_SHIFT o SECTORS_PER_PAGE with PAGE_SECTORS This produces no functional changes. Signed-off-by: Luis Chamberlain Reviewed-by: Sergey Senozhatsky --- drivers/block/zram/zram_drv.c | 12 ++++++------ drivers/block/zram/zram_drv.h | 2 -- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index a84c4268257a..11c9b5a9ac7a 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1834,8 +1834,8 @@ static ssize_t recompress_store(struct device *dev, static void zram_bio_discard(struct zram *zram, struct bio *bio) { size_t n = bio->bi_iter.bi_size; - u32 index = bio->bi_iter.bi_sector >> SECTORS_PER_PAGE_SHIFT; - u32 offset = (bio->bi_iter.bi_sector & (SECTORS_PER_PAGE - 1)) << + u32 index = bio->bi_iter.bi_sector >> PAGE_SECTORS_SHIFT; + u32 offset = (bio->bi_iter.bi_sector & (PAGE_SECTORS - 1)) << SECTOR_SHIFT; /* @@ -1876,8 +1876,8 @@ static void zram_bio_read(struct zram *zram, struct bio *bio) start_time = bio_start_io_acct(bio); bio_for_each_segment(bv, bio, iter) { - u32 index = iter.bi_sector >> SECTORS_PER_PAGE_SHIFT; - u32 offset = (iter.bi_sector & (SECTORS_PER_PAGE - 1)) << + u32 index = iter.bi_sector >> PAGE_SECTORS_SHIFT; + u32 offset = (iter.bi_sector & (PAGE_SECTORS - 1)) << SECTOR_SHIFT; if (zram_bvec_read(zram, &bv, index, offset, bio) < 0) { @@ -1903,8 +1903,8 @@ static void zram_bio_write(struct zram *zram, struct bio *bio) start_time = bio_start_io_acct(bio); bio_for_each_segment(bv, bio, iter) { - u32 index = iter.bi_sector >> SECTORS_PER_PAGE_SHIFT; - u32 offset = (iter.bi_sector & (SECTORS_PER_PAGE - 1)) << + u32 index = iter.bi_sector >> PAGE_SECTORS_SHIFT; + u32 offset = (iter.bi_sector & (PAGE_SECTORS - 1)) << SECTOR_SHIFT; if (zram_bvec_write(zram, &bv, index, offset, bio) < 0) { diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h index ca7a15bd4845..9f2543af5c76 100644 --- a/drivers/block/zram/zram_drv.h +++ b/drivers/block/zram/zram_drv.h @@ -21,8 +21,6 @@ #include "zcomp.h" -#define SECTORS_PER_PAGE_SHIFT (PAGE_SHIFT - SECTOR_SHIFT) -#define SECTORS_PER_PAGE (1 << SECTORS_PER_PAGE_SHIFT) #define ZRAM_LOGICAL_BLOCK_SHIFT 12 #define ZRAM_LOGICAL_BLOCK_SIZE (1 << ZRAM_LOGICAL_BLOCK_SHIFT) #define ZRAM_SECTOR_PER_LOGICAL_BLOCK \