[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v8 5/9] block: treat BDRV_REQ_ALLOCATE as serial
From: |
Alberto Garcia |
Subject: |
Re: [Qemu-devel] [PATCH v8 5/9] block: treat BDRV_REQ_ALLOCATE as serialising |
Date: |
Mon, 19 Mar 2018 12:02:24 +0100 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
On Mon 12 Mar 2018 11:16:54 AM CET, Anton Nefedov wrote:
> The idea is that ALLOCATE requests may overlap with other requests.
> Reuse the existing block layer infrastructure for serialising requests.
> Use the following approach:
> - mark ALLOCATE serialising, so subsequent requests to the area wait
> - ALLOCATE request itself must never wait if another request is in flight
> already. Return EAGAIN, let the caller reconsider.
>
> Signed-off-by: Anton Nefedov <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
> @@ -1498,8 +1507,13 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild
> *child,
> max_transfer = QEMU_ALIGN_DOWN(MIN_NON_ZERO(bs->bl.max_transfer,
> INT_MAX),
> align);
>
> - waited = wait_serialising_requests(req);
> - assert(!waited || !req->serialising);
> + found = find_or_wait_serialising_requests(req,
> + !(flags & BDRV_REQ_ALLOCATE));
> + if (found && (flags & BDRV_REQ_ALLOCATE)) {
> + return -EAGAIN;
> + }
> +
Another alternative (perhaps a bit more readable):
if (flags & BDRV_REQ_ALLOCATE) {
if (find_or_wait_serialising_requests(req, false)) {
return -EAGAIN;
}
} else {
bool found = wait_serialising_requests(req);
assert(!found || !req->serialising);
}
but yours is fine, so keep it if you prefer.
Berto
- [Qemu-devel] [PATCH v8 1/9] mirror: inherit supported write/zero flags, (continued)
- [Qemu-devel] [PATCH v8 1/9] mirror: inherit supported write/zero flags, Anton Nefedov, 2018/03/12
- [Qemu-devel] [PATCH v8 3/9] quorum: set supported write/zero flags, Anton Nefedov, 2018/03/12
- [Qemu-devel] [PATCH v8 4/9] block: introduce BDRV_REQ_ALLOCATE flag, Anton Nefedov, 2018/03/12
- [Qemu-devel] [PATCH v8 6/9] file-posix: support BDRV_REQ_ALLOCATE, Anton Nefedov, 2018/03/12
- [Qemu-devel] [PATCH v8 5/9] block: treat BDRV_REQ_ALLOCATE as serialising, Anton Nefedov, 2018/03/12
- Re: [Qemu-devel] [PATCH v8 5/9] block: treat BDRV_REQ_ALLOCATE as serialising,
Alberto Garcia <=
- [Qemu-devel] [PATCH v8 7/9] block: support BDRV_REQ_ALLOCATE in passthrough drivers, Anton Nefedov, 2018/03/12
- [Qemu-devel] [PATCH v8 9/9] iotest 134: test cluster-misaligned encrypted write, Anton Nefedov, 2018/03/12
- [Qemu-devel] [PATCH v8 8/9] qcow2: skip writing zero buffers to empty COW areas, Anton Nefedov, 2018/03/12