RE: [PATCH RFCv2 1/3] fs: introduce helper d_path_fast()

From: Justin He
Date: Fri May 28 2021 - 10:23:28 EST




> -----Original Message-----
> From: Matthew Wilcox <willy@xxxxxxxxxxxxx>
> Sent: Friday, May 28, 2021 8:52 PM
> To: Justin He <Justin.He@xxxxxxx>
> Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>; Petr Mladek
> <pmladek@xxxxxxxx>; Steven Rostedt <rostedt@xxxxxxxxxxx>; Sergey
> Senozhatsky <senozhatsky@xxxxxxxxxxxx>; Andy Shevchenko
> <andriy.shevchenko@xxxxxxxxxxxxxxx>; Rasmus Villemoes
> <linux@xxxxxxxxxxxxxxxxxx>; Jonathan Corbet <corbet@xxxxxxx>; Alexander
> Viro <viro@xxxxxxxxxxxxxxxxxx>; Luca Coelho <luciano.coelho@xxxxxxxxx>;
> Kalle Valo <kvalo@xxxxxxxxxxxxxx>; David S. Miller <davem@xxxxxxxxxxxxx>;
> Jakub Kicinski <kuba@xxxxxxxxxx>; Heiko Carstens <hca@xxxxxxxxxxxxx>;
> Vasily Gorbik <gor@xxxxxxxxxxxxx>; Christian Borntraeger
> <borntraeger@xxxxxxxxxx>; Johannes Berg <johannes.berg@xxxxxxxxx>; linux-
> doc@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-
> wireless@xxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; linux-
> s390@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH RFCv2 1/3] fs: introduce helper d_path_fast()
>
> On Fri, May 28, 2021 at 07:39:49PM +0800, Jia He wrote:
> > +/**
> > + * d_path_fast - fast return the full path of a dentry without taking
> > + * any seqlock/spinlock. This helper is typical for debugging purpose
> > + */
> > +char *d_path_fast(const struct path *path, char *buf, int buflen)
>
> I'd suggest calling it d_path_unsafe(). Otherwise people will call it
> instead of d_path because who doesn't like fast?
>
Okay, thanks

> > +{
> > + struct path root;
> > + struct mount *mnt = real_mount(path->mnt);
> > + DECLARE_BUFFER(b, buf, buflen);
> > +
> > + rcu_read_lock();
> > + get_fs_root_rcu(current->fs, &root);
> > +
> > + prepend(&b, "", 1);
> > + __prepend_path(path->dentry, mnt, &root, &b);
> > + rcu_read_unlock();
> > +
> > + return extract_string(&b);
> > +}
> > +EXPORT_SYMBOL(d_path_fast);
>
> Why export it? What module needs this?
Okay, indeed

--
Cheers,
Justin (Jia He)


IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.