qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/4] block: immediately cancel oversized read/wr


From: Benoît Canet
Subject: Re: [Qemu-devel] [PATCH 2/4] block: immediately cancel oversized read/write requests
Date: Mon, 8 Sep 2014 15:44:34 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

The Friday 05 Sep 2014 à 18:51:26 (+0200), Peter Lieven wrote :
> Signed-off-by: Peter Lieven <address@hidden>
> ---
>  block.c |   14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/block.c b/block.c
> index 2c4a5de..fa4c34b 100644
> --- a/block.c
> +++ b/block.c
> @@ -3215,6 +3215,13 @@ static int coroutine_fn 
> bdrv_co_do_readv(BlockDriverState *bs,
>          return -EINVAL;
>      }
>  
> +    if (bs->bl.max_transfer_length && nb_sectors > 
> bs->bl.max_transfer_length) {
> +        error_report("read of %d sectors at sector %ld exceeds device max"
> +                     " transfer length of %d sectors.", nb_sectors, 
> sector_num,
> +                     bs->bl.max_transfer_length);
> +        return -EINVAL;
> +    }
> +
>      return bdrv_co_do_preadv(bs, sector_num << BDRV_SECTOR_BITS,
>                               nb_sectors << BDRV_SECTOR_BITS, qiov, flags);
>  }
> @@ -3507,6 +3514,13 @@ static int coroutine_fn 
> bdrv_co_do_writev(BlockDriverState *bs,
>          return -EINVAL;
>      }
>  
> +    if (bs->bl.max_transfer_length && nb_sectors > 
> bs->bl.max_transfer_length) {
> +        error_report("write of %d sectors at sector %ld exceeds device max"
> +                     " transfer length of %d sectors.", nb_sectors, 
> sector_num,
> +                     bs->bl.max_transfer_length);
> +        return -EINVAL;
> +    }
> +
>      return bdrv_co_do_pwritev(bs, sector_num << BDRV_SECTOR_BITS,
>                                nb_sectors << BDRV_SECTOR_BITS, qiov, flags);
>  }
> -- 
> 1.7.9.5
> 
> 

Look like you are changing the coroutine version.

Some hardware like virtio-blk uses the AIO version of read and writes.
What would happen if all the block drivers down the chain are AIO enabled ?

Best regards

Benoît



reply via email to

[Prev in Thread] Current Thread [Next in Thread]