From: Luis Chamberlain <mcgrof@kernel.org>
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 [thread overview]
Message-ID: <20230421195807.2804512-6-mcgrof@kernel.org> (raw)
In-Reply-To: <20230421195807.2804512-1-mcgrof@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.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
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 \
--
2.39.2
next prev parent reply other threads:[~2023-04-21 19:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-21 19:58 [PATCH 0/5] block: simplify with PAGE_SECTORS_SHIFT Luis Chamberlain
2023-04-21 19:58 ` [PATCH 1/5] dm integrity: simplify by using PAGE_SECTORS_SHIFT Luis Chamberlain
2023-04-21 20:15 ` Matthew Wilcox
2023-04-21 19:58 ` [PATCH 2/5] drbd: use PAGE_SECTORS_SHIFT and PAGE_SECTORS Luis Chamberlain
2023-04-24 8:26 ` Christoph Böhmwalder
2023-04-21 19:58 ` [PATCH 3/5] iomap: simplify iomap_init() with PAGE_SECTORS Luis Chamberlain
2023-04-21 20:14 ` Matthew Wilcox
2023-04-21 22:02 ` Luis Chamberlain
2023-04-21 22:24 ` Jens Axboe
2023-04-21 22:30 ` Luis Chamberlain
2023-04-21 22:36 ` Jens Axboe
2023-04-21 22:34 ` Dave Chinner
2023-04-24 5:55 ` Christoph Hellwig
2023-04-21 19:58 ` [PATCH 4/5] dm bufio: simplify by using PAGE_SECTORS_SHIFT Luis Chamberlain
2023-04-21 19:58 ` Luis Chamberlain [this message]
2023-04-24 2:36 ` [PATCH 5/5] zram: use generic PAGE_SECTORS and PAGE_SECTORS_SHIFT Sergey Senozhatsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230421195807.2804512-6-mcgrof@kernel.org \
--to=mcgrof@kernel.org \
--cc=agk@redhat.com \
--cc=axboe@kernel.dk \
--cc=christoph.boehmwalder@linbit.com \
--cc=da.gomez@samsung.com \
--cc=djwong@kernel.org \
--cc=dm-devel@redhat.com \
--cc=drbd-dev@lists.linbit.com \
--cc=hare@suse.de \
--cc=hch@infradead.org \
--cc=kbusch@kernel.org \
--cc=lars.ellenberg@linbit.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=minchan@kernel.org \
--cc=p.raghav@samsung.com \
--cc=patches@lists.linux.dev \
--cc=philipp.reisner@linbit.com \
--cc=senozhatsky@chromium.org \
--cc=snitzer@kernel.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).