qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 01/11] block: Add op blocker type "device IO"


From: Wen Congyang
Subject: Re: [Qemu-devel] [PATCH v2 01/11] block: Add op blocker type "device IO"
Date: Wed, 13 May 2015 19:32:52 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 05/14/2015 01:28 AM, Fam Zheng wrote:
> Preventing device from submitting IO is useful around various nested
> aio_poll. Op blocker is a good place to put this flag.
> 
> Devices would submit IO requests through blk_* block backend interface,
> which calls blk_check_request to check the validity. Return -EBUSY if
> the operation is blocked, which means device IO is temporarily disabled
> by another BDS user.
> 
> Signed-off-by: Fam Zheng <address@hidden>
> ---
>  block/block-backend.c | 4 ++++
>  include/block/block.h | 1 +
>  2 files changed, 5 insertions(+)
> 
> diff --git a/block/block-backend.c b/block/block-backend.c
> index 93e46f3..71fc695 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c
> @@ -478,6 +478,10 @@ static int blk_check_request(BlockBackend *blk, int64_t 
> sector_num,
>          return -EIO;
>      }
>  
> +    if (bdrv_op_is_blocked(blk->bs, BLOCK_OP_TYPE_DEVICE_IO, NULL)) {
> +        return -EBUSY;
> +    }
> +

The guest doesn't know this status, so how do we prevent it? If it
is virtio disk, you wait it, but if it is the other disks, what is
the behavior?

Thanks
Wen Congyang

>      return blk_check_byte_request(blk, sector_num * BDRV_SECTOR_SIZE,
>                                    nb_sectors * BDRV_SECTOR_SIZE);
>  }
> diff --git a/include/block/block.h b/include/block/block.h
> index 7d1a717..906fb31 100644
> --- a/include/block/block.h
> +++ b/include/block/block.h
> @@ -159,6 +159,7 @@ typedef enum BlockOpType {
>      BLOCK_OP_TYPE_RESIZE,
>      BLOCK_OP_TYPE_STREAM,
>      BLOCK_OP_TYPE_REPLACE,
> +    BLOCK_OP_TYPE_DEVICE_IO,
>      BLOCK_OP_TYPE_MAX,
>  } BlockOpType;
>  
> 




reply via email to

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