From patchwork Fri May 26 07:33:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13256531 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 EC065C7EE37 for ; Fri, 26 May 2023 07:33:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242442AbjEZHdr (ORCPT ); Fri, 26 May 2023 03:33:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242427AbjEZHdo (ORCPT ); Fri, 26 May 2023 03:33:44 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4BDD114; Fri, 26 May 2023 00:33:43 -0700 (PDT) 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=mp0R5kJjV9ATA7f3wCKoUGxZA6HQSlfyegxBHwX5Bjk=; b=JFyweRH3uI2LUIKa6CevDLZKGx TKIgB0Y1EjmjhgQtYqrSPkMNG5keYraDpb6BQnGzIKLhMTVo0oblR4jwgMIB6HIdUXSpGXq28Xvyh mtYzmXcLkLNuZP2TpCA4lzDp1RA2SxN0/ENDC+tnH0vBOiJFjpSdfkBUaUztNotfiYNvg1cz1G7/1 zF7NHp330UXzfhSxJuQ3/eJkFTHFymVoG8RVBzcYY3SMWY45Ut2V3AZToDDkiy4FZEh+w6+Ma+nuF OtmnMOJt2rZqs5q6W/LuP6PHm5KmPG18Oz3Qh8+WAau3MwsT+44Wt7PDwRVd38S7pB26tTKLzCQ3m oxCy1d7A==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1q2RxA-001RdR-3D; Fri, 26 May 2023 07:33:37 +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, rohan.puri@samsung.com, rpuri.linux@gmail.com, kbusch@kernel.org, mcgrof@kernel.org Subject: [PATCH v2 1/5] block: annotate bdev_disk_changed() deprecation with a symbol namespace Date: Fri, 26 May 2023 00:33:32 -0700 Message-Id: <20230526073336.344543-2-mcgrof@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230526073336.344543-1-mcgrof@kernel.org> References: <20230526073336.344543-1-mcgrof@kernel.org> MIME-Version: 1.0 Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This ensures no other users pop up by mistake easily and provides us a with an easy vehicle to do the same with other routines should we need it later. Signed-off-by: Luis Chamberlain --- block/partitions/core.c | 6 +----- drivers/block/loop.c | 2 ++ drivers/s390/block/dasd_genhd.c | 2 ++ 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/block/partitions/core.c b/block/partitions/core.c index 49e0496ff23c..6f18444be4fe 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -690,11 +690,7 @@ int bdev_disk_changed(struct gendisk *disk, bool invalidate) return ret; } -/* - * Only exported for loop and dasd for historic reasons. Don't use in new - * code! - */ -EXPORT_SYMBOL_GPL(bdev_disk_changed); +EXPORT_SYMBOL_NS_GPL(bdev_disk_changed, BLOCK_DEPRECATED); void *read_part_sector(struct parsed_partitions *state, sector_t n, Sector *p) { diff --git a/drivers/block/loop.c b/drivers/block/loop.c index bc31bb7072a2..50aa5b4c0c56 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -37,6 +37,8 @@ #include #include +MODULE_IMPORT_NS(BLOCK_DEPRECATED); + /* Possible states of device */ enum { Lo_unbound, diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c index 998a961e1704..5ea244aec534 100644 --- a/drivers/s390/block/dasd_genhd.c +++ b/drivers/s390/block/dasd_genhd.c @@ -25,6 +25,8 @@ #include "dasd_int.h" +MODULE_IMPORT_NS(BLOCK_DEPRECATED); + static unsigned int queue_depth = 32; static unsigned int nr_hw_queues = 4; From patchwork Fri May 26 07:33:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13256532 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 1C579C7EE39 for ; Fri, 26 May 2023 07:33:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242453AbjEZHdt (ORCPT ); Fri, 26 May 2023 03:33:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242422AbjEZHdo (ORCPT ); Fri, 26 May 2023 03:33:44 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B275CB6; Fri, 26 May 2023 00:33:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description; bh=RQzHrIRCFqHArqIrnKCyvyHklB4zdcXT4MP2qOnLDko=; b=xIU9TLdnNYizB06PmvtzYlTdR5 HlTQdpKGeyyWACTTR95smi75XqDqgG9cDCVGjAOdZdR3m8BPT3TY8BNggYNMWsvJTYAI3fPk8ZdnX +BPgRSFHUYMlBkhvzll8T3HI/Xl9csNmtX8QKMKtP/iRaIPqnstKYFRv4S7XfWPyCylLC1KlvR72z xZm4OyGRiK0FlBL7bEZCD6oegED5VqaXt1eqNzYb6Rc3bdAejGjBTYfmdB5Mdvz6UDPn/5p642Nn9 5WC3HcP4OrbSccmqITnp/WDQKvQYcQr/4mAHruC7ragwNbVz4FX6+BYEFG0dF9uA91YTcz/4vzB+7 v43VXK/A==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1q2RxB-001RdT-0G; Fri, 26 May 2023 07:33:37 +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, rohan.puri@samsung.com, rpuri.linux@gmail.com, kbusch@kernel.org, mcgrof@kernel.org Subject: [PATCH v2 2/5] drbd: use PAGE_SECTORS_SHIFT and PAGE_SECTORS Date: Fri, 26 May 2023 00:33:33 -0700 Message-Id: <20230526073336.344543-3-mcgrof@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230526073336.344543-1-mcgrof@kernel.org> References: <20230526073336.344543-1-mcgrof@kernel.org> MIME-Version: 1.0 Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Replace common constants with generic versions. This produces no functional changes. Acked-by: Christoph Böhmwalder Signed-off-by: Luis Chamberlain Reviewed-by: Johannes Thumshirn --- 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 May 26 07:33:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13256529 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 CF20EC77B7A for ; Fri, 26 May 2023 07:33:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242411AbjEZHdn (ORCPT ); Fri, 26 May 2023 03:33:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236891AbjEZHdn (ORCPT ); Fri, 26 May 2023 03:33:43 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B8B8114; Fri, 26 May 2023 00:33:42 -0700 (PDT) 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=FJ06IRMbDJJrXOTKvODn3h7mdJ3kw+A63u/ZaBgMzfY=; b=TvnkXj/I5pCGoRzwSTLwGngHMk E/yOSJcwi8/rld1LFK0la1ONOTYE8kgf0sYeSy7EeAw2M9xM5dchixMhcAFI/dyqAGMeMxn0UGWi1 Z/L2v0EUnETlmhx6yMZ2Pkv6KIyQ8DKIRJ9Z3+q5vWbT43/UJgv8w1w9fmLU9F4PjN8odpQtJNiIB V0/+D3Bej6fJHhwfmMBkg/16PEO3VhSIPA07vAmIXi2OuTn4BsoPVzH5VuDjE1wyPEPK76ic2KxwQ ifNUkHYRpWB9KO5IxFO4z82u0HHr7NQ518//dHvsxFWjq0yZXCx7CPAKr73uGMcywgLPIN9gHZEHu NBTI3fcw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1q2RxB-001RdW-0P; Fri, 26 May 2023 07:33:37 +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, rohan.puri@samsung.com, rpuri.linux@gmail.com, kbusch@kernel.org, mcgrof@kernel.org Subject: [PATCH v2 3/5] iomap: simplify iomap_init() with PAGE_SECTORS Date: Fri, 26 May 2023 00:33:34 -0700 Message-Id: <20230526073336.344543-4-mcgrof@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230526073336.344543-1-mcgrof@kernel.org> References: <20230526073336.344543-1-mcgrof@kernel.org> MIME-Version: 1.0 Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Replace common constants with generic versions. This produces no functional changes. Signed-off-by: Luis Chamberlain Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn --- 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 915b448b8554..5641e696fb3f 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1831,7 +1831,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, 4 * PAGE_SECTORS, offsetof(struct iomap_ioend, io_inline_bio), BIOSET_NEED_BVECS); } From patchwork Fri May 26 07:33:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13256530 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 84FDBC77B7A for ; Fri, 26 May 2023 07:33:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242424AbjEZHdo (ORCPT ); Fri, 26 May 2023 03:33:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242409AbjEZHdn (ORCPT ); Fri, 26 May 2023 03:33:43 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EDE3116; Fri, 26 May 2023 00:33:42 -0700 (PDT) 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=k7xswGivErozFTM0k3Rp4cWzQN Dude5lKSUZQHlx044tzpe9pekiIonmIyRsCOSAE/ne2v3XWULeyuNagveDJKhCzwzIwpSet/GGPTJ 8L/umLYOEmo939tVe8b1LzFSz79yTjVEuVIgi+ODI0gNHPJzRXAzmGEU0uy4w/FXD8FDw1HodRkaX btZ7Pstk2ZQrBoYKCxDF4cnrUuEu7/zPG5VMnZ4MmRE8wjWzPVYHyD4I14U/h9QOMlW+outkkAGYH SVGlcZvTv6O1xgbkdMhgnkGWCImDJG2q5kh2QMmZXxgVfAIEwdNjbjI5gtlCTmuU6FJUWDjjt1SoK m8YH8JIg==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1q2RxB-001RdY-0Z; Fri, 26 May 2023 07:33:37 +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, rohan.puri@samsung.com, rpuri.linux@gmail.com, kbusch@kernel.org, mcgrof@kernel.org Subject: [PATCH v2 4/5] dm bufio: simplify by using PAGE_SECTORS_SHIFT Date: Fri, 26 May 2023 00:33:35 -0700 Message-Id: <20230526073336.344543-5-mcgrof@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230526073336.344543-1-mcgrof@kernel.org> References: <20230526073336.344543-1-mcgrof@kernel.org> MIME-Version: 1.0 Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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 May 26 07:33:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13256534 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 3664DC77B7A for ; Fri, 26 May 2023 07:33:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242469AbjEZHd5 (ORCPT ); Fri, 26 May 2023 03:33:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242431AbjEZHdp (ORCPT ); Fri, 26 May 2023 03:33:45 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F065412A; Fri, 26 May 2023 00:33:43 -0700 (PDT) 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=l8SXSO/lmiFeJihMCTRRFm0o8Ak15fMAUhw4BXdB6WA=; b=A0xPKQUoDsDrFgURMQlgZXIoK4 lF0smhhvDr9DIwh3hI5+Foy4jSB44qqYKTW9k2PV/7PuWcBUSeOo6jWJLU2DNhMOCi1CTP1Vr1qXN cB1zrc2ldkTJb0i1ydOhaeGCJSHRsdi8p9dUGm95225TqZGlE84F6Y3mfrRFtVU8AAk/LeILUvTzj DCxobQiHgxGi8mvk1uiSyIKFvEMqMniMXjlXlxhbRRhvWQ3LnJ21MPhaTWeTq5Fi6r/fGfhBlXjzW o+5/0Ft/FRALeNM171FNjOPX7gizDDJyiLwYYmSgprAWBoMr6t5XCcMourkOlUq8zpJCEwA9TAgAY J55czzyw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1q2RxB-001Rda-0i; Fri, 26 May 2023 07:33:37 +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, rohan.puri@samsung.com, rpuri.linux@gmail.com, kbusch@kernel.org, mcgrof@kernel.org Subject: [PATCH v2 5/5] zram: use generic PAGE_SECTORS and PAGE_SECTORS_SHIFT Date: Fri, 26 May 2023 00:33:36 -0700 Message-Id: <20230526073336.344543-6-mcgrof@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230526073336.344543-1-mcgrof@kernel.org> References: <20230526073336.344543-1-mcgrof@kernel.org> MIME-Version: 1.0 Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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. Reviewed-by: Sergey Senozhatsky Signed-off-by: Luis Chamberlain --- 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 f6d90f1ba5cf..5fdeb78ace9a 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 \