linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] block: simplify with PAGE_SECTORS_SHIFT
@ 2023-05-26  7:33 Luis Chamberlain
  2023-05-26  7:33 ` [PATCH v2 1/5] block: annotate bdev_disk_changed() deprecation with a symbol namespace Luis Chamberlain
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Luis Chamberlain @ 2023-05-26  7:33 UTC (permalink / raw)
  To: axboe, agk, snitzer, philipp.reisner, lars.ellenberg,
	christoph.boehmwalder, hch, djwong, minchan, senozhatsky
  Cc: patches, linux-block, linux-mm, linux-xfs, linux-fsdevel,
	dm-devel, drbd-dev, linux-kernel, willy, hare, p.raghav, da.gomez,
	rohan.puri, rpuri.linux, kbusch, mcgrof

A bit of block drivers have their own incantations with
PAGE_SHIFT - SECTOR_SHIFT. Just simplfy and use PAGE_SECTORS_SHIFT
all over.
                                                                                                                                                                                              
Based on linux-next next-20230525.

Changes since v1:

 o keep iomap math visibly simple
 o Add tags for Reviews/acks
 o rebase onto next-20230525

Luis Chamberlain (5):
  block: annotate bdev_disk_changed() deprecation with a symbol
    namespace
  drbd: use PAGE_SECTORS_SHIFT and PAGE_SECTORS
  iomap: simplify iomap_init() with PAGE_SECTORS
  dm bufio: simplify by using PAGE_SECTORS_SHIFT
  zram: use generic PAGE_SECTORS and PAGE_SECTORS_SHIFT

 block/partitions/core.c          |  6 +-----
 drivers/block/drbd/drbd_bitmap.c |  4 ++--
 drivers/block/loop.c             |  2 ++
 drivers/block/zram/zram_drv.c    | 12 ++++++------
 drivers/block/zram/zram_drv.h    |  2 --
 drivers/md/dm-bufio.c            |  4 ++--
 drivers/s390/block/dasd_genhd.c  |  2 ++
 fs/iomap/buffered-io.c           |  2 +-
 8 files changed, 16 insertions(+), 18 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2 1/5] block: annotate bdev_disk_changed() deprecation with a symbol namespace
  2023-05-26  7:33 [PATCH v2 0/5] block: simplify with PAGE_SECTORS_SHIFT Luis Chamberlain
@ 2023-05-26  7:33 ` Luis Chamberlain
  2023-05-26  8:13   ` Christoph Hellwig
  2023-05-26  7:33 ` [PATCH v2 2/5] drbd: use PAGE_SECTORS_SHIFT and PAGE_SECTORS Luis Chamberlain
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Luis Chamberlain @ 2023-05-26  7:33 UTC (permalink / raw)
  To: axboe, agk, snitzer, philipp.reisner, lars.ellenberg,
	christoph.boehmwalder, hch, djwong, minchan, senozhatsky
  Cc: patches, linux-block, linux-mm, linux-xfs, linux-fsdevel,
	dm-devel, drbd-dev, linux-kernel, willy, hare, p.raghav, da.gomez,
	rohan.puri, rpuri.linux, kbusch, mcgrof

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 <mcgrof@kernel.org>
---
 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 <linux/spinlock.h>
 #include <uapi/linux/loop.h>
 
+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;
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 2/5] drbd: use PAGE_SECTORS_SHIFT and PAGE_SECTORS
  2023-05-26  7:33 [PATCH v2 0/5] block: simplify with PAGE_SECTORS_SHIFT Luis Chamberlain
  2023-05-26  7:33 ` [PATCH v2 1/5] block: annotate bdev_disk_changed() deprecation with a symbol namespace Luis Chamberlain
@ 2023-05-26  7:33 ` Luis Chamberlain
  2023-05-26  9:20   ` Johannes Thumshirn
  2023-05-26  7:33 ` [PATCH v2 3/5] iomap: simplify iomap_init() with PAGE_SECTORS Luis Chamberlain
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Luis Chamberlain @ 2023-05-26  7:33 UTC (permalink / raw)
  To: axboe, agk, snitzer, philipp.reisner, lars.ellenberg,
	christoph.boehmwalder, hch, djwong, minchan, senozhatsky
  Cc: patches, linux-block, linux-mm, linux-xfs, linux-fsdevel,
	dm-devel, drbd-dev, linux-kernel, willy, hare, p.raghav, da.gomez,
	rohan.puri, rpuri.linux, kbusch, mcgrof

Replace common constants with generic versions.
This produces no functional changes.

