qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Lieven <pl@kamp.de>, qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [PATCH 2/3] block/io: wait for serialising requests when a request becomes serialising
Date: Wed, 18 Dec 2019 17:47:34 +0100	[thread overview]
Message-ID: <20191218164618.GD4632@linux.fritz.box> (raw)
In-Reply-To: <1576675026-25046-3-git-send-email-pbonzini@redhat.com>

Am 18.12.2019 um 14:17 hat Paolo Bonzini geschrieben:
> Marking without waiting would not result in actual serialising behavior.
> Thus, make a call bdrv_mark_request_serialising sufficient for
> serialisation to happen.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

> @@ -1851,13 +1841,18 @@ bdrv_co_write_req_prepare(BdrvChild *child, int64_t offset, uint64_t bytes,
>      assert(!(flags & ~BDRV_REQ_MASK));
>  
>      if (flags & BDRV_REQ_SERIALISING) {
> -        bdrv_mark_request_serialising(req, bdrv_get_cluster_size(bs));
> +        waited = bdrv_mark_request_serialising(req, bdrv_get_cluster_size(bs));
> +        /*
> +         * For a misaligned request, we should have already waited
> +         * in bdrv_padding_rmw_read and locked out concurrent writers.

Actually, bdrv_padding_rmw_read() only asserts that the request is
already serialised. bdrv_mark_request_serialising() is already called by
the callers of bdrv_padding_rmw_read().

> +         */
> +        assert(!waited ||
> +               (req->offset == req->overlap_offset &&
> +                req->bytes == req->overlap_bytes));
> +    } else {
> +        bdrv_wait_serialising_requests(req);
>      }
>  
> -    waited = bdrv_wait_serialising_requests(req);
> -
> -    assert(!waited || !req->serialising ||
> -           is_request_serialising_and_aligned(req));
>      assert(req->overlap_offset <= offset);
>      assert(offset + bytes <= req->overlap_offset + req->overlap_bytes);
>      assert(end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE);

Other than the comment, the patch looks fine to me.

Kevin



  reply	other threads:[~2019-12-18 16:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-18 13:17 [PATCH 0/3] block/io: serialising request clean up and locking fix Paolo Bonzini
2019-12-18 13:17 ` [PATCH 1/3] block: eliminate BDRV_REQ_NO_SERIALISING Paolo Bonzini
2019-12-18 16:37   ` Kevin Wolf
2019-12-18 16:43     ` Paolo Bonzini
2019-12-18 16:51       ` Kevin Wolf
2019-12-18 13:17 ` [PATCH 2/3] block/io: wait for serialising requests when a request becomes serialising Paolo Bonzini
2019-12-18 16:47   ` Kevin Wolf [this message]
2019-12-18 13:17 ` [PATCH 3/3] block/io: take bs->reqs_lock in bdrv_mark_request_serialising Paolo Bonzini
2019-12-18 16:59   ` Kevin Wolf
2019-12-18 17:21     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191218164618.GD4632@linux.fritz.box \
    --to=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pl@kamp.de \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).