public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>, linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: dcache: abstract take_name_snapshot() interface
Date: Tue, 14 Jan 2020 19:19:07 +0000	[thread overview]
Message-ID: <20200114191907.GC8904@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CAOQ4uxjbRzuAPHbgyW+uGmamc=fZ=eT_p4wCSb0QT7edtUqu8Q@mail.gmail.com>

On Tue, Jan 14, 2020 at 08:06:56PM +0200, Amir Goldstein wrote:
> > // NOTE: release_dentry_name_snapshot() will be needed for both copies.
> > clone_name_snapshot(struct name_snapshot *to, const struct name_snapshot *from)
> > {
> >         to->name = from->name;
> >         if (likely(to->name.name == from->inline_name)) {
> >                 memcpy(to->inline_name, from->inline_name,
> >                         to->name.len);
> >                 to->name.name = to->inline_name;
> >         } else {
> >                 struct external_name *p;
> >                 p = container_of(to->name.name, struct external_name, name[0]);
> >                 atomic_inc(&p->u.count);
> >         }
> > }
> >
> > and be done with that.  Avoids any extensions or tree-wide renamings, etc.
> 
> I started with something like this but than in one of the early
> revisions I needed
> to pass some abstract reference around before cloning the name into the event,
> but with my current patches I can get away with a simple:
> 
> if (data_type == FANOTIFY_EVENT_NAME)
>     clone_name_snapshot(&event->name, data);
> else if (dentry)
>     take_dentry_name_snapshot(&event->name, dentry);
> 
> So that simple interface should be good enough for my needs.

I really think it would be safer that way; do you want me to throw that into
vfs.git (#work.dcache, perhaps)?  I don't have anything going on in the
vicinity, so it's not likely to cause conflicts either way and nothing I'd
seen posted on fsdevel seems to be likely to step into it, IIRC, so...
Up to you.

  reply	other threads:[~2020-01-14 19:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14 15:40 dcache: abstract take_name_snapshot() interface Amir Goldstein
2020-01-14 16:22 ` Al Viro
2020-01-14 18:06   ` Amir Goldstein
2020-01-14 19:19     ` Al Viro [this message]
2020-01-14 19:58       ` Amir Goldstein
2020-01-15  0:03         ` Amir Goldstein
2020-01-15  0:09           ` Al Viro
2020-01-15  5:44             ` Amir Goldstein
2020-01-15  5:51   ` Amir Goldstein

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=20200114191907.GC8904@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=amir73il@gmail.com \
    --cc=jack@suse.cz \
    --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