All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Keith Busch <kbusch@meta.com>
Cc: linux-nvme@lists.infradead.org, hch@lst.de, m@bjorling.me,
	matias.bjorling@wdc.com, Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCHv3 07/11] nvmet: implement endurance groups
Date: Wed, 6 Nov 2024 06:55:20 +0100	[thread overview]
Message-ID: <20241106055520.GA31635@lst.de> (raw)
In-Reply-To: <20241105174904.3612888-8-kbusch@meta.com>

On Tue, Nov 05, 2024 at 09:49:00AM -0800, Keith Busch wrote:
> +static void nvmet_execute_get_log_page_endgrp(struct nvmet_req *req)
> +{
> +	u64 host_reads, host_writes, data_units_read, data_units_written;
> +	struct nvme_endurance_group_log *log;
> +	u16 status;
> +
> +	req->cmd->common.nsid = cpu_to_le32((u32)
> +				le16_to_cpu(req->cmd->get_log_page.lsi));
> +	status = nvmet_req_find_ns(req);

I think this would be a good place to point out that we "emulate" one
endurance group per namespace, as the code only make sense with that
in mind.

As far as I can tell cpu_to_* does all the normal implicit integer
conversions, so the case here and the ones further down should not be
needed.

> +	host_reads = part_stat_read(req->ns->bdev, ios[READ]);
> +	data_units_read =
> +		DIV_ROUND_UP(part_stat_read(req->ns->bdev, sectors[READ]), 1000);
> +	host_writes = part_stat_read(req->ns->bdev, ios[WRITE]);
> +	data_units_written =
> +		DIV_ROUND_UP(part_stat_read(req->ns->bdev, sectors[WRITE]), 1000);

Overly long lines, but IMHO this would read nicer anyway if the
round is done later, e.g.:

	sectors_written = part_stat_read(req->ns->bdev, sectors[WRITE]);

	...

	put_unaligned_le64(DIV_ROUND_UP(sectors_written, 1000), &log->dur[0]);


> +	xa_for_each(&ctrl->subsys->namespaces, idx, ns) {
> +		if (ns->nsid <= min_endgid)
> +			continue;
> +
> +		list[i++] = cpu_to_le16((u16)ns->nsid);
> +		if (i == buf_size / sizeof(__le16))
> +			break;
> +	}

No really important, but this could use xas_for_each for avoid
doing a full lookup on every iteration.



  parent reply	other threads:[~2024-11-06  5:55 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05 17:48 [PATCHv3 00/11] Rotational storage support Keith Busch
2024-11-05 17:48 ` [PATCHv3 01/11] nvmet: implement id ns for nvm command set Keith Busch
2024-11-06  5:05   ` Chaitanya Kulkarni
2024-11-06  5:38   ` Christoph Hellwig
2024-11-07  0:30     ` Keith Busch
2024-11-05 17:48 ` [PATCHv3 02/11] nvmet: implement active command set ns list Keith Busch
2024-11-06  5:06   ` Chaitanya Kulkarni
2024-11-06  5:38   ` Christoph Hellwig
2024-11-05 17:48 ` [PATCHv3 03/11] nvmet: implement supported log pages Keith Busch
2024-11-06  4:24   ` Kanchan Joshi
2024-11-06  5:16   ` Chaitanya Kulkarni
2024-11-06  5:18     ` Chaitanya Kulkarni
2024-11-06  5:39   ` Christoph Hellwig
2024-11-05 17:48 ` [PATCHv3 04/11] nvmet: implement supported features log Keith Busch
2024-11-06  5:19   ` Chaitanya Kulkarni
2024-11-06  5:43   ` Christoph Hellwig
2024-11-05 17:48 ` [PATCHv3 05/11] nvmet: implement crto property Keith Busch
2024-11-06  5:43   ` Christoph Hellwig
2024-11-05 17:48 ` [PATCHv3 06/11] nvmet: declare 2.1 version compliance Keith Busch
2024-11-06  5:20   ` Chaitanya Kulkarni
2024-11-06  5:45   ` Christoph Hellwig
2024-11-06  6:13     ` Chaitanya Kulkarni
2024-11-05 17:49 ` [PATCHv3 07/11] nvmet: implement endurance groups Keith Busch
2024-11-06  5:23   ` Chaitanya Kulkarni
2024-11-06  5:55   ` Christoph Hellwig [this message]
2024-11-05 17:49 ` [PATCHv3 08/11] nvmet: implement rotational media information log Keith Busch
2024-11-06  5:56   ` Christoph Hellwig
2024-11-05 17:49 ` [PATCHv3 09/11] nvmet: support for csi identify ns Keith Busch
2024-11-06  5:46   ` Guixin Liu
2024-11-05 17:49 ` [PATCHv3 10/11] nvme: make independent ns identify default Keith Busch
2024-11-05 20:29   ` Keith Busch
2024-11-06  5:57   ` Christoph Hellwig
2024-11-05 17:49 ` [PATCHv3 11/11] nvme: add rotational support Keith Busch
2024-11-06  5:58   ` Christoph Hellwig
2024-11-06  6:15   ` Chaitanya Kulkarni
2024-11-06  7:57   ` Guixin Liu
2024-11-06  8:22     ` Christoph Hellwig
2024-11-07  0:35       ` 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=20241106055520.GA31635@lst.de \
    --to=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=kbusch@meta.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=m@bjorling.me \
    --cc=matias.bjorling@wdc.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 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.