nvme: only use power of two io boundaries
authorKeith Busch <kbusch@kernel.org>
Thu, 27 Aug 2020 17:38:57 +0000 (10:38 -0700)
committerSagi Grimberg <sagi@grimberg.me>
Fri, 28 Aug 2020 23:43:57 +0000 (16:43 -0700)
commite83d776f9f98b4af18d67f05f9d1f3042dbe62c7
treeacff2f2d7843fb0f2a3d8dfebc4642e0f67df63c
parent192f6c29bb28bfd0a17e6ad331d09f1ec84143d0
nvme: only use power of two io boundaries

The kernel requires a power of two for boundaries because that's the
only way it can efficiently split commands that cross them. A
controller, however, may report a non-power of two boundary.

The driver had been rounding the controller's value to one the kernel
can use, but splitting on the wrong boundary provides no benefit on the
device side, and incurs additional submission overhead from non-optimal
splits.

Don't provide any boundary hint if the controller's value can't be used
and log a warning when first scanning a disk's unreported IO boundary.
Since the chunk sector logic has grown, move it to a separate function.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
drivers/nvme/host/core.c