All of lore.kernel.org
 help / color / mirror / Atom feed
* a fix and two cleanups around blk_stack_limits
@ 2020-07-20  6:12 Christoph Hellwig
  2020-07-20  6:12 ` [PATCH 1/3] block: inherit the zoned characteristics in blk_stack_limits Christoph Hellwig
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Christoph Hellwig @ 2020-07-20  6:12 UTC (permalink / raw)
  To: axboe; +Cc: Damien.LeMoal, linux-block, dm-devel

Hi Jens,

this series ensures that the zoned device limitations are properly
inherited in blk_stack_limits, and then cleanups up two rather
pointless wrappers around it.

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

* [PATCH 1/3] block: inherit the zoned characteristics in blk_stack_limits
  2020-07-20  6:12 a fix and two cleanups around blk_stack_limits Christoph Hellwig
@ 2020-07-20  6:12 ` Christoph Hellwig
  2020-07-20  6:45   ` Johannes Thumshirn
                     ` (2 more replies)
  2020-07-20  6:12 ` [PATCH 2/3] block: remove bdev_stack_limits Christoph Hellwig
                   ` (3 subsequent siblings)
  4 siblings, 3 replies; 16+ messages in thread
From: Christoph Hellwig @ 2020-07-20  6:12 UTC (permalink / raw)
  To: axboe; +Cc: Damien.LeMoal, linux-block, dm-devel

Lift the code from device mapper into blk_stack_limits to inherity
the stacking limitations.  This ensures we do the right thing for
all stacked zoned block devices.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-settings.c   |  1 +
 drivers/md/dm-table.c  | 19 -------------------
 include/linux/blkdev.h |  9 ++++++---
 3 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/block/blk-settings.c b/block/blk-settings.c
index 9a2c23cd970073..9cddbd73647405 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -609,6 +609,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
 		t->chunk_sectors = min_not_zero(t->chunk_sectors,
 						b->chunk_sectors);
 
+	t->zoned = max(t->zoned, b->zoned);
 	return ret;
 }
 EXPORT_SYMBOL(blk_stack_limits);
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 0ea5b7367179ff..ec5364133cef7f 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -467,9 +467,6 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
 		       q->limits.logical_block_size,
 		       q->limits.alignment_offset,
 		       (unsigned long long) start << SECTOR_SHIFT);
-
-	limits->zoned = blk_queue_zoned_model(q);
-
 	return 0;
 }
 
@@ -1528,22 +1525,6 @@ int dm_calculate_queue_limits(struct dm_table *table,
 			       dm_device_name(table->md),
 			       (unsigned long long) ti->begin,
 			       (unsigned long long) ti->len);
