Skip to content

Commit

Permalink
virtio-blk: remove unneeded "likely" statements
Browse files Browse the repository at this point in the history
Usually we use "likely/unlikely" to optimize the fast path. Remove
redundant "likely/unlikely" statements in the control path to simplify
the code and make it easier to read.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Link: https://lore.kernel.org/r/20210905085717.7427-1-mgurtovoy@nvidia.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Chaitanya Kulkarni <ckulkarnilinux@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
  • Loading branch information
Max Gurtovoy authored and Michael S. Tsirkin committed Sep 6, 2021
1 parent 81a83d7 commit 6105d1f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/block/virtio_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ static int virtblk_probe(struct virtio_device *vdev)
goto out_free_vblk;

/* Default queue sizing is to fill the ring. */
if (likely(!virtblk_queue_depth)) {
if (!virtblk_queue_depth) {
queue_depth = vblk->vqs[0].vq->num_free;
/* ... but without indirect descs, we use 2 descs per req */
if (!virtio_has_feature(vdev, VIRTIO_RING_F_INDIRECT_DESC))
Expand Down Expand Up @@ -839,7 +839,7 @@ static int virtblk_probe(struct virtio_device *vdev)
else
blk_size = queue_logical_block_size(q);

if (unlikely(blk_size < SECTOR_SIZE || blk_size > PAGE_SIZE)) {
if (blk_size < SECTOR_SIZE || blk_size > PAGE_SIZE) {
dev_err(&vdev->dev,
"block size is changed unexpectedly, now is %u\n",
blk_size);
Expand Down

0 comments on commit 6105d1f

Please sign in to comment.