[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCHv2 04/11] iscsi: add bdrv_co_write_zeroes
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCHv2 04/11] iscsi: add bdrv_co_write_zeroes |
Date: |
Wed, 10 Jul 2013 11:54:08 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 27.06.2013 um 15:11 hat Peter Lieven geschrieben:
> write zeroes is emulated by unmap if the target supports unmapping
> an unmapped blocks read as zero. this emulation is only done if the
> device was opened with BDRV_O_UNMAP and the request can be handled
> within a single request. a failback to writev is performed otherwise.
>
> Signed-off-by: Peter Lieven <address@hidden>
> ---
> block/iscsi.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
>
> diff --git a/block/iscsi.c b/block/iscsi.c
> index d31ee95..92e66a6 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -928,6 +928,49 @@ fail:
> return 0;
> }
>
> +static int
> +coroutine_fn iscsi_co_write_zeroes(BlockDriverState *bs, int64_t sector_num,
> + int nb_sectors)
> +{
> + IscsiLun *iscsilun = bs->opaque;
> + struct IscsiTask iTask;
> + struct unmap_list list[1];
Why declare an array when it's only one element anyway?
> + if (!iscsilun->lbprz || !iscsilun->lbpu || !(bs->open_flags &
> BDRV_O_UNMAP) ||
> + nb_sectors * BDRV_SECTOR_SIZE / iscsilun->block_size >
> iscsilun->max_unmap) {
The first part of this line is sector_qemu2lun().
> + /* fall back to writev */
> + return -ENOTSUP;
> + }
> +
> + iscsi_co_init_iscsitask(iscsilun, &iTask);
> +
> + list[0].lba = sector_qemu2lun(sector_num, iscsilun);
> + list[0].num = nb_sectors * BDRV_SECTOR_SIZE / iscsilun->block_size;
Same here.
Kevin
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCHv2 04/11] iscsi: add bdrv_co_write_zeroes,
Kevin Wolf <=