[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH] virtio-blk: trivial code optimization
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-block] [PATCH] virtio-blk: trivial code optimization |
Date: |
Fri, 6 Nov 2015 10:35:55 +0000 |
User-agent: |
Mutt/1.5.23 (2015-06-09) |
On Fri, Nov 06, 2015 at 09:04:57AM +0800, address@hidden wrote:
> diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
> index 093e475..752586d 100644
> --- a/hw/block/virtio-blk.c
> +++ b/hw/block/virtio-blk.c
> @@ -409,18 +409,20 @@ void virtio_blk_submit_multireq(BlockBackend *blk,
> MultiReqBuffer *mrb)
> /* merge would exceed maximum number of IOVs */
> if (niov + req->qiov.niov > IOV_MAX) {
> merge = false;
> + goto unmerge;
> }
>
> /* merge would exceed maximum transfer length of backend device
> */
> if (req->qiov.size / BDRV_SECTOR_SIZE + nb_sectors >
> max_xfer_len) {
> merge = false;
> + goto unmerge;
> }
>
> /* requests are not sequential */
> if (sector_num + nb_sectors != req->sector_num) {
> merge = false;
> }
> -
> +unmerge:
C has a way of expressing this without gotos. Please use else if:
if (a) {
...
} else if (b) {
...
} else if (c) {
...
}
signature.asc
Description: PGP signature