From: Klaus Jensen <its@irrelevant.dk>
To: Joel Granados <j.granados@samsung.com>
Cc: k.jensen@samsung.com, qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [PATCH v2 1/3] nvme: Move adjustment of data_units{read,written}
Date: Tue, 15 Nov 2022 12:09:52 +0100 [thread overview]
Message-ID: <Y3NzgHYczS+K2KFR@cormorant.local> (raw)
In-Reply-To: <20221114135043.2958100-2-j.granados@samsung.com>
[-- Attachment #1: Type: text/plain, Size: 2398 bytes --]
On Nov 14 14:50, Joel Granados wrote:
> In order to return the units_{read/written} required by the SMART log we
> need to shift the number of bytes value by BDRV_SECTORS_BITS and multiply
> by 1000. This is a prep patch that moves this adjustment to where the SMART
> log is calculated in order to use the stats struct for calculating OCP
> extended smart log values.
>
> Signed-off-by: Joel Granados <j.granados@samsung.com>
> ---
> hw/nvme/ctrl.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
> index 87aeba0564..220683201a 100644
> --- a/hw/nvme/ctrl.c
> +++ b/hw/nvme/ctrl.c
> @@ -4449,8 +4449,8 @@ static void nvme_set_blk_stats(NvmeNamespace *ns, struct nvme_stats *stats)
> {
> BlockAcctStats *s = blk_get_stats(ns->blkconf.blk);
>
> - stats->units_read += s->nr_bytes[BLOCK_ACCT_READ] >> BDRV_SECTOR_BITS;
> - stats->units_written += s->nr_bytes[BLOCK_ACCT_WRITE] >> BDRV_SECTOR_BITS;
> + stats->units_read += s->nr_bytes[BLOCK_ACCT_READ];
> + stats->units_written += s->nr_bytes[BLOCK_ACCT_WRITE];
> stats->read_commands += s->nr_ops[BLOCK_ACCT_READ];
> stats->write_commands += s->nr_ops[BLOCK_ACCT_WRITE];
> }
> @@ -4490,10 +4490,12 @@ static uint16_t nvme_smart_info(NvmeCtrl *n, uint8_t rae, uint32_t buf_len,
> trans_len = MIN(sizeof(smart) - off, buf_len);
> smart.critical_warning = n->smart_critical_warning;
>
> - smart.data_units_read[0] = cpu_to_le64(DIV_ROUND_UP(stats.units_read,
> - 1000));
> - smart.data_units_written[0] = cpu_to_le64(DIV_ROUND_UP(stats.units_written,
> - 1000));
> + smart.data_units_read[0] = cpu_to_le64(DIV_ROUND_UP(
> + stats.units_read >> BDRV_SECTOR_BITS,
> + 1000));
> + smart.data_units_written[0] = cpu_to_le64(DIV_ROUND_UP(
> + stats.units_written >> BDRV_SECTOR_BITS,
> + 1000));
> smart.host_read_commands[0] = cpu_to_le64(stats.read_commands);
> smart.host_write_commands[0] = cpu_to_le64(stats.write_commands);
>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-11-15 11:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20221114135426eucas1p271a54e44af5a53a45a7393ed34585ee0@eucas1p2.samsung.com>
2022-11-14 13:50 ` [PATCH v2 0/3] Add OCP extended log to nvme QEMU Joel Granados
2022-11-14 13:50 ` [PATCH v2 1/3] nvme: Move adjustment of data_units{read,written} Joel Granados
2022-11-15 11:09 ` Klaus Jensen [this message]
2022-11-14 13:50 ` [PATCH v2 2/3] nvme: Add ocp to the subsys Joel Granados
2022-11-15 11:11 ` Klaus Jensen
2022-11-16 15:02 ` Joel Granados
2022-11-14 13:50 ` [PATCH v2 3/3] nvme: Add physical writes/reads from OCP log Joel Granados
2022-11-15 11:26 ` Klaus Jensen
2022-11-16 16:19 ` Joel Granados
2022-11-17 6:36 ` Klaus Jensen
2022-12-23 7:39 ` [PATCH v2 0/3] Add OCP extended log to nvme QEMU Christoph Hellwig
2023-01-04 14:43 ` Joel Granados
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=Y3NzgHYczS+K2KFR@cormorant.local \
--to=its@irrelevant.dk \
--cc=j.granados@samsung.com \
--cc=k.jensen@samsung.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.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 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.