]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
nvmet: add unlikely check at nvmet_req_alloc_sgl
authorIsrael Rukshin <israelr@mellanox.com>
Sun, 13 Oct 2019 16:57:33 +0000 (19:57 +0300)
committerJens Axboe <axboe@kernel.dk>
Mon, 4 Nov 2019 17:56:40 +0000 (10:56 -0700)
The call to sgl_alloc shouldn't fail so add this simple optimization to
the fast path.

Signed-off-by: Israel Rukshin <israelr@mellanox.com>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/target/core.c

index 3a67e244e5685a35f65e24e322f85b9557bba37d..6b39cfc6ade19e189e376b3ce7fb7ba4d5573bae 100644 (file)
@@ -966,7 +966,7 @@ int nvmet_req_alloc_sgl(struct nvmet_req *req)
        }
 
        req->sg = sgl_alloc(req->transfer_len, GFP_KERNEL, &req->sg_cnt);
-       if (!req->sg)
+       if (unlikely(!req->sg))
                return -ENOMEM;
 
        return 0;