Acked-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 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;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 3/5] iomap: simplify iomap_init() with PAGE_SECTORS
  2023-05-26  7:33 [PATCH v2 0/5] block: simplify with PAGE_SECTORS_SHIFT Luis Chamberlain
  2023-05-26  7:33 ` [PATCH v2 1/5] block: annotate bdev_disk_changed() deprecation with a symbol namespace Luis Chamberlain
  2023-05-26  7:33 ` [PATCH v2 2/5] drbd: use PAGE_SECTORS_SHIFT and PAGE_SECTORS Luis Chamberlain
@ 2023-05-26  7:33 ` Luis Chamberlain
  2023-05-26  8:13   ` Christoph Hellwig
  2023-05-26  9:20   ` Johannes Thumshirn
  2023-05-26  7:33 ` [PATCH v2 4/5] dm bufio: simplify by using PAGE_SECTORS_SHIFT Luis Chamberlain
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 14+ messages in thread
From: Luis Chamberlain @ 2023-05-26  7:33 UTC (permalink / raw)
  To: axboe, agk, snitzer, philipp.reisner, lars.ellenberg,
	christoph.boehmwalder, hch, djwong, minchan, senozhatsky
  Cc: patches, linux-block, linux-mm, linux-xfs, linux-fsdevel,
	dm-devel, drbd-dev, linux-kernel, willy, hare, p.raghav, da.gomez,
	rohan.puri, rpuri.linux, kbusch, mcgrof

Replace common constants with generic versions. This produces no
functional changes.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 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);
 }
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 4/5] dm bufio: simplify by using PAGE_SECTORS_SHIFT
  2023-05-26  7:33 [PATCH v2 0/5] block: simplify with PAGE_SECTORS_SHIFT Luis Chamberlain
                   ` (2 preceding siblings ...)
  2023-05-26  7:33 ` [PATCH v2 3/5] iomap: simplify iomap_init() with PAGE_SECTORS Luis Chamberlain
@ 2023-05-26  7:33 ` Luis Chamberlain
  2023-05-26  9:21   ` Johannes Thumshirn
  2023-05-26  7:33 ` [PATCH v2 5/5] zram: use generic PAGE_SECTORS and PAGE_SECTORS_SHIFT Luis Chamberlain
  2023-05-26  9:26 ` [PATCH v2 0/5] block: simplify with PAGE_SECTORS_SHIFT Johannes Thumshirn
  5 siblings, 1 reply; 14+ messages in thread
From: Luis Chamberlain @ 2023-05-26  7:33 UTC (permalink / raw)
  To: axboe, agk, snitzer, philipp.reisner, lars.ellenberg,
	christoph.boehmwalder, hch, djwong, minchan, senozhatsky
  Cc: patches, linux-block, linux-mm, linux-xfs, linux-fsdevel,
	dm-devel, drbd-dev, linux-kernel, willy, hare, p.raghav, da.gomez,
	rohan.puri, rpuri.linux, kbusch, mcgrof

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 <mcgrof@kernel.org>
---
 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:
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 5/5] zram: use generic PAGE_SECTORS and PAGE_SECTORS_SHIFT
  2023-05-26  7:33 [PATCH v2 0/5] block: simplify with PAGE_SECTORS_SHIFT Luis Chamberlain
                   ` (3 preceding siblings ...)
  2023-05-26  7:33 ` [PATCH v2 4/5] dm bufio: simplify by using PAGE_SECTORS_SHIFT Luis Chamberlain
@ 2023-05-26  7:33 ` Luis Chamberlain
  2023-05-26  9:24   ` Johannes Thumshirn
  2023-05-26  9:26 ` [PATCH v2 0/5] block: simplify with PAGE_SECTORS_SHIFT Johannes Thumshirn
  5 siblings, 1 reply; 14+ messages in thread
From: Luis Chamberlain @ 2023-05-26  7:33 UTC (permalink / raw)
  To: axboe, agk, snitzer, philipp.reisner, lars.ellenberg,
	christoph.boehmwalder, hch, djwong, minchan, senozhatsky
  Cc: patches, linux-block, linux-mm, linux-xfs, linux-fsdevel,
	dm-devel, drbd-dev, linux-kernel, willy, hare, p.raghav, da.gomez,
	rohan.puri, rpuri.linux, kbusch, mcgrof

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 <senozhatsky@chromium.org>
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 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	\
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 1/5] block: annotate bdev_disk_changed() deprecation with a symbol namespace
  2023-05-26  7:33 ` [PATCH v2 1/5] block: annotate bdev_disk_changed() deprecation with a symbol namespace Luis Chamberlain
@ 2023-05-26  8:13   ` Christoph Hellwig
  2023-05-26  8:20     ` Luis Chamberlain
  0 siblings, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2023-05-26  8:13 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: axboe, agk, snitzer, philipp.reisner, lars.ellenberg,
	christoph.boehmwalder, hch, djwong, minchan, senozhatsky, patches,
	linux-block, linux-mm, linux-xfs, linux-fsdevel, dm-devel,
	drbd-dev, linux-kernel, willy, hare, p.raghav, da.gomez,
	rohan.puri, rpuri.linux, kbusch

