]> git.baikalelectronics.ru Git - kernel.git/commit
nvmet: cleanup nvmet_passthru_map_sg()
authorLogan Gunthorpe <logang@deltatee.com>
Fri, 16 Oct 2020 22:19:05 +0000 (16:19 -0600)
committerChristoph Hellwig <hch@lst.de>
Thu, 22 Oct 2020 13:28:02 +0000 (15:28 +0200)
commit6cfad644de55895733cb49cc0ec75e0f0ca24677
tree9dd5d8300c7ec5af92fe15492027363d6ed7f370
parent1db6c34a31c0e4b1d2b0e9d41fda8bed6c57ca8d
nvmet: cleanup nvmet_passthru_map_sg()

Clean up some confusing elements of nvmet_passthru_map_sg() by returning
early if the request is greater than the maximum bio size. This allows
us to drop the sg_cnt variable.

This should not result in any functional change but makes the code
clearer and more understandable. The original code allocated a truncated
bio then would return EINVAL when bio_add_pc_page() filled that bio. The
new code just returns EINVAL early if this would happen.

Fixes: ac4baeef388b ("nvmet: add passthru code to process commands")
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Suggested-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/passthru.c