-
-		/*
-		 * FIXME: this should likely be moved to blk_stack_limits(), would
-		 * also eliminate limits->zoned stacking hack in dm_set_device_limits()
-		 */
-		if (limits->zoned == BLK_ZONED_NONE && ti_limits.zoned != BLK_ZONED_NONE) {
-			/*
-			 * By default, the stacked limits zoned model is set to
-			 * BLK_ZONED_NONE in blk_set_stacking_limits(). Update
-			 * this model using the first target model reported
-			 * that is not BLK_ZONED_NONE. This will be either the
-			 * first target device zoned model or the model reported
-			 * by the target .io_hints.
-			 */
-			limits->zoned = ti_limits.zoned;
-		}
 	}
 
 	/*
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 06995b96e94679..67b9ccc1da3560 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -306,11 +306,14 @@ enum blk_queue_state {
 
 /*
  * Zoned block device models (zoned limit).
+ *
+ * Note: This needs to be ordered from the least to the most severe
+ * restrictions for the inheritance in blk_stack_limits() to work.
  */
 enum blk_zoned_model {
-	BLK_ZONED_NONE,	/* Regular block device */
-	BLK_ZONED_HA,	/* Host-aware zoned block device */
-	BLK_ZONED_HM,	/* Host-managed zoned block device */
+	BLK_ZONED_NONE = 0,	/* Regular block device */
+	BLK_ZONED_HA,		/* Host-aware zoned block device */
+	BLK_ZONED_HM,		/* Host-managed zoned block device */
 };
 
 struct queue_limits {
-- 
2.27.0


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

* [PATCH 2/3] block: remove bdev_stack_limits
  2020-07-20  6:12 a fix and two cleanups around blk_stack_limits Christoph Hellwig
  2020-07-20  6:12 ` [PATCH 1/3] block: inherit the zoned characteristics in blk_stack_limits Christoph Hellwig
@ 2020-07-20  6:12 ` Christoph Hellwig
  2020-07-20  8:11   ` Damien Le Moal
  2020-07-20  8:15   ` Johannes Thumshirn
  2020-07-20  6:12 ` [PATCH 3/3] block: remove blk_queue_stack_limits Christoph Hellwig
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 16+ messages in thread
From: Christoph Hellwig @ 2020-07-20  6:12 UTC (permalink / raw)
  To: axboe; +Cc: Damien.LeMoal, linux-block, dm-devel

This function is just a tiny wrapper around blk_stack_limit and has
two callers.  Simplify the stack a bit by open coding it in the two
callers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-settings.c   | 25 ++-----------------------
 drivers/md/dm-table.c  |  3 ++-
 include/linux/blkdev.h |  2 --
 3 files changed, 4 insertions(+), 26 deletions(-)

diff --git a/block/blk-settings.c b/block/blk-settings.c
index 9cddbd73647405..8c63af7726850c 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -614,28 +614,6 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
 }
 EXPORT_SYMBOL(blk_stack_limits);
 
-/**
- * bdev_stack_limits - adjust queue limits for stacked drivers
- * @t:	the stacking driver limits (top device)
- * @bdev:  the component block_device (bottom)
- * @start:  first data sector within component device
- *
- * Description:
- *    Merges queue limits for a top device and a block_device.  Returns
- *    0 if alignment didn't change.  Returns -1 if adding the bottom
- *    device caused misalignment.
- */
-int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev,
-		      sector_t start)
-{
-	struct request_queue *bq = bdev_get_queue(bdev);
-
-	start += get_start_sect(bdev);
-
-	return blk_stack_limits(t, &bq->limits, start);
-}
-EXPORT_SYMBOL(bdev_stack_limits);
-
 /**
  * disk_stack_limits - adjust queue limits for stacked drivers
  * @disk:  MD/DM gendisk (top)
@@ -651,7 +629,8 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
 {
 	struct request_queue *t = disk->queue;
 
-	if (bdev_stack_limits(&t->limits, bdev, offset >> 9) < 0) {
+	if (blk_stack_limits(&t->limits, &bdev_get_queue(bdev)->limits,
+			get_start_sect(bdev) + (offset >> 9)) < 0) {
 		char top[BDEVNAME_SIZE], bottom[BDEVNAME_SIZE];
 
 		disk_name(disk, 0, top);
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index ec5364133cef7f..aac4c31cfc8498 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -458,7 +458,8 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
 		return 0;
 	}
 
-	if (bdev_stack_limits(limits, bdev, start) < 0)
+	if (blk_stack_limits(limits, &q->limits,
+			get_start_sect(bdev) + start) < 0)
 		DMWARN("%s: adding target device %s caused an alignment inconsistency: "
 		       "physical_block_size=%u, logical_block_size=%u, "
 		       "alignment_offset=%u, start=%llu",
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 67b9ccc1da3560..247b0e0a2901f0 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1106,8 +1106,6 @@ extern void blk_set_default_limits(struct queue_limits *lim);
 extern void blk_set_stacking_limits(struct queue_limits *lim);
 extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
 			    sector_t offset);
-extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev,
-			    sector_t offset);
 extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
 			      sector_t offset);
 extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);
-- 
2.27.0


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

* [PATCH 3/3] block: remove blk_queue_stack_limits
  2020-07-20  6:12 a fix and two cleanups around blk_stack_limits Christoph Hellwig
  2020-07-20  6:12 ` [PATCH 1/3] block: inherit the zoned characteristics in blk_stack_limits Christoph Hellwig
  2020-07-20  6:12 ` [PATCH 2/3] block: remove bdev_stack_limits Christoph Hellwig
@ 2020-07-20  6:12 ` Christoph Hellwig
  2020-07-20  8:11   ` Damien Le Moal
  2020-07-20  8:16   ` Johannes Thumshirn
  2020-07-20  8:13 ` a fix and two cleanups around blk_stack_limits Damien Le Moal
  2020-07-20 16:56 ` Jens Axboe
  4 siblings, 2 replies; 16+ messages in thread
From: Christoph Hellwig @ 2020-07-20  6:12 UTC (permalink / raw)
  To: axboe; +Cc: Damien.LeMoal, linux-block, dm-devel

This function is just a tiny wrapper around blk_stack_limits.  Open code
it int the two callers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-settings.c         | 11 -----------
 drivers/block/drbd/drbd_nl.c |  4 ++--
 drivers/nvme/host/core.c     |  3 ++-
 include/linux/blkdev.h       |  1 -
 4 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/block/blk-settings.c b/block/blk-settings.c
index 8c63af7726850c..76a7e03bcd6cac 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -455,17 +455,6 @@ void blk_queue_io_opt(struct request_queue *q, unsigned int opt)
 }
 EXPORT_SYMBOL(blk_queue_io_opt);
 
