]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
nvme: add from0based() helper
authorCaleb Sander Mateos <csander@purestorage.com>
Fri, 27 Feb 2026 20:23:50 +0000 (13:23 -0700)
committerKeith Busch <kbusch@kernel.org>
Fri, 27 Mar 2026 14:35:04 +0000 (07:35 -0700)
commitb465046c8cca9e418c7b39cfb41bb8e3b62f22f6
tree472bbc2e4070d760fad940ab0ee791e96c7b27b7
parent823340b7e877b410a814177360df34810878e916
nvme: add from0based() helper

The NVMe specifications are big fans of "0's based"/"0-based" fields for
encoding values that must be positive. The encoded value is 1 less than
the value it represents. nvmet already provides a helper to0based() for
encoding 0's based values, so add a corresponding helper to decode these
fields on the host side.

Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/nvme.h