On Fri, May 26, 2023 at 12:33:32AM -0700, Luis Chamberlain wrote:
> 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.

I don't see how this is related to the rest of the seris.  I also don't
think it's a good idea.  The APIs isn't deprecated per se.  It just
should not be called by drivers.  The right thing would be an interface
like

EXPORT_SYMBOL_GPL_FOR(bdev_disk_changed, loop.ko, CONFIG_BLK_DEV_LOOP);
EXPORT_SYMBOL_GPL_FOR(bdev_disk_changed, dasd_mod.ko, CONFIG_DASD);

with the modulo code enforcing that no one but the module this is
explicitly exorted for can use the symbol.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 3/5] iomap: simplify iomap_init() with PAGE_SECTORS
  2023-05-26  7:33 ` [PATCH v2 3/5] iomap: simplify iomap_init() with PAGE_SECTORS Luis Chamberlain
@ 2023-05-26  8:13   ` Christoph Hellwig
  2023-05-26  9:20   ` Johannes Thumshirn
  1 sibling, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2023-05-26  8:13 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: axboe, agk, snitzer, philipp.reisner, lars.ellenberg,
	christoph.boehmwalder, hch, djwong, minchan, senozhatsky, patches,
	linux-block, linux-mm, linux-xfs, linux-fsdevel, dm-devel,
	drbd-dev, linux-kernel, willy, hare, p.raghav, da.gomez,
	rohan.puri, rpuri.linux, kbusch

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 1/5] block: annotate bdev_disk_changed() deprecation with a symbol namespace
  2023-05-26  8:13   ` Christoph Hellwig
@ 2023-05-26  8:20     ` Luis Chamberlain
  0 siblings, 0 replies; 14+ messages in thread
From: Luis Chamberlain @ 2023-05-26  8:20 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: axboe, agk, snitzer, philipp.reisner, lars.ellenberg,
	christoph.boehmwalder, djwong, minchan, senozhatsky, patches,
	linux-block, linux-mm, linux-xfs, linux-fsdevel, dm-devel,
	drbd-dev, linux-kernel, willy, hare, p.raghav, da.gomez,
	rohan.puri, rpuri.linux, kbusch

On Fri, May 26, 2023 at 01:13:14AM -0700, Christoph Hellwig wrote:
> On Fri, May 26, 2023 at 12:33:32AM -0700, Luis Chamberlain wrote:
> > 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.
> 
> I don't see how this is related to the rest of the seris.

Jessh, sorry it is too late here and that was a typo that the commit
went into the series. I'll go sleep now. This I just had queued
as a reminder for the new annotation for deprecated symbols to be
used in some situations.

Please ignore this patch.

  Luis

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/5] drbd: use PAGE_SECTORS_SHIFT and PAGE_SECTORS
  2023-05-26  7:33 ` [PATCH v2 2/5] drbd: use PAGE_SECTORS_SHIFT and PAGE_SECTORS Luis Chamberlain
@ 2023-05-26  9:20   ` Johannes Thumshirn
  0 siblings, 0 replies; 14+ messages in thread
From: Johannes Thumshirn @ 2023-05-26  9:20 UTC (permalink / raw)
  To: Luis Chamberlain, 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

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 3/5] iomap: simplify iomap_init() with PAGE_SECTORS
  2023-05-26  7:33 ` [PATCH v2 3/5] iomap: simplify iomap_init() with PAGE_SECTORS Luis Chamberlain
  2023-05-26  8:13   ` Christoph Hellwig
@ 2023-05-26  9:20   ` Johannes Thumshirn
  1 sibling, 0 replies; 14+ messages in thread
From: Johannes Thumshirn @ 2023-05-26  9:20 UTC (permalink / raw)
  To: Luis Chamberlain, 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

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 4/5] dm bufio: simplify by using PAGE_SECTORS_SHIFT
  2023-05-26  7:33 ` [PATCH v2 4/5] dm bufio: simplify by using PAGE_SECTORS_SHIFT Luis Chamberlain
@ 2023-05-26  9:21   ` Johannes Thumshirn
  0 siblings, 0 replies; 14+ messages in thread
From: Johannes Thumshirn @ 2023-05-26  9:21 UTC (permalink / raw)
  To: Luis Chamberlain, 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

On 26.05.23 09:33, Luis Chamberlain wrote:
>  		*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));


>  	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));


The parenthesis are completely unneeded in the new version,
please remove them.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 5/5] zram: use generic PAGE_SECTORS and PAGE_SECTORS_SHIFT
  2023-05-26  7:33 ` [PATCH v2 5/5] zram: use generic PAGE_SECTORS and PAGE_SECTORS_SHIFT Luis Chamberlain
@ 2023-05-26  9:24   ` Johannes Thumshirn
  0 siblings, 0 replies; 14+ messages in thread
