linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Damien Le Moal <Damien.LeMoal@wdc.com>
To: Christoph Hellwig <hch@lst.de>, "axboe@kernel.dk" <axboe@kernel.dk>
Cc: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"dm-devel@redhat.com" <dm-devel@redhat.com>
Subject: Re: [PATCH 1/3] block: inherit the zoned characteristics in blk_stack_limits
Date: Mon, 20 Jul 2020 08:09:53 +0000	[thread overview]
Message-ID: <CY4PR04MB37515CAD1C2FBE1F85574CAAE77B0@CY4PR04MB3751.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20200720061251.652457-2-hch@lst.de

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

  parent reply	other threads:[~2020-07-20  8:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=CY4PR04MB37515CAD1C2FBE1F85574CAAE77B0@CY4PR04MB3751.namprd04.prod.outlook.com \
    --to=damien.lemoal@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.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).