]> www.infradead.org Git - users/dwmw2/linux.git/commit
nvmet: support reservation feature
authorGuixin Liu <kanie@linux.alibaba.com>
Wed, 6 Nov 2024 07:34:46 +0000 (15:34 +0800)
committerKeith Busch <kbusch@kernel.org>
Mon, 11 Nov 2024 17:49:48 +0000 (09:49 -0800)
commit5a47c2080a7316f184107464e4f76737c0c05186
tree4ee4dfba433c68439646972b61ebd7f52e284667
parent1900e1a4495b7376cb9b4e58f1d846660f4c9c4b
nvmet: support reservation feature

This patch implements the reservation feature, including:
  1. reservation register(register, unregister and replace).
  2. reservation acquire(acquire, preempt, preempt and abort).
  3. reservation release(release and clear).
  4. reservation report.
  5. set feature and get feature of reservation notify mask.
  6. get log page of reservation event.

Not supported:
  1. persistent reservation through power loss.

Test cases:
  Use nvme-cli and fio to test all implemented sub features:
  1. use nvme resv-register to register host a registrant or
     unregister or replace a new key.
  2. use nvme resv-acquire to set host to the holder, and use fio
     to send read and write io in all reservation type. And also
     test preempt and "preempt and abort".
  3. use nvme resv-report to show all registrants and reservation
     status.
  4. use nvme resv-release to release all registrants.
  5. use nvme get-log to get events generated by the preceding
     operations.

In addition, make reservation configurable, one can set ns to
support reservation before enable ns. The default of resv_enable
is false.

Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Reviewed-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/target/Makefile
drivers/nvme/target/admin-cmd.c
drivers/nvme/target/configfs.c
drivers/nvme/target/core.c
drivers/nvme/target/fabrics-cmd.c
drivers/nvme/target/nvmet.h
drivers/nvme/target/pr.c [new file with mode: 0644]
include/linux/nvme.h