-/**
- * blk_queue_stack_limits - inherit underlying queue limits for stacked drivers
- * @t:	the stacking driver (top)
- * @b:  the underlying device (bottom)
- **/
-void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b)
-{
-	blk_stack_limits(&t->limits, &b->limits, 0);
-}
-EXPORT_SYMBOL(blk_queue_stack_limits);
-
 /**
  * blk_stack_limits - adjust queue_limits for stacked devices
  * @t:	the stacking driver limits (top device)
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index da4a3ebe04efa5..d0d9a549b58388 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -1250,7 +1250,7 @@ static void fixup_discard_if_not_supported(struct request_queue *q)
 
 static void fixup_write_zeroes(struct drbd_device *device, struct request_queue *q)
 {
-	/* Fixup max_write_zeroes_sectors after blk_queue_stack_limits():
+	/* Fixup max_write_zeroes_sectors after blk_stack_limits():
 	 * if we can handle "zeroes" efficiently on the protocol,
 	 * we want to do that, even if our backend does not announce
 	 * max_write_zeroes_sectors itself. */
@@ -1361,7 +1361,7 @@ static void drbd_setup_queue_param(struct drbd_device *device, struct drbd_backi
 	decide_on_write_same_support(device, q, b, o, disable_write_same);
 
 	if (b) {
-		blk_queue_stack_limits(q, b);
+		blk_stack_limits(&q->limits, &b->limits, 0);
 
 		if (q->backing_dev_info->ra_pages !=
 		    b->backing_dev_info->ra_pages) {
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 5192a024dc1b9c..45c4c408649080 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1973,7 +1973,8 @@ static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)
 #ifdef CONFIG_NVME_MULTIPATH
 	if (ns->head->disk) {
 		nvme_update_disk_info(ns->head->disk, ns, id);
-		blk_queue_stack_limits(ns->head->disk->queue, ns->queue);
+		blk_stack_limits(&ns->head->disk->queue->limits,
+				 &ns->queue->limits, 0);
 		revalidate_disk(ns->head->disk);
 	}
 #endif
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 247b0e0a2901f0..484cd3c8447452 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1108,7 +1108,6 @@ extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
 			    sector_t offset);
 extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
 			      sector_t offset);
-extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);
 extern void blk_queue_update_dma_pad(struct request_queue *, unsigned int);
 extern void blk_queue_segment_boundary(struct request_queue *, unsigned long);
 extern void blk_queue_virt_boundary(struct request_queue *, unsigned long);
-- 
2.27.0


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

* Re: [PATCH 1/3] block: inherit the zoned characteristics in blk_stack_limits
  2020-07-20  6:12 ` [PATCH 1/3] block: inherit the zoned characteristics in blk_stack_limits Christoph Hellwig
@ 2020-07-20  6:45   ` Johannes Thumshirn
  2020-07-20  8:09   ` Damien Le Moal
  2020-07-21 17:32   ` Mike Snitzer
  2 siblings, 0 replies; 16+ messages in thread
From: Johannes Thumshirn @ 2020-07-20  6:45 UTC (permalink / raw)
  To: Christoph Hellwig, axboe; +Cc: Damien Le Moal, linux-block, dm-devel

