From: Christoph Hellwig <hch@lst.de>
To: Jeremy Allison <jallison@ciq.com>
Cc: jra@samba.org, tansuresh@google.com, hch@lst.de,
gregkh@linuxfoundation.org, rafael@kernel.org,
bhelgaas@google.com, sagi@grimberg.me, djeffery@redhat.com,
linux-nvme@lists.infradead.org
Subject: Re: [PATCH 4/5] nvme: Add a new exported function nvme_ctrl_shutdown_start()
Date: Mon, 12 Feb 2024 08:07:08 +0100 [thread overview]
Message-ID: <20240212070708.GB17718@lst.de> (raw)
In-Reply-To: <20240207214044.2374295-5-jallison@ciq.com>
Normally we'd just say add a new helper instead of exported function.
On Wed, Feb 07, 2024 at 01:40:43PM -0800, Jeremy Allison wrote:
> Sets the shutdown bit but doesn't wait for ready.
> Use from nvme_disable_ctrl(). Export nvme_wait_ready()
> so we can call it from drivers/nvme/host/pci.c.
The nvme_wait_ready export seems unrelated to the nvme_disable_ctrl
changes. But looking at the next patch, it seems like a helper that
wraps nvme_wait_ready with the shutdown-specific flags would seem
useful over open coding them anyway.
>
> int nvme_disable_ctrl(struct nvme_ctrl *ctrl, bool shutdown)
> {
> int ret;
>
> - ctrl->ctrl_config &= ~NVME_CC_SHN_MASK;
> - if (shutdown)
> - ctrl->ctrl_config |= NVME_CC_SHN_NORMAL;
> - else
> + if (shutdown) {
> + ret = nvme_ctrl_shutdown_start(ctrl);
> + } else {
> + ctrl->ctrl_config &= ~NVME_CC_SHN_MASK;
> ctrl->ctrl_config &= ~NVME_CC_ENABLE;
> + ret = ctrl->ops->reg_write32(ctrl, NVME_REG_CC, ctrl->ctrl_config);
Please avoid the overly long line here.
Looking at the result after the series, nvme_disable_ctrl now has two
entirely separate code flows for the shutdown vs !shutdown case. To me
this suggested we should just split it into a nvme_disable_ctrl that does
the non-shutdown disable, and a nvme_shutdown_ctl that does
nvme_ctrl_shutdown_start + the shutdown version of nvme_wait_ready and
let the callers do the 'if (shutdown)' for the cases where it is needed.
next prev parent reply other threads:[~2024-02-12 7:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-07 21:40 Make NVME shutdown two-pass - Version 6 Jeremy Allison
2024-02-07 21:40 ` [PATCH 1/5] driver core: Support two-pass driver shutdown Jeremy Allison
2024-02-07 21:40 ` [PATCH 2/5] PCI: Support two-pass shutdown Jeremy Allison
2024-02-07 21:59 ` Bjorn Helgaas
2024-02-07 22:02 ` Jeremy Allison
2024-02-07 21:40 ` [PATCH 3/5] nvme: Change 'bool shutdown' to an enum shutdown_type in nvme_dev_disable() Jeremy Allison
2024-02-12 7:01 ` Christoph Hellwig
2024-02-07 21:40 ` [PATCH 4/5] nvme: Add a new exported function nvme_ctrl_shutdown_start() Jeremy Allison
2024-02-12 7:07 ` Christoph Hellwig [this message]
2024-02-07 21:40 ` [PATCH 5/5] nvme: Add two-pass shutdown support Jeremy Allison
2024-02-12 7:08 ` Christoph Hellwig
2024-02-07 22:00 ` Make NVME shutdown two-pass - Version 6 Bjorn Helgaas
2024-02-07 22:03 ` Jeremy Allison
2024-02-08 18:02 ` David Jeffery
2024-02-08 18:28 ` Jeremy Allison
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=20240212070708.GB17718@lst.de \
--to=hch@lst.de \
--cc=bhelgaas@google.com \
--cc=djeffery@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=jallison@ciq.com \
--cc=jra@samba.org \
--cc=linux-nvme@lists.infradead.org \
--cc=rafael@kernel.org \
--cc=sagi@grimberg.me \
--cc=tansuresh@google.com \
/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