]> www.infradead.org Git - users/sagi/nvme-cli.git/commit
nvme: fix maximum ANA log page length calculation
authorCaleb Sander Mateos <csander@purestorage.com>
Mon, 24 Jun 2024 21:31:39 +0000 (15:31 -0600)
committerDaniel Wagner <wagi@monom.org>
Tue, 25 Jun 2024 15:14:03 +0000 (17:14 +0200)
commit34f226c041ae5aa5ca38585cb35815a6dd96a162
treefbd94e26c05012ec54eae36e5fec351ffa41eede
parent9ce8e149593b9ec0ab5c1721a12e79e21db77851
nvme: fix maximum ANA log page length calculation

nvme ana-log only includes space for MNAN namespace IDs
in the allocated ANA log page buffer if bit 6 of ANACAP
in the Identify Controller structure isn't set.

But the specification says:
Bit 6 if set to '1', then the ANAGRPID field in the Identify Namespace
data structure (refer to the NVM Command Set Specification)
does not change while the namespace is attached to any controller

There is no suggestion that NSIDs won't be returned in the ANA log page.

However, we can exclude space for NSIDs from the allocated buffer
if the Get Log Page command is going to be sent with the RGO bit set,
i.e. the --groups argument is passed.

Therefore, use the libnvme helper nvme_get_ana_log_len_from_id_ctrl()
to calculate the maximum ANA log page length.
It ignores ANACAP and takes the RGO setting into account.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Fixes: bb269bdb5392 ("nvme-cli: add minimal ana-log page support")
nvme.c