On 20/07/2020 08:13, Christoph Hellwig wrote:
>  /*
>   * Zoned block device models (zoned limit).
> + *
> + * Note: This needs to be ordered from the least to the most severe
> + * restrictions for the inheritance in blk_stack_limits() to work.
>   */
>  enum blk_zoned_model {
> -	BLK_ZONED_NONE,	/* Regular block device */
> -	BLK_ZONED_HA,	/* Host-aware zoned block device */
> -	BLK_ZONED_HM,	/* Host-managed zoned block device */
> +	BLK_ZONED_NONE = 0,	/* Regular block device */

The initialization to 0 for the first value is not needed.

Apart from that,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 1/3] block: inherit the zoned characteristics in blk_stack_limits
  2020-07-20  6:12 ` [PATCH 1/3] block: inherit the zoned characteristics in blk_stack_limits Christoph Hellwig
  2020-07-20  6:45   ` Johannes Thumshirn
@ 2020-07-20  8:09   ` Damien Le Moal
  2020-07-21 17:32   ` Mike Snitzer
  2 siblings, 0 replies; 16+ messages in thread
From: Damien Le Moal @ 2020-07-20  8:09 UTC (permalink / raw)
  To: Christoph Hellwig, axboe; +Cc: linux-block, dm-devel

On 2020/07/20 15:13, Christoph Hellwig wrote:
> Lift the code from device mapper into blk_stack_limits to inherity
> the stacking limitations.  This ensures we do the right thing for
> all stacked zoned block devices.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  block/blk-settings.c   |  1 +
>  drivers/md/dm-table.c  | 19 -------------------
>  include/linux/blkdev.h |  9 ++++++---
>  3 files changed, 7 insertions(+), 22 deletions(-)
> 
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index 9a2c23cd970073..9cddbd73647405 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -609,6 +609,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
>  		t->chunk_sectors = min_not_zero(t->chunk_sectors,
>  						b->chunk_sectors);
>  
> +	t->zoned = max(t->zoned, b->zoned);
>  	return ret;
>  }
>  EXPORT_SYMBOL(blk_stack_limits);
> diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
> index 0ea5b7367179ff..ec5364133cef7f 100644
> --- a/drivers/md/dm-table.c
> +++ b/drivers/md/dm-table.c
> @@ -467,9 +467,6 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
>  		       q->limits.logical_block_size,
>  		       q->limits.alignment_offset,
>  		       (unsigned long long) start << SECTOR_SHIFT);
> -
> -	limits->zoned = blk_queue_zoned_model(q);
> -
>  	return 0;
>  }
>  
> @@ -1528,22 +1525,6 @@ int dm_calculate_queue_limits(struct dm_table *table,
>  			       dm_device_name(table->md),
>  			       (unsigned long long) ti->begin,
>  			       (unsigned long long) ti->len);
> -
> -		/*
> -		 * FIXME: this should likely be moved to blk_stack_limits(), would
> -		 * also eliminate limits->zoned stacking hack in dm_set_device_limits()
> -		 */
> -		if (limits->zoned == BLK_ZONED_NONE && ti_limits.zoned != BLK_ZONED_NONE) {
> -			/*
> -			 * By default, the stacked limits zoned model is set to
> -			 * BLK_ZONED_NONE in blk_set_stacking_limits(). Update
> -			 * this model using the first target model reported
> -			 * that is not BLK_ZONED_NONE. This will be either the
> -			 * first target device zoned model or the model reported
> -			 * by the target .io_hints.
> -			 */
> -			limits->zoned = ti_limits.zoned;
> -		}
>  	}
>  
>  	/*
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 06995b96e94679..67b9ccc1da3560 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -306,11 +306,14 @@ enum blk_queue_state {
>  
>  /*
>   * Zoned block device models (zoned limit).
> + *
> + * Note: This needs to be ordered from the least to the most severe
> + * restrictions for the inheritance in blk_stack_limits() to work.
>   */
>  enum blk_zoned_model {
> -	BLK_ZONED_NONE,	/* Regular block device */
> -	BLK_ZONED_HA,	/* Host-aware zoned block device */
> -	BLK_ZONED_HM,	/* Host-managed zoned block device */
> +	BLK_ZONED_NONE = 0,	/* Regular block device */
> +	BLK_ZONED_HA,		/* Host-aware zoned block device */
> +	BLK_ZONED_HM,		/* Host-managed zoned block device */
>  };
>  
>  struct queue_limits {
> 

Looks good.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>


-- 
Damien Le Moal
Western Digital Research

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

* Re: [PATCH 2/3] block: remove bdev_stack_limits
  2020-07-20  6:12 ` [PATCH 2/3] block: remove bdev_stack_limits Christoph Hellwig
@ 2020-07-20  8:11   ` Damien Le Moal
  2020-07-20  8:15   ` Johannes Thumshirn
  1 sibling, 0 replies; 16+ messages in thread
From: Damien Le Moal @ 2020-07-20  8:11 UTC (permalink / raw)
  To: Christoph Hellwig, axboe; +Cc: linux-block, dm-devel

On 2020/07/20 15:13, Christoph Hellwig wrote:
> This function is just a tiny wrapper around blk_stack_limit and has
> two callers.  Simplify the stack a bit by open coding it in the two
> callers.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  block/blk-settings.c   | 25 ++-----------------------
>  drivers/md/dm-table.c  |  3 ++-
>  include/linux/blkdev.h |  2 --
>  3 files changed, 4 insertions(+), 26 deletions(-)
> 
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index 9cddbd73647405..8c63af7726850c 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -614,28 +614,6 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
>  }
>  EXPORT_SYMBOL(blk_stack_limits);
>  
> -/**
> - * bdev_stack_limits - adjust queue limits for stacked drivers
> - * @t:	the stacking driver limits (top device)
> - * @bdev:  the component block_device (bottom)
> - * @start:  first data sector within component device
> - *
> - * Description:
> - *    Merges queue limits for a top device and a block_device.  Returns
> - *    0 if alignment didn't change.  Returns -1 if adding the bottom
> - *    device caused misalignment.
> - */
> -int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev,
> -		      sector_t start)
> -{
> -	struct request_queue *bq = bdev_get_queue(bdev);
> -
> -	start += get_start_sect(bdev);
> -
> -	return blk_stack_limits(t, &bq->limits, start);
> -}
> -EXPORT_SYMBOL(bdev_stack_limits);
> -
>  /**
>   * disk_stack_limits - adjust queue limits for stacked drivers
>   * @disk:  MD/DM gendisk (top)
> @@ -651,7 +629,8 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
>  {
>  	struct request_queue *t = disk->queue;
>  
> -	if (bdev_stack_limits(&t->limits, bdev, offset >> 9) < 0) {
> +	if (blk_stack_limits(&t->limits, &bdev_get_queue(bdev)->limits,
> +			get_start_sect(bdev) + (offset >> 9)) < 0) {
>  		char top[BDEVNAME_SIZE], bottom[BDEVNAME_SIZE];
>  
>  		disk_name(disk, 0, top);
> diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
> index ec5364133cef7f..aac4c31cfc8498 100644
> --- a/drivers/md/dm-table.c
> +++ b/drivers/md/dm-table.c
> @@ -458,7 +458,8 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
>  		return 0;
>  	}
>  
> -	if (bdev_stack_limits(limits, bdev, start) < 0)
> +	if (blk_stack_limits(limits, &q->limits,
> +			get_start_sect(bdev) + start) < 0)
>  		DMWARN("%s: adding target device %s caused an alignment inconsistency: "
>  		       "physical_block_size=%u, logical_block_size=%u, "
>  		       "alignment_offset=%u, start=%llu",
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 67b9ccc1da3560..247b0e0a2901f0 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -1106,8 +1106,6 @@ extern void blk_set_default_limits(struct queue_limits *lim);
>  extern void blk_set_stacking_limits(struct queue_limits *lim);
>  extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
>  			    sector_t offset);
> -extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev,
> -			    sector_t offset);
>  extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
>  			      sector_t offset);
>  extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);
> 

Looks good.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>

-- 
Damien Le Moal
Western Digital Research

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

* Re: [PATCH 3/3] block: remove blk_queue_stack_limits
  2020-07-20  6:12 ` [PATCH 3/3] block: remove blk_queue_stack_limits Christoph Hellwig
@ 2020-07-20  8:11   ` Damien Le Moal
  2020-07-20  8:16   ` Johannes Thumshirn
  1 sibling, 0 replies; 16+ messages in thread
From: Damien Le Moal @ 2020-07-20  8:11 UTC (permalink / raw)
  To: Christoph Hellwig, axboe; +Cc: linux-block, dm-devel

On 2020/07/20 15:13, Christoph Hellwig wrote:
> This function is just a tiny wrapper around blk_stack_limits.  Open code
> it int the two callers.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  block/blk-settings.c         | 11 -----------
>  drivers/block/drbd/drbd_nl.c |  4 ++--
>  drivers/nvme/host/core.c     |  3 ++-
>  include/linux/blkdev.h       |  1 -
>  4 files changed, 4 insertions(+), 15 deletions(-)
> 
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index 8c63af7726850c..76a7e03bcd6cac 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -455,17 +455,6 @@ void blk_queue_io_opt(struct request_queue *q, unsigned int opt)
>  }
>  EXPORT_SYMBOL(blk_queue_io_opt);
>  
> -/**
> - * blk_queue_stack_limits - inherit underlying queue limits for stacked drivers
> - * @t:	the stacking driver (top)
> - * @b:  the underlying device (bottom)
> - **/
> -void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b)
> -{
> -	blk_stack_limits(&t->limits, &b->limits, 0);
> -}
> -EXPORT_SYMBOL(blk_queue_stack_limits);
> -
>  /**
>   * blk_stack_limits - adjust queue_limits for stacked devices
>   * @t:	the stacking driver limits (top device)
> diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
> index da4a3ebe04efa5..d0d9a549b58388 100644
> --- a/drivers/block/drbd/drbd_nl.c
> +++ b/drivers/block/drbd/drbd_nl.c
> @@ -1250,7 +1250,7 @@ static void fixup_discard_if_not_supported(struct request_queue *q)
>  
>  static void fixup_write_zeroes(struct drbd_device *device, struct request_queue *q)
>  {
> -	/* Fixup max_write_zeroes_sectors after blk_queue_stack_limits():
> +	/* Fixup max_write_zeroes_sectors after blk_stack_limits():
>  	 * if we can handle "zeroes" efficiently on the protocol,
>  	 * we want to do that, even if our backend does not announce
>  	 * max_write_zeroes_sectors itself. */
> @@ -1361,7 +1361,7 @@ static void drbd_setup_queue_param(struct drbd_device *device, struct drbd_backi
>  	decide_on_write_same_support(device, q, b, o, disable_write_same);
>  
>  	if (b) {
> -		blk_queue_stack_limits(q, b);
> +		blk_stack_limits(&q->limits, &b->limits, 0);
>  
>  		if (q->backing_dev_info->ra_pages !=
>  		    b->backing_dev_info->ra_pages) {
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 5192a024dc1b9c..45c4c408649080 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -1973,7 +1973,8 @@ static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)
>  #ifdef CONFIG_NVME_MULTIPATH
>  	if (ns->head->disk) {
>  		nvme_update_disk_info(ns->head->disk, ns, id);
> -		blk_queue_stack_limits(ns->head->disk->queue, ns->queue);
> +		blk_stack_limits(&ns->head->disk->queue->limits,
> +				 &ns->queue->limits, 0);
>  		revalidate_disk(ns->head->disk);
>  	}
>  #endif
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 247b0e0a2901f0..484cd3c8447452 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -1108,7 +1108,6 @@ extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
>  			    sector_t offset);
>  extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
>  			      sector_t offset);
> -extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);
>  extern void blk_queue_update_dma_pad(struct request_queue *, unsigned int);
>  extern void blk_queue_segment_boundary(struct request_queue *, unsigned long);
>  extern void blk_queue_virt_boundary(struct request_queue *, unsigned long);
> 

