]> git.baikalelectronics.ru Git - kernel.git/commit
nvmet: fix mar and mor off-by-one errors
authorDennis Maisenbacher <dennis.maisenbacher@wdc.com>
Tue, 6 Sep 2022 07:39:28 +0000 (09:39 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 7 Sep 2022 06:33:17 +0000 (08:33 +0200)
commit062753f3c908f2f2adc01c881e29e61779942312
tree1bd19c543d990b0da8368e722cafc88c4ef6b7f6
parent48ce4d1e14c045d51aff4fce17b6a3ea6501dace
nvmet: fix mar and mor off-by-one errors

Maximum Active Resources (MAR) and Maximum Open Resources (MOR) are 0's
based vales where a value of 0xffffffff indicates that there is no limit.

Decrement the values that are returned by bdev_max_open_zones and
bdev_max_active_zones as the block layer helpers are not 0's based.
A 0 returned by the block layer helpers indicates no limit, thus convert
it to 0xffffffff (U32_MAX).

Fixes: ffa08b52e6a2 ("nvmet: add ZBD over ZNS backend support")
Suggested-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Dennis Maisenbacher <dennis.maisenbacher@wdc.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/zns.c