From: Stefan Hajnoczi <stefanha@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: fam@euphon.net, kwolf@redhat.com, qemu-block@nongnu.org,
Anton.Nefedov@acronis.com, armbru@redhat.com,
qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org
Subject: Re: [PATCH 1/5] block/io: introduce bdrv_try_mark_request_serialising
Date: Mon, 13 Jul 2020 12:23:22 +0100 [thread overview]
Message-ID: <20200713112322.GH28639@stefanha-x1.localdomain> (raw)
In-Reply-To: <6faa2ec5-9857-daf0-bf84-e42eb07897ff@virtuozzo.com>
[-- Attachment #1: Type: text/plain, Size: 2502 bytes --]
On Wed, Jul 08, 2020 at 06:51:18PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> 07.07.2020 18:56, Stefan Hajnoczi wrote:
> > On Sat, Jun 20, 2020 at 05:36:45PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> > > Introduce a function to mark the request serialising only if there are
> > > no conflicting request to wait for.
> > >
> > > The function is static, so mark it unused. The attribute is to be
> > > dropped in the next commit.
> > >
> > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> > > ---
> > > block/io.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++-------
> > > 1 file changed, 51 insertions(+), 7 deletions(-)
> >
> > I found this patch difficult to understand because there are multiple
> > levels of functions passing flags to ultimiately do different things in
> > a common function.
> >
> > Here are some ideas if you have time to rework this patch:
> >
> > 1. Introduce a bdrv_find_overlapping_request() function that does most
> > of bdrv_wait_serialising_requests_locked() but does not wait. Then
> > bdrv_wait_serialising_requests_locked() can call that function in a
> > loop and wait if an overlapping request is found.
>
> I thought about it, but splitting bdrv_find_overlapping_request is not so clear:
> it should include most of the logic inside "if (tracked_request_overlaps(..":
> an assertion, and checking !req->waiting_for. So the semantics of new functions
> becomes unclear, and it lead to splitting "->waiting_for" logic.. So, I decided
> to keep the whole function as is, not splitted. I just can't imagine reasonable
> split.
>
> >
> > 2. Pass overlap_offset/overlap_bytes arguments to
> > bdrv_find_overlapping_request() instead of changing and restoring the
> > value in bdrv_do_mark_request_serialising().
>
> I'm not sure that it would be safe to not add a request to the list during the
> search.
>
> >
> > 3. Use consistent names for flags: wait/blocking, found/success
> >
> > I'm not sure if all these ideas will work, but I get the feeling this
> > code can be refactored to make it easier to understand. Since I don't
> > have a concrete suggestion and the code looks correct:
>
> Hmm. Unfortunately I didn't record the problems I faced on the way to resulting
> design, so I just don't remember now the details. So, I'll try to apply your
> suggestions, and remember the problems (or we'll get better patch :)
Thanks!
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-07-13 11:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-20 14:36 [PATCH 0/5] preallocate filter Vladimir Sementsov-Ogievskiy
2020-06-20 14:36 ` [PATCH 1/5] block/io: introduce bdrv_try_mark_request_serialising Vladimir Sementsov-Ogievskiy
2020-07-07 15:56 ` Stefan Hajnoczi
2020-07-08 15:51 ` Vladimir Sementsov-Ogievskiy
2020-07-13 11:23 ` Stefan Hajnoczi [this message]
2020-06-20 14:36 ` [PATCH 2/5] block/io: introduce bdrv_co_range_try_lock Vladimir Sementsov-Ogievskiy
2020-07-07 16:10 ` Stefan Hajnoczi
2020-07-08 15:56 ` Vladimir Sementsov-Ogievskiy
2020-07-13 11:23 ` Stefan Hajnoczi
2020-06-20 14:36 ` [PATCH 3/5] block: introduce preallocate filter Vladimir Sementsov-Ogievskiy
2020-07-08 12:07 ` Stefan Hajnoczi
2020-07-08 16:17 ` Vladimir Sementsov-Ogievskiy
2020-07-13 11:27 ` Stefan Hajnoczi
2020-06-20 14:36 ` [PATCH 4/5] iotests: QemuIoInteractive: use qemu_io_args_no_fmt Vladimir Sementsov-Ogievskiy
2020-07-08 12:08 ` Stefan Hajnoczi
2020-06-20 14:36 ` [PATCH 5/5] iotests: add 298 to test new preallocate filter driver Vladimir Sementsov-Ogievskiy
2020-07-08 12:09 ` Stefan Hajnoczi
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=20200713112322.GH28639@stefanha-x1.localdomain \
--to=stefanha@redhat.com \
--cc=Anton.Nefedov@acronis.com \
--cc=armbru@redhat.com \
--cc=den@openvz.org \
--cc=fam@euphon.net \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
/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).