2022-03-21 23:39:13

by Eric Biggers

[permalink] [raw]
Subject: Re: [f2fs-dev] [PATCH] f2fs: introduce data read/write showing path info

On Mon, Mar 21, 2022 at 03:33:15PM -0700, Jaegeuk Kim wrote:
> This was used in Android for a long time. Let's upstream it.
>

You still need to explain why this is useful.

> +static inline char *f2fs_get_pathname(char *buf, int len, struct inode *inode)
> +{
> + char *path;
> + struct dentry *d;
> +
> + /*
> + * d_obtain_alias() will either iput() if it locates an existing
> + * dentry or transfer the reference to the new dentry created.
> + * So get an extra reference here.
> + */
> + ihold(inode);
> + d = d_obtain_alias(inode);

Why does this use d_obtain_alias() to get a dentry instead of just using the
dentry of the open file?

- Eric


2022-03-22 00:50:45

by Jaegeuk Kim

[permalink] [raw]
Subject: Re: [f2fs-dev] [PATCH] f2fs: introduce data read/write showing path info

On 03/21, Eric Biggers wrote:
> On Mon, Mar 21, 2022 at 03:33:15PM -0700, Jaegeuk Kim wrote:
> > This was used in Android for a long time. Let's upstream it.
> >
>
> You still need to explain why this is useful.
>
> > +static inline char *f2fs_get_pathname(char *buf, int len, struct inode *inode)
> > +{
> > + char *path;
> > + struct dentry *d;
> > +
> > + /*
> > + * d_obtain_alias() will either iput() if it locates an existing
> > + * dentry or transfer the reference to the new dentry created.
> > + * So get an extra reference here.
> > + */
> > + ihold(inode);
> > + d = d_obtain_alias(inode);
>
> Why does this use d_obtain_alias() to get a dentry instead of just using the
> dentry of the open file?

:( I shouldn't copy the code from aosp simply.

>
> - Eric