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 2/3] block: remove bdev_stack_limits
Date: Mon, 20 Jul 2020 08:11:23 +0000	[thread overview]
Message-ID: <CY4PR04MB3751CDE47A50C4F06D4C97F9E77B0@CY4PR04MB3751.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20200720061251.652457-3-hch@lst.de

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

  reply	other threads:[~2020-07-20  8:11 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
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 [this message]
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=CY4PR04MB3751CDE47A50C4F06D4C97F9E77B0@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).