Looks good.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>

-- 
Damien Le Moal
Western Digital Research

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

* Re: a fix and two cleanups around blk_stack_limits
  2020-07-20  6:12 a fix and two cleanups around blk_stack_limits Christoph Hellwig
                   ` (2 preceding siblings ...)
  2020-07-20  6:12 ` [PATCH 3/3] block: remove blk_queue_stack_limits Christoph Hellwig
@ 2020-07-20  8:13 ` Damien Le Moal
  2020-07-20 16:56 ` Jens Axboe
  4 siblings, 0 replies; 16+ messages in thread
From: Damien Le Moal @ 2020-07-20  8:13 UTC (permalink / raw)
  To: Christoph Hellwig, axboe; +Cc: linux-block, dm-devel

On 2020/07/20 15:13, Christoph Hellwig wrote:
> Hi Jens,
> 
> this series ensures that the zoned device limitations are properly
> inherited in blk_stack_limits, and then cleanups up two rather
> pointless wrappers around it.
> 

Tested with dm-linear, dm-crypt and dm-zoned multi device setup (from dm-5.9
tree). No problems detected.

Tested-by: Damien Le Moal <damien.lemoal@wdc.com>

-- 
Damien Le Moal
Western Digital Research

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

* Re: [PATCH 2/3] block: remove bdev_stack_limits
  2020-07-20  6:12 ` [PATCH 2/3] block: remove bdev_stack_limits Christoph Hellwig
  2020-07-20  8:11   ` Damien Le Moal
