From: "Emilio G. Cota" <cota@braap.org>
To: Greg Kurz <groug@kaod.org>
Cc: antonios.motakis@huawei.com, qemu-devel@nongnu.org,
veaceslav.falico@huawei.com, Eduard.Shishkin@huawei.com,
andy.wangguoli@huawei.com, Jani.Kokkonen@huawei.com,
berrange@redhat.com, Eric Blake <eblake@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/4] 9pfs: stat_to_qid: use device as input to qid.path
Date: Fri, 9 Feb 2018 16:58:34 -0500 [thread overview]
Message-ID: <20180209215834.GB3684@flamenco> (raw)
In-Reply-To: <20180209161326.653f3468@bahia.lan>
On Fri, Feb 09, 2018 at 16:13:26 +0100, Greg Kurz wrote:
> On Thu, 8 Feb 2018 19:00:18 +0100
> <antonios.motakis@huawei.com> wrote:
(snip)
> > +/* creative abuse of tb_hash_func7, which is based on xxhash */
> > +static uint32_t qpp_hash(QppEntry e)
> > +{
> > + return tb_hash_func7(e.ino_prefix, e.dev, 0, 0, 0);
>
> Hmm... Looking at git log include/exec/tb-hash-xx.h, I see that this hash
> function signature evolved according to TCG needs. It started with 3
> arguments, then 4 and we have 5 today.
>
> So I don't think we should add another unrelated user. Probably best to
> have our own version. Also it seems it could be simpler since you always
> pass 0 for the third and later arguments.
It's fine to use it; the compiler will do the right thing
with those '0' arguments, because the function is always inlined.
That said, I have some cleanup patches to export this as xxhash and make
tb_hash a user of it. The patches also remove most of the ugly 0's from
callers. Those patches will have to wait for a bit though, so for now
just use tb_hash_func7.
(snip)
> > + val = g_malloc0(sizeof(QppEntry));
> > + if (!val) {
> > + return -ENOMEM;
> > + }
g_malloc0 and all other glib memory allocation functions only
return NULL if the size argument is 0.
If out of memory, the application is terminated, which is why
this check is not needed.
Reference:
https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#glib-Memory-Allocation.description
Thanks,
Emilio
next prev parent reply other threads:[~2018-02-09 21:58 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-08 18:00 [Qemu-devel] [PATCH 0/4] QID path collision fix antonios.motakis
2018-02-08 18:00 ` [Qemu-devel] [PATCH 1/4] 9pfs: V9fsQID: set type of version and path to unsigned antonios.motakis
2018-02-09 12:37 ` Greg Kurz
2018-02-16 10:19 ` Antonios Motakis
2018-02-08 18:00 ` [Qemu-devel] [PATCH 2/4] 9pfs: check for file device to avoid QID path collisions antonios.motakis
2018-02-09 13:03 ` Greg Kurz
2018-02-16 10:19 ` Antonios Motakis
2018-02-08 18:00 ` [Qemu-devel] [PATCH 3/4] 9pfs: stat_to_qid: use device as input to qid.path antonios.motakis
2018-02-09 15:13 ` Greg Kurz
2018-02-09 16:06 ` Eric Blake
2018-02-09 17:57 ` Greg Kurz
2018-02-16 10:20 ` Antonios Motakis
2018-02-16 11:21 ` Greg Kurz
2018-02-09 21:58 ` Emilio G. Cota [this message]
2018-02-16 10:19 ` Antonios Motakis
2018-02-08 18:00 ` [Qemu-devel] [PATCH 4/4] 9pfs: stat_to_qid: implement slow path antonios.motakis
2018-02-09 15:22 ` Greg Kurz
2018-02-09 21:47 ` Emilio G. Cota
2018-02-16 10:28 ` Antonios Motakis
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=20180209215834.GB3684@flamenco \
--to=cota@braap.org \
--cc=Eduard.Shishkin@huawei.com \
--cc=Jani.Kokkonen@huawei.com \
--cc=andy.wangguoli@huawei.com \
--cc=antonios.motakis@huawei.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=groug@kaod.org \
--cc=qemu-devel@nongnu.org \
--cc=veaceslav.falico@huawei.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).