qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [sheepdog] [PATCH for QEMU v3] sheepdog: add discard/tr


From: MORITA Kazutaka
Subject: Re: [Qemu-devel] [sheepdog] [PATCH for QEMU v3] sheepdog: add discard/trim support for sheepdog
Date: Tue, 16 Apr 2013 00:10:52 +0900
User-agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/22.1 Mule/5.0 (SAKAKI)

At Sun, 14 Apr 2013 13:16:44 +0800,
Liu Yuan wrote:
> 
> From: Liu Yuan <address@hidden>
> 
> The 'TRIM' command from VM that is to release underlying data storage for
> better thin-provision is already supported by the Sheepdog.
> 
> This patch adds the TRIM support at QEMU part.
> 
> For older Sheepdog that doesn't support it, we return EIO to upper layer.

I think we can safely return 0 without doing anything when the server
doesn't support SD_OP_DISCARD.  Actually, if the block driver doesn't
support the discard operation, bdrv_co_discard() in block.c returns 0.


> diff --git a/block/sheepdog.c b/block/sheepdog.c
> index 987018e..e852d4e 100644
> --- a/block/sheepdog.c
> +++ b/block/sheepdog.c
> @@ -34,6 +34,7 @@
>  #define SD_OP_GET_VDI_INFO   0x14
>  #define SD_OP_READ_VDIS      0x15
>  #define SD_OP_FLUSH_VDI      0x16
> +#define SD_OP_DISCARD        0x17

This is an opcode for objects, so I prefer SD_OP_DISCARD_OBJ.

>  
> +static int sd_co_discard(BlockDriverState *bs, int64_t sector_num,
> +                         int nb_sectors)

Should add coroutine_fn.

Thanks,

Kazutaka



reply via email to

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