nvme-pci: refactor nvme_pci_use_sgls
authorChristoph Hellwig <hch@lst.de>
Wed, 25 Jun 2025 11:35:00 +0000 (13:35 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 30 Jun 2025 21:50:32 +0000 (15:50 -0600)
commitde769c846ae42d7af00c081196aeb2ae1dbee13a
treefb3f46c5b7033fc18dc0adfb83264e933edb1dff
parent858299dc61603670823f8c1d62bf3fc7af44b18b
nvme-pci: refactor nvme_pci_use_sgls

Move the average segment size into a separate helper, and return a
tristate to distinguish the case where can use SGL vs where we have to
use SGLs.  This will allow the simplify the code and make more efficient
decisions in follow on changes.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Link: https://lore.kernel.org/r/20250625113531.522027-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/host/pci.c