From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: qemu-devel@nongnu.org
Cc: Greg Kurz <groug@kaod.org>
Subject: Re: [PATCH 1/2] hw/9pfs: avoid 'path' copy in v9fs_walk()
Date: Fri, 20 Aug 2021 14:19:21 +0200 [thread overview]
Message-ID: <11476815.tdmo6TZaKc@silver> (raw)
In-Reply-To: <20210820123549.4d5b353f@bahia.lan>
On Freitag, 20. August 2021 12:35:49 CEST Greg Kurz wrote:
> On Tue, 17 Aug 2021 14:38:24 +0200
>
> Christian Schoenebeck <qemu_oss@crudebyte.com> wrote:
> > The v9fs_walk() function resolves all client submitted path nodes to the
> > local 'pathes' array. Using a separate string scalar variable 'path'
> > inside the background worker thread loop and copying that local 'path'
> > string scalar variable subsequently to the 'pathes' array (at the end of
> > each loop iteration) is not necessary.
> >
> > Instead simply resolve each path directly to the 'pathes' array and
> > don't use the string scalar variable 'path' inside the fs worker thread
> > loop at all.
> >
> > The only advantage of the 'path' scalar was that in case of an error
> > the respective 'pathes' element would not be filled. Right now this is
> > not an issue as the v9fs_walk() function returns as soon as any error
> > occurs.
> >
> > Suggested-by: Greg Kurz <groug@kaod.org>
> > Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
> > ---
>
> Reviewed-by: Greg Kurz <groug@kaod.org>
>
> With this change, the path variable is no longer used at all in the
> first loop.
Correct.
> I see at least an extra possible cleanup : don't set
> path before the first loop since it gets reset before the second
> one.
Also correct.
> Maybe we can even get rid of path all the way ? I'll have
> a look.
Yes, that's the plan.
There is still quite a bunch that can be cleaned up in that function. I just
didn't want to start with a two-digit patch set right after the long summer
break. ;-)
If you want to send some cleanup patches, always appreciated.
Best regards,
Christian Schoenebeck
next prev parent reply other threads:[~2021-08-20 12:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-17 13:52 [PATCH 0/2] 9pfs: v9fs_walk() cleanup Christian Schoenebeck
2021-08-17 12:38 ` [PATCH 1/2] hw/9pfs: avoid 'path' copy in v9fs_walk() Christian Schoenebeck
2021-08-20 10:35 ` Greg Kurz
2021-08-20 12:19 ` Christian Schoenebeck [this message]
2021-08-17 13:46 ` [PATCH 2/2] hw/9pfs: use g_autofree in v9fs_walk() where possible Christian Schoenebeck
2021-08-17 14:10 ` Philippe Mathieu-Daudé
2021-08-20 10:40 ` Greg Kurz
2021-08-20 12:23 ` Christian Schoenebeck
2021-08-20 12:34 ` Greg Kurz
2021-08-20 12:49 ` Christian Schoenebeck
2021-08-20 14:30 ` [PATCH 0/2] 9pfs: v9fs_walk() cleanup Christian Schoenebeck
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=11476815.tdmo6TZaKc@silver \
--to=qemu_oss@crudebyte.com \
--cc=groug@kaod.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).