From: Johannes Thumshirn @ 2023-05-26  9:24 UTC (permalink / raw)
  To: Luis Chamberlain, 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

On 26.05.23 09:34, Luis Chamberlain wrote:
> +	u32 index = bio->bi_iter.bi_sector >> PAGE_SECTORS_SHIFT;
> +	u32 offset = (bio->bi_iter.bi_sector & (PAGE_SECTORS - 1)) <<
>  			SECTOR_SHIFT;

(PAGE_SECTORS - 1) is SECTOR_MASK, please use this.

Thanks,
	Johannes

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 0/5] block: simplify with PAGE_SECTORS_SHIFT
  2023-05-26  7:33 [PATCH v2 0/5] block: simplify with PAGE_SECTORS_SHIFT Luis Chamberlain
                   ` (4 preceding siblings ...)
  2023-05-26  7:33 ` [PATCH v2 5/5] zram: use generic PAGE_SECTORS and PAGE_SECTORS_SHIFT Luis Chamberlain
@ 2023-05-26  9:26 ` Johannes Thumshirn
  5 siblings, 0 replies; 14+ messages in thread
From: Johannes Thumshirn @ 2023-05-26  9:26 UTC (permalink / raw)
  To: Luis Chamberlain, 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

On 26.05.23 09:33, Luis Chamberlain wrote:
> A bit of block drivers have their own incantations with
> PAGE_SHIFT - SECTOR_SHIFT. Just simplfy and use PAGE_SECTORS_SHIFT
> all over.
>                                                                                                                                                                                               
> Based on linux-next next-20230525.
> 
> Changes since v1:
> 
>  o keep iomap math visibly simple
>  o Add tags for Reviews/acks
>  o rebase onto next-20230525
> 
> Luis Chamberlain (5):
>   block: annotate bdev_disk_changed() deprecation with a symbol
>     namespace
>   drbd: use PAGE_SECTORS_SHIFT and PAGE_SECTORS
>   iomap: simplify iomap_init() with PAGE_SECTORS
>   dm bufio: simplify by using PAGE_SECTORS_SHIFT
>   zram: use generic PAGE_SECTORS and PAGE_SECTORS_SHIFT
> 
>  block/partitions/core.c          |  6 +-----
>  drivers/block/drbd/drbd_bitmap.c |  4 ++--
>  drivers/block/loop.c             |  2 ++
>  drivers/block/zram/zram_drv.c    | 12 ++++++------
>  drivers/block/zram/zram_drv.h    |  2 --
>  drivers/md/dm-bufio.c            |  4 ++--
>  drivers/s390/block/dasd_genhd.c  |  2 ++
>  fs/iomap/buffered-io.c           |  2 +-
>  8 files changed, 16 insertions(+), 18 deletions(-)
> 

Hey Luis,
I've found another one in sd_zbc_revalidate_zones():

	max_append = min_t(u32, logical_to_sectors(sdkp->device, zone_blocks),
			   q->limits.max_segments << (PAGE_SHIFT - 9));

Mind taking care of it in the next round as well?

Thanks,
	Johannes

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-05-26  9:27 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-26  7:33 [PATCH v2 0/5] block: simplify with PAGE_SECTORS_SHIFT Luis Chamberlain
2023-05-26  7:33 ` [PATCH v2 1/5] block: annotate bdev_disk_changed() deprecation with a symbol namespace Luis Chamberlain
2023-05-26  8:13   ` Christoph Hellwig
2023-05-26  8:20     ` Luis Chamberlain
2023-05-26  7:33 ` [PATCH v2 2/5] drbd: use PAGE_SECTORS_SHIFT and PAGE_SECTORS Luis Chamberlain
2023-05-26  9:20   ` Johannes Thumshirn
2023-05-26  7:33 ` [PATCH v2 3/5] iomap: simplify iomap_init() with PAGE_SECTORS Luis Chamberlain
2023-05-26  8:13   ` Christoph Hellwig
2023-05-26  9:20   ` Johannes Thumshirn
2023-05-26  7:33 ` [PATCH v2 4/5] dm bufio: simplify by using PAGE_SECTORS_SHIFT Luis Chamberlain
2023-05-26  9:21   ` Johannes Thumshirn
2023-05-26  7:33 ` [PATCH v2 5/5] zram: use generic PAGE_SECTORS and PAGE_SECTORS_SHIFT Luis Chamberlain
2023-05-26  9:24   ` Johannes Thumshirn
2023-05-26  9:26 ` [PATCH v2 0/5] block: simplify with PAGE_SECTORS_SHIFT Johannes Thumshirn

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).