linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>, linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH v2 3/5] fanotify: mix event info and pid into merge key hash
Date: Wed, 17 Mar 2021 11:17:28 +0100	[thread overview]
Message-ID: <20210317101728.GA2541@quack2.suse.cz> (raw)
In-Reply-To: <CAOQ4uxizm9KdM+82MGni=fUkCzUvU2pt1q+0ynGLkDX47hJm3Q@mail.gmail.com>

On Wed 17-03-21 11:26:36, Amir Goldstein wrote:
> On Tue, Mar 16, 2021 at 5:18 PM Jan Kara <jack@suse.cz> wrote:
> >
> > On Thu 04-03-21 12:48:24, Amir Goldstein wrote:
> > > Improve the merge key hash by mixing more values relevant for merge.
> > >
> > > For example, all FAN_CREATE name events in the same dir used to have the
> > > same merge key based on the dir inode.  With this change the created
> > > file name is mixed into the merge key.
> > >
> > > The object id that was used as merge key is redundant to the event info
> > > so it is no longer mixed into the hash.
> > >
> > > Permission events are not hashed, so no need to hash their info.
> > >
> > > Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> >
> > ...
> >
> > > @@ -530,6 +568,8 @@ static struct fanotify_event *fanotify_alloc_event(struct fsnotify_group *group,
> > >       struct inode *child = NULL;
> > >       bool name_event = false;
> > >       unsigned int hash = 0;
> > > +     unsigned long ondir = (mask & FAN_ONDIR) ? 1UL : 0;
> > > +     struct pid *pid;
> >
> > I've made a tiny change here and changed 'ondir' to bool since I don't see
> > a strong reason to play games like this. Otherwise I took the patch as is.
> >
> 
> OK, so you kept this arithmetics with a bool:
> 
> (unsigned long)pid | ondir
> 
> I suppose there's no harm.

Yes. Bool is guaranteed to be typed to int (and then subsequently lifted to
unsigned long) in this expression with 'false' translated to 0 and 'true'
translated to 1. So everything works as expected.

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2021-03-17 10:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 10:48 [PATCH v2 0/5] Performance improvement for fanotify merge Amir Goldstein
2021-03-04 10:48 ` [PATCH v2 1/5] fsnotify: allow fsnotify_{peek,remove}_first_event with empty queue Amir Goldstein
2021-03-04 10:48 ` [PATCH v2 2/5] fanotify: reduce event objectid to 29-bit hash Amir Goldstein
2021-03-04 10:48 ` [PATCH v2 3/5] fanotify: mix event info and pid into merge key hash Amir Goldstein
2021-03-16 15:18   ` Jan Kara
2021-03-17  9:26     ` Amir Goldstein
2021-03-17 10:17       ` Jan Kara [this message]
2021-03-04 10:48 ` [PATCH v2 4/5] fsnotify: use hash table for faster events merge Amir Goldstein
2021-03-04 10:48 ` [PATCH v2 5/5] fanotify: limit number of event merge attempts Amir Goldstein
2021-03-16 15:39 ` [PATCH v2 0/5] Performance improvement for fanotify merge Jan Kara

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=20210317101728.GA2541@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=amir73il@gmail.com \
    --cc=linux-fsdevel@vger.kernel.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).