diff mbox series

[1/1] virtio-blk: remove unneeded "likely" statements

Message ID 20210830120111.22661-1-mgurtovoy@nvidia.com (mailing list archive)
State New, archived
Headers show
Series [1/1] virtio-blk: remove unneeded "likely" statements | expand

Commit Message

Max Gurtovoy Aug. 30, 2021, 12:01 p.m. UTC
Usually we use "likely/unlikely" to optimize the fast path. Remove
redundant "likely" statements in the control path to ease on the code.

Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
---
 drivers/block/virtio_blk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stefan Hajnoczi Sept. 2, 2021, 3 p.m. UTC | #1
On Mon, Aug 30, 2021 at 03:01:11PM +0300, Max Gurtovoy wrote:
> Usually we use "likely/unlikely" to optimize the fast path. Remove
> redundant "likely" statements in the control path to ease on the code.
> 
> Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
> ---
>  drivers/block/virtio_blk.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

It would be nice to tweak the commit description before merging this. I
had trouble parsing the second sentence. If I understand correctly the
purpose of this patch is to make the code simpler and easier to read:

  s/ease on the code/simplify the code and make it easier to read/

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Max Gurtovoy Sept. 2, 2021, 7:13 p.m. UTC | #2
On 9/2/2021 6:00 PM, Stefan Hajnoczi wrote:
> On Mon, Aug 30, 2021 at 03:01:11PM +0300, Max Gurtovoy wrote:
>> Usually we use "likely/unlikely" to optimize the fast path. Remove
>> redundant "likely" statements in the control path to ease on the code.
>>
>> Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
>> ---
>>   drivers/block/virtio_blk.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
> It would be nice to tweak the commit description before merging this. I
> had trouble parsing the second sentence. If I understand correctly the
> purpose of this patch is to make the code simpler and easier to read:
>
>    s/ease on the code/simplify the code and make it easier to read/

I'm ok with this change in commit message.

MST,

can you apply this change if you'll pick this commit ?

-Max.

>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Michael S. Tsirkin Sept. 3, 2021, 9:04 a.m. UTC | #3
On Thu, Sep 02, 2021 at 10:13:04PM +0300, Max Gurtovoy wrote:
> 
> On 9/2/2021 6:00 PM, Stefan Hajnoczi wrote:
> > On Mon, Aug 30, 2021 at 03:01:11PM +0300, Max Gurtovoy wrote:
> > > Usually we use "likely/unlikely" to optimize the fast path. Remove
> > > redundant "likely" statements in the control path to ease on the code.
> > > 
> > > Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
> > > ---
> > >   drivers/block/virtio_blk.c | 4 ++--
> > >   1 file changed, 2 insertions(+), 2 deletions(-)
> > It would be nice to tweak the commit description before merging this. I
> > had trouble parsing the second sentence. If I understand correctly the
> > purpose of this patch is to make the code simpler and easier to read:
> > 
> >    s/ease on the code/simplify the code and make it easier to read/
> 
> I'm ok with this change in commit message.
> 
> MST,
> 
> can you apply this change if you'll pick this commit ?
> 
> -Max.


Just repost with a fixed commit log pls, easier for me.
Thanks!

> > 
> > Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
diff mbox series

Patch

diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index afb37aac09e8..e574fbf5e6df 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -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))
@@ -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);