@ 2020-07-20  8:15   ` Johannes Thumshirn
  1 sibling, 0 replies; 16+ messages in thread
From: Johannes Thumshirn @ 2020-07-20  8:15 UTC (permalink / raw)
  To: Christoph Hellwig, axboe; +Cc: Damien Le Moal, linux-block, dm-devel

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

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

* Re: [PATCH 3/3] block: remove blk_queue_stack_limits
  2020-07-20  6:12 ` [PATCH 3/3] block: remove blk_queue_stack_limits Christoph Hellwig
  2020-07-20  8:11   ` Damien Le Moal
@ 2020-07-20  8:16   ` Johannes Thumshirn
  1 sibling, 0 replies; 16+ messages in thread
From: Johannes Thumshirn @ 2020-07-20  8:16 UTC (permalink / raw)
  To: Christoph Hellwig, axboe; +Cc: Damien Le Moal, linux-block, dm-devel

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

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

* Re: a fix and two cleanups around blk_stack_limits
  2020-07-20  6:12 a fix and two cleanups around blk_stack_limits Christoph Hellwig
                   ` (3 preceding siblings ...)
  2020-07-20  8:13 ` a fix and two cleanups around blk_stack_limits Damien Le Moal
@ 2020-07-20 16:56 ` Jens Axboe
  2020-07-20 17:35   ` Christoph Hellwig
  4 siblings, 1 reply; 16+ messages in thread
