From: Coly Li <colyli@suse.de>
To: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>
Cc: Song Liu <song@kernel.org>, Ulf Hansson <ulf.hansson@linaro.org>,
Luis Chamberlain <mcgrof@kernel.org>,
linux-block@vger.kernel.org, linux-bcache@vger.kernel.org,
linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org,
linux-nvme@lists.infradead.org
Subject: Re: [PATCH 7/8] bcache: move the del_gendisk call out of bcache_device_free
Date: Thu, 12 Aug 2021 16:38:34 +0800 [thread overview]
Message-ID: <7ec809f8-c3d0-c3ad-8b2f-4b8d34b688ab@suse.de> (raw)
In-Reply-To: <20210809064028.1198327-8-hch@lst.de>
On 8/9/21 2:40 PM, Christoph Hellwig wrote:
> Let the callers call del_gendisk so that we can check if add_disk
> has been called properly for the cached device case instead of relying
> on the block layer internal GENHD_FL_UP flag.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
It looks good to me.
Reviewed-by: Coly Li <colyli@suse.de>
Thanks.
Coly Li
> ---
> drivers/md/bcache/super.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index d0f08e946453..f2874c77ff79 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -885,11 +885,6 @@ static void bcache_device_free(struct bcache_device *d)
> bcache_device_detach(d);
>
> if (disk) {
> - bool disk_added = (disk->flags & GENHD_FL_UP) != 0;
> -
> - if (disk_added)
> - del_gendisk(disk);
> -
> blk_cleanup_disk(disk);
> ida_simple_remove(&bcache_device_idx,
> first_minor_to_idx(disk->first_minor));
> @@ -1371,8 +1366,10 @@ static void cached_dev_free(struct closure *cl)
>
> mutex_lock(&bch_register_lock);
>
> - if (atomic_read(&dc->running))
> + if (atomic_read(&dc->running)) {
> bd_unlink_disk_holder(dc->bdev, dc->disk.disk);
> + del_gendisk(dc->disk.disk);
> + }
> bcache_device_free(&dc->disk);
> list_del(&dc->list);
>
> @@ -1518,6 +1515,7 @@ static void flash_dev_free(struct closure *cl)
> mutex_lock(&bch_register_lock);
> atomic_long_sub(bcache_dev_sectors_dirty(d),
> &d->c->flash_dev_dirty_sectors);
> + del_gendisk(d->disk);
> bcache_device_free(d);
> mutex_unlock(&bch_register_lock);
> kobject_put(&d->kobj);
next prev parent reply other threads:[~2021-08-12 8:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-09 6:40 remove GENHD_FL_UP Christoph Hellwig
2021-08-09 6:40 ` [PATCH 1/8] mmc: block: let device_add_disk create disk attributes Christoph Hellwig
2021-08-09 11:30 ` Ulf Hansson
2021-08-09 6:40 ` [PATCH 2/8] mmc: block: cleanup gendisk creation Christoph Hellwig
2021-08-09 11:30 ` Ulf Hansson
2021-08-09 6:40 ` [PATCH 3/8] nvme: remove the GENHD_FL_UP check in nvme_ns_remove Christoph Hellwig
2021-08-09 6:40 ` [PATCH 4/8] nvme: replace the GENHD_FL_UP check in nvme_mpath_shutdown_disk Christoph Hellwig
2021-08-09 6:40 ` [PATCH 5/8] sx8: use the internal state machine to check if del_gendisk needs to be called Christoph Hellwig
2021-08-09 6:40 ` [PATCH 6/8] bcache: add proper error unwinding in bcache_device_init Christoph Hellwig
2021-08-12 15:48 ` Coly Li
2021-08-09 6:40 ` [PATCH 7/8] bcache: move the del_gendisk call out of bcache_device_free Christoph Hellwig
2021-08-12 8:38 ` Coly Li [this message]
2021-08-09 6:40 ` [PATCH 8/8] block: remove GENHD_FL_UP Christoph Hellwig
2021-08-12 16:30 ` 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=7ec809f8-c3d0-c3ad-8b2f-4b8d34b688ab@suse.de \
--to=colyli@suse.de \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-raid@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=song@kernel.org \
--cc=ulf.hansson@linaro.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).