From: Christoph Hellwig <hch@lst.de>
To: Yao Sang <sangyao@kylinos.cn>
Cc: kbusch@kernel.org, linux-nvme@lists.infradead.org,
axboe@kernel.dk, hch@lst.de, sagi@grimberg.me
Subject: Re: [PATCH v2] nvme: fix command effects log lifetime for multipath heads
Date: Fri, 18 Sep 2026 14:36:44 +0200 [thread overview]
Message-ID: <20260918123644.GA17165@lst.de> (raw)
In-Reply-To: <20260831075716.41711-1-sangyao@kylinos.cn>
On Mon, Aug 31, 2026 at 03:57:16PM +0800, Yao Sang wrote:
> -static int nvme_get_effects_log(struct nvme_ctrl *ctrl, u8 csi,
> - struct nvme_effects_log **log)
> +static int nvme_read_effects_log(struct nvme_ctrl *ctrl, u8 csi,
> + struct nvme_effects_log **log)
What is the reason for splitting this function? It might or
might now be useful, but it distracts a bit from the actual
bug fix.
> -static int nvme_init_effects_log(struct nvme_ctrl *ctrl,
> - u8 csi, struct nvme_effects_log **log)
> +static void nvme_init_known_nvm_effects(struct nvme_effects_log *log)
> {
> - struct nvme_effects_log *effects, *old;
> -
> - effects = kzalloc_obj(*effects);
> - if (!effects)
> - return -ENOMEM;
> -
> - old = xa_store(&ctrl->cels, csi, effects, GFP_KERNEL);
> - if (xa_is_err(old)) {
> - kfree(effects);
> - return xa_err(old);
> - }
> -
> - *log = effects;
> - return 0;
> -}
> -
> -static void nvme_init_known_nvm_effects(struct nvme_ctrl *ctrl)
> -{
> - struct nvme_effects_log *log = ctrl->effects;
> -
> log->acs[nvme_admin_format_nvm] |= cpu_to_le32(NVME_CMD_EFFECTS_LBCC |
> NVME_CMD_EFFECTS_NCC |
> NVME_CMD_EFFECTS_CSE_MASK);
> @@ -3550,25 +3553,41 @@ static void nvme_init_known_nvm_effects(struct nvme_ctrl *ctrl)
>
> static int nvme_init_effects(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
> {
> + struct nvme_effects_log *cel;
> int ret = 0;
>
> - if (ctrl->effects)
> - return 0;
> + mutex_lock(&ctrl->subsys->lock);
> + cel = xa_load(&ctrl->subsys->cels, NVME_CSI_NVM);
> + if (cel)
> + goto out_set_effects;
>
> if (id->lpa & NVME_CTRL_LPA_CMD_EFFECTS_LOG) {
> - ret = nvme_get_effects_log(ctrl, NVME_CSI_NVM, &ctrl->effects);
> + ret = nvme_read_effects_log(ctrl, NVME_CSI_NVM, &cel);
> if (ret < 0)
> - return ret;
> + goto out_unlock;
> }
>
> - if (!ctrl->effects) {
> - ret = nvme_init_effects_log(ctrl, NVME_CSI_NVM, &ctrl->effects);
> - if (ret < 0)
> - return ret;
> + if (!cel) {
> + cel = kzalloc_obj(*cel);
> + if (!cel) {
> + ret = -ENOMEM;
> + goto out_unlock;
> + }
> + ret = 0;
I also really do not understand the change here.
While the high-level idea looks good, this really needs to be
split into finer grade and well-documented patches that can be
easily understood.
prev parent reply other threads:[~2026-09-18 12:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 7:57 [PATCH v2] nvme: fix command effects log lifetime for multipath heads Yao Sang
2026-09-18 12:36 ` Christoph Hellwig [this message]
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=20260918123644.GA17165@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
--cc=sangyao@kylinos.cn \
/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.