nvmet: add unlikely check at nvmet_req_alloc_sgl

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>
This commit is contained in:
Israel Rukshin 2019-10-13 19:57:33 +03:00 committed by Jens Axboe
parent 4d764bb9a9
commit e522f44602

View 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;