From: Jens Axboe @ 2020-07-20 16:56 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Damien.LeMoal, linux-block, dm-devel

On 7/20/20 12:12 AM, Christoph Hellwig wrote:
> Hi Jens,
> 
> this series ensures that the zoned device limitations are properly
> inherited in blk_stack_limits, and then cleanups up two rather
> pointless wrappers around it.

We should probably make this against for-5.9/drivers instead, to avoid
an unnecessary conflict when merging.

-- 
Jens Axboe


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

* Re: a fix and two cleanups around blk_stack_limits
  2020-07-20 16:56 ` Jens Axboe
@ 2020-07-20 17:35   ` Christoph Hellwig
  2020-07-20 21:35     ` Jens Axboe
  0 siblings, 1 reply; 16+ messages in thread
From: Christoph Hellwig @ 2020-07-20 17:35 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Christoph Hellwig, Damien.LeMoal, linux-block, dm-devel

On Mon, Jul 20, 2020 at 10:56:23AM -0600, Jens Axboe wrote:
> On 7/20/20 12:12 AM, Christoph Hellwig wrote:
> > Hi Jens,
> > 
> > this series ensures that the zoned device limitations are properly
> > inherited in blk_stack_limits, and then cleanups up two rather
> > pointless wrappers around it.
> 
> We should probably make this against for-5.9/drivers instead, to avoid
> an unnecessary conflict when merging.

Then we'd also need a merge as my next series depends on this, and it
clearly is core material.  Not sure which one is more important.

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

* Re: a fix and two cleanups around blk_stack_limits
  2020-07-20 17:35   ` Christoph Hellwig
@ 2020-07-20 21:35     ` Jens Axboe
  2020-07-20 21:40       ` Jens Axboe
  0 siblings, 1 reply; 16+ messages in thread
From: Jens Axboe @ 2020-07-20 21:35 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Damien.LeMoal, linux-block, dm-devel

