[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V19 7/8] add-cow file format core code.
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH V19 7/8] add-cow file format core code. |
Date: |
Wed, 5 Jun 2013 16:21:27 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Thu, May 30, 2013 at 06:00:24PM +0800, Dongxu Wang wrote:
> +static coroutine_fn int add_cow_co_writev(BlockDriverState *bs,
> + int64_t sector_num,
> + int remaining_sectors,
> + QEMUIOVector *qiov)
> +{
> + BDRVAddCowState *s = bs->opaque;
> + int ret = 0, i;
> + QEMUIOVector hd_qiov;
> + uint8_t *table;
> + uint64_t offset;
> + int mask = s->cluster_sectors - 1;
> + int cluster_mask = s->cluster_size - 1;
> + AddCowMeta *meta = NULL;
> +
> + if (remaining_sectors == 0) {
> + return ret;
> + }
> +
> + qemu_co_mutex_lock(&s->lock);
> +
> + meta = g_malloc0(sizeof(*meta));
> +again:
> + *meta = (AddCowMeta) {
> + .next = QLIST_FIRST(&s->cluster_allocs),
> + .start_sector = sector_num,
> + .remaining_sectors = remaining_sectors,
> + };
> + if (handle_dependencies(bs, sector_num, remaining_sectors) == -EAGAIN) {
> + goto again;
> + }
> + qemu_co_queue_init(&meta->dependent_requests);
> + QLIST_INSERT_HEAD(&s->cluster_allocs, meta, next_in_flight);
> + qemu_iovec_init(&hd_qiov, qiov->niov);
hd_qiov is unused.
> + ret = bdrv_co_writev(s->image_hd, sector_num, remaining_sectors, qiov);
s->lock is held so write requests block other requests, this is not
parallel.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH V19 7/8] add-cow file format core code.,
Stefan Hajnoczi <=