All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Leng <lengchao@huawei.com>
To: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
	Keith Busch <kbusch@kernel.org>, Sagi Grimberg <sagi@grimberg.me>
Cc: Ming Lei <ming.lei@redhat.com>, <linux-nvme@lists.infradead.org>,
	<linux-block@vger.kernel.org>
Subject: Re: [PATCH 1/8] block: set the disk capacity to 0 in blk_mark_disk_dead
Date: Fri, 21 Oct 2022 09:53:20 +0800	[thread overview]
Message-ID: <e3ab9d31-7a9e-4bad-9a04-1f20845c6268@huawei.com> (raw)
In-Reply-To: <20221020105608.1581940-2-hch@lst.de>

Reviewed-by: Chao Leng <lengchao@huawei.com>

On 2022/10/20 18:56, Christoph Hellwig wrote:
> nvme and xen-blkfront are already doing this to stop buffered writes from
> creating dirty pages that can't be written out later.  Move it to the
> common code.  Note that this follows the xen-blkfront version that does
> not send and uevent as the uevent is a bit confusing when the device is
> about to go away a little later, and the the size change is just to stop
> buffered writes faster.
> 
> This also removes the comment about the ordering from nvme, as bd_mutex
> not only is gone entirely, but also hasn't been used for locking updates
> to the disk size long before that, and thus the ordering requirement
> documented there doesn't apply any more.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   block/genhd.c                | 3 +++
>   drivers/block/xen-blkfront.c | 1 -
>   drivers/nvme/host/core.c     | 7 +------
>   3 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/block/genhd.c b/block/genhd.c
> index 17b33c62423df..2877b5f905579 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -555,6 +555,9 @@ void blk_mark_disk_dead(struct gendisk *disk)
>   {
>   	set_bit(GD_DEAD, &disk->state);
>   	blk_queue_start_drain(disk->queue);
> +
> +	/* stop buffered writers from dirtying pages that can't written out */
> +	set_capacity(disk, 0);
>   }
>   EXPORT_SYMBOL_GPL(blk_mark_disk_dead);
>   
> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> index 35b9bcad9db90..b28489290323f 100644
> --- a/drivers/block/xen-blkfront.c
> +++ b/drivers/block/xen-blkfront.c
> @@ -2129,7 +2129,6 @@ static void blkfront_closing(struct blkfront_info *info)
>   	if (info->rq && info->gd) {
>   		blk_mq_stop_hw_queues(info->rq);
>   		blk_mark_disk_dead(info->gd);
> -		set_capacity(info->gd, 0);
>   	}
>   
>   	for_each_rinfo(info, rinfo, i) {
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 059737c1a2c19..44a5321743128 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -5106,10 +5106,7 @@ static void nvme_stop_ns_queue(struct nvme_ns *ns)
>   /*
>    * Prepare a queue for teardown.
>    *
> - * This must forcibly unquiesce queues to avoid blocking dispatch, and only set
> - * the capacity to 0 after that to avoid blocking dispatchers that may be
> - * holding bd_butex.  This will end buffered writers dirtying pages that can't
> - * be synced.
> + * This must forcibly unquiesce queues to avoid blocking dispatch.
>    */
>   static void nvme_set_queue_dying(struct nvme_ns *ns)
>   {
> @@ -5118,8 +5115,6 @@ static void nvme_set_queue_dying(struct nvme_ns *ns)
>   
>   	blk_mark_disk_dead(ns->disk);
>   	nvme_start_ns_queue(ns);
> -
> -	set_capacity_and_notify(ns->disk, 0);
>   }
>   
>   /**
> 

  parent reply	other threads:[~2022-10-21  1:53 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20 10:56 per-tagset SRCU struct and quiesce Christoph Hellwig
2022-10-20 10:56 ` [PATCH 1/8] block: set the disk capacity to 0 in blk_mark_disk_dead Christoph Hellwig
2022-10-20 13:16   ` Sagi Grimberg
2022-10-21  1:09   ` Ming Lei
2022-10-21 13:11     ` Christoph Hellwig
2022-10-21  1:53   ` Chao Leng [this message]
2022-10-21  6:49   ` Hannes Reinecke
2022-10-21 13:13     ` Christoph Hellwig
2022-10-21 21:12   ` Bart Van Assche
2022-10-20 10:56 ` [PATCH 2/8] blk-mq: skip non-mq queues in blk_mq_quiesce_queue Christoph Hellwig
2022-10-20 13:16   ` Sagi Grimberg
2022-10-21  1:13   ` Ming Lei
2022-10-21 13:19     ` Christoph Hellwig
2022-10-21 15:08       ` Ming Lei
2022-10-21  2:47   ` Chao Leng
2022-10-21  3:16     ` Chao Leng
2022-10-21  6:49   ` Hannes Reinecke
2022-10-20 10:56 ` [PATCH 3/8] blk-mq: move the srcu_struct used for quiescing to the tagset Christoph Hellwig
2022-10-20 13:23   ` Sagi Grimberg
2022-10-20 17:26   ` Keith Busch
2022-10-21 13:20     ` Christoph Hellwig
2022-10-21  1:41   ` Ming Lei
2022-10-21  2:49   ` Chao Leng
2022-10-21  6:50   ` Hannes Reinecke
2022-10-21  7:16   ` Chao Leng
2022-10-21 13:22     ` Christoph Hellwig
2022-10-20 10:56 ` [PATCH 4/8] blk-mq: pass a tagset to blk_mq_wait_quiesce_done Christoph Hellwig
2022-10-20 13:23   ` Sagi Grimberg
2022-10-21  1:46   ` Ming Lei
2022-10-21 13:23     ` Christoph Hellwig
2022-10-21  2:49   ` Chao Leng
2022-10-21  6:50   ` Hannes Reinecke
2022-10-21 21:18   ` Bart Van Assche
2022-10-20 10:56 ` [PATCH 5/8] blk-mq: add tagset quiesce interface Christoph Hellwig
2022-10-20 13:24   ` Sagi Grimberg
2022-10-21  1:53   ` Ming Lei
2022-10-21  2:49   ` Chao Leng
2022-10-21  6:51   ` Hannes Reinecke
2022-10-21 21:22   ` Bart Van Assche
2022-10-24  1:57     ` Chao Leng
2022-10-24 13:35       ` Bart Van Assche
2022-10-25  1:38         ` Chao Leng
2022-10-20 10:56 ` [PATCH 6/8] nvme: move the NS_DEAD flag to the controller Christoph Hellwig
2022-10-20 13:30   ` Sagi Grimberg
2022-10-21 13:28     ` Christoph Hellwig
2022-10-24  8:43       ` Sagi Grimberg
2022-10-24  8:50         ` Sagi Grimberg
2022-10-21  2:49   ` Chao Leng
2022-10-21  6:51   ` Hannes Reinecke
2022-10-20 10:56 ` [PATCH 7/8] nvme: remove nvme_set_queue_dying Christoph Hellwig
2022-10-20 13:10   ` Sagi Grimberg
2022-10-21 13:29     ` Christoph Hellwig
2022-10-24  8:48       ` Sagi Grimberg
2022-10-21  2:50   ` Chao Leng
2022-10-21  6:52   ` Hannes Reinecke
2022-10-20 10:56 ` [PATCH 8/8] nvme: use blk_mq_[un]quiesce_tagset Christoph Hellwig
2022-10-20 13:35   ` Sagi Grimberg
2022-10-21  2:50   ` Chao Leng
2022-10-21  6:52   ` Hannes Reinecke
2022-10-20 13:16 ` per-tagset SRCU struct and quiesce Sagi Grimberg
2022-10-21 18:06 ` Keith Busch

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=e3ab9d31-7a9e-4bad-9a04-1f20845c6268@huawei.com \
    --to=lengchao@huawei.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=ming.lei@redhat.com \
    --cc=sagi@grimberg.me \
    /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 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.