On 7/20/20 11:35 AM, Christoph Hellwig wrote:
> On Mon, Jul 20, 2020 at 10:56:23AM -0600, Jens Axboe wrote:
>> On 7/20/20 12:12 AM, Christoph Hellwig wrote:
>>> Hi Jens,
>>>
>>> this series ensures that the zoned device limitations are properly
>>> inherited in blk_stack_limits, and then cleanups up two rather
>>> pointless wrappers around it.
>>
>> We should probably make this against for-5.9/drivers instead, to avoid
>> an unnecessary conflict when merging.
> 
> Then we'd also need a merge as my next series depends on this, and it
> clearly is core material.  Not sure which one is more important.

Hmm, might make more sense to kick off a branch topic for this and just
merge it after the other ones.

-- 
Jens Axboe


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

* Re: a fix and two cleanups around blk_stack_limits
  2020-07-20 21:35     ` Jens Axboe
@ 2020-07-20 21:40       ` Jens Axboe
  0 siblings, 0 replies; 16+ messages in thread
From: Jens Axboe @ 2020-07-20 21:40 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Damien.LeMoal, linux-block, dm-devel

On 7/20/20 3:35 PM, Jens Axboe wrote:
> On 7/20/20 11:35 AM, Christoph Hellwig wrote:
>> On Mon, Jul 20, 2020 at 10:56:23AM -0600, Jens Axboe wrote:
>>> On 7/20/20 12:12 AM, Christoph Hellwig wrote:
>>>> Hi Jens,
>>>>
>>>> this series ensures that the zoned device limitations are properly
>>>> inherited in blk_stack_limits, and then cleanups up two rather
>>>> pointless wrappers around it.
>>>
>>> We should probably make this against for-5.9/drivers instead, to avoid
>>> an unnecessary conflict when merging.
>>
>> Then we'd also need a merge as my next series depends on this, and it
>> clearly is core material.  Not sure which one is more important.
> 
> Hmm, might make more sense to kick off a branch topic for this and just
> merge it after the other ones.

Created a for-5.9/block-merge which is based on 5.8-rc6, with the 5.9
block and drivers branches merged in. Applied the series on top.

-- 
Jens Axboe


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

* Re: [PATCH 1/3] block: inherit the zoned characteristics in blk_stack_limits
  2020-07-20  6:12 ` [PATCH 1/3] block: inherit the zoned characteristics in blk_stack_limits Christoph Hellwig
  2020-07-20  6:45   ` Johannes Thumshirn
  2020-07-20  8:09   ` Damien Le Moal
@ 2020-07-21 17:32   ` Mike Snitzer
  2 siblings, 0 replies; 16+ messages in thread
From: Mike Snitzer @ 2020-07-21 17:32 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: axboe, linux-block, Damien.LeMoal, dm-devel

On Mon, Jul 20 2020 at  2:12am -0400,
Christoph Hellwig <hch@lst.de> wrote:

> Lift the code from device mapper into blk_stack_limits to inherity
> the stacking limitations.  This ensures we do the right thing for
> all stacked zoned block devices.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Mike Snitzer <snitzer@redhat.com>


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

end of thread, other threads:[~2020-07-21 17:32 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20  6:12 a fix and two cleanups around blk_stack_limits Christoph Hellwig
2020-07-20  6:12 ` [PATCH 1/3] block: inherit the zoned characteristics in blk_stack_limits Christoph Hellwig
2020-07-20  6:45   ` Johannes Thumshirn
2020-07-20  8:09   ` Damien Le Moal
2020-07-21 17:32   ` Mike Snitzer
2020-07-20  6:12 ` [PATCH 2/3] block: remove bdev_stack_limits Christoph Hellwig
2020-07-20  8:11   ` Damien Le Moal
2020-07-20  8:15   ` Johannes Thumshirn
2020-07-20  6:12 ` [PATCH 3/3] block: remove blk_queue_stack_limits Christoph Hellwig
2020-07-20  8:11   ` Damien Le Moal
2020-07-20  8:16   ` Johannes Thumshirn
2020-07-20  8:13 ` a fix and two cleanups around blk_stack_limits Damien Le Moal
2020-07-20 16:56 ` Jens Axboe
2020-07-20 17:35   ` Christoph Hellwig
2020-07-20 21:35     ` Jens Axboe
2020-07-20 21:40       ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.