linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Daniel Wagner <dwagner@suse.de>
Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
	Keith Busch <kbusch@kernel.org>, Christoph Hellwig <hch@lst.de>,
	Sagi Grimberg <sagi@grimberg.me>, Hannes Reinecke <hare@suse.de>
Subject: Re: [RFC v2 2/3] nvme: move ns id info to struct nvme_ns_head
Date: Mon, 4 Dec 2023 08:51:34 +0100	[thread overview]
Message-ID: <20231204075134.GB29377@lst.de> (raw)
In-Reply-To: <20231201092735.28592-3-dwagner@suse.de>

> +	if (head) {
>  		pr_err_ratelimited("%s: %s(0x%x) @ LBA %llu, %llu blocks, %s (sct 0x%x / sc 0x%x) %s%s\n",
> -		       ns->disk ? ns->disk->disk_name : "?",
> +		       head->disk ? head->disk->disk_name : "?",
>  		       nvme_get_opcode_str(nr->cmd->common.opcode),
>  		       nr->cmd->common.opcode,
> -		       (unsigned long long)nvme_sect_to_lba(ns, blk_rq_pos(req)),
> -		       (unsigned long long)blk_rq_bytes(req) >> ns->lba_shift,
> +		       (unsigned long long)nvme_sect_to_lba(head, blk_rq_pos(req)),

Please avoid the overly long line here.  Best done by removing the pointless
unsigned long long casts, as u64 is always an unsigned long long in the
kernel these days.

> -			u64 slba = nvme_sect_to_lba(ns, bio->bi_iter.bi_sector);
> -			u32 nlb = bio->bi_iter.bi_size >> ns->lba_shift;
> +			u64 slba = nvme_sect_to_lba(head, bio->bi_iter.bi_sector);

Please avoid the overly long line here as well.

> +static void nvme_set_ref_tag(struct nvme_ns_head *head, struct nvme_command *cmnd,

.. and here.  I'm going to stop now, please also fix up all other
places.

>  void nvme_failover_req(struct request *req)
>  {
> -	struct nvme_ns *ns = req->q->queuedata;
> +	struct nvme_ns_head *head = req->q->queuedata;
> +	struct nvme_ctrl *ctrl = nvme_req(req)->ctrl;
> +	struct nvme_ns *ns;
>  	u16 status = nvme_req(req)->status & 0x7ff;
>  	unsigned long flags;
>  	struct bio *bio;
>  
> -	nvme_mpath_clear_current_path(ns);
> +	nvme_mpath_clear_current_path(head);
>  
>  	/*
>  	 * If we got back an ANA error, we know the controller is alive but not
>  	 * ready to serve this namespace.  Kick of a re-read of the ANA
>  	 * information page, and just try any other available path for now.
>  	 */
> -	if (nvme_is_ana_error(status) && ns->ctrl->ana_log_buf) {
> +	if (nvme_is_ana_error(status) && ctrl->ana_log_buf) {
> +		ns = nvme_find_get_ns(ctrl, head->ns_id);

This looks unrelated.

> -bool nvme_mpath_clear_current_path(struct nvme_ns *ns)
> +bool nvme_mpath_clear_current_path(struct nvme_ns_head *head)
>  {
> -	struct nvme_ns_head *head = ns->head;
>  	bool changed = false;
>  	int node;
>  
> @@ -181,7 +183,7 @@ bool nvme_mpath_clear_current_path(struct nvme_ns *ns)
>  		goto out;
>  
>  	for_each_node(node) {
> -		if (ns == rcu_access_pointer(head->current_path[node])) {
> +		if (head == rcu_access_pointer(head->current_path[node])->head) {

and this can't work.  We need to check the actual ns for the path
selection, as that's kindof the point.



  reply	other threads:[~2023-12-04  7:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01  9:27 [RFC v2 0/3] nvme: add csi, ms and nuse to sysfs Daniel Wagner
2023-12-01  9:27 ` [RFC v2 1/3] nvme: lookup ctrl from request instead from namespace Daniel Wagner
2023-12-04  7:46   ` Christoph Hellwig
2023-12-04  8:24   ` Sagi Grimberg
2023-12-01  9:27 ` [RFC v2 2/3] nvme: move ns id info to struct nvme_ns_head Daniel Wagner
2023-12-04  7:51   ` Christoph Hellwig [this message]
2023-12-04 10:41     ` Daniel Wagner
2023-12-04  8:30   ` Sagi Grimberg
2023-12-04 10:56     ` Daniel Wagner
2023-12-01  9:27 ` [RFC v2 3/3] nvme: add csi, ms and nuse to sysfs Daniel Wagner
2023-12-04  8:48   ` Sagi Grimberg
2023-12-05  6:02   ` Chaitanya Kulkarni

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=20231204075134.GB29377@lst.de \
    --to=hch@lst.de \
    --cc=dwagner@suse.de \
    --cc=hare@suse.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --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 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).