2011-02-24 21:17:57

by Dan Magenheimer

[permalink] [raw]
Subject: encode_fh: have inode but no dentry

Hi Aneesh --

I see you are continuing with encode_fh related
development so I thought I would bring this up
with you.

I have a need to call the encode_fh op in a
situation where I have an inode but not a dentry,
and calling d_find_alias(inode) sometimes returns
NULL. In my usage, connectable is always zero, so
having just the inode should be sufficient to get
useful results from encode_fh, at least for the
filesystems I've looked at.

What I'd like to see is the generic interface to
encode_fh extended to support this situation,
probably by passing inode as another parameter,
perhaps specified so that it can only be non-NULL
if connectable==0 and dentry==NULL.

Such a change would require a patch that touched
nearly every filesystem so it's clearly not to
be taken lightly.

Any thoughts on this?

Thanks,
Dan


2011-02-24 21:23:23

by Al Viro

[permalink] [raw]
Subject: Re: encode_fh: have inode but no dentry

On Thu, Feb 24, 2011 at 01:16:34PM -0800, Dan Magenheimer wrote:
> Hi Aneesh --
>
> I see you are continuing with encode_fh related
> development so I thought I would bring this up
> with you.
>
> I have a need to call the encode_fh op in a
> situation where I have an inode but not a dentry,
> and calling d_find_alias(inode) sometimes returns
> NULL. In my usage, connectable is always zero, so
> having just the inode should be sufficient to get
> useful results from encode_fh, at least for the
> filesystems I've looked at.

[snip]

> Such a change would require a patch that touched
> nearly every filesystem so it's clearly not to
> be taken lightly.
>
> Any thoughts on this?

How about "tell us what do you need that for", for starters?

2011-02-24 21:53:12

by Dan Magenheimer

[permalink] [raw]
Subject: RE: encode_fh: have inode but no dentry

> From: Al Viro [mailto:[email protected]]
> Subject: Re: encode_fh: have inode but no dentry
>
> On Thu, Feb 24, 2011 at 01:16:34PM -0800, Dan Magenheimer wrote:
> > Hi Aneesh --
> >
> > I see you are continuing with encode_fh related
> > development so I thought I would bring this up
> > with you.
> >
> > I have a need to call the encode_fh op in a
> > situation where I have an inode but not a dentry,
> > and calling d_find_alias(inode) sometimes returns
> > NULL. In my usage, connectable is always zero, so
> > having just the inode should be sufficient to get
> > useful results from encode_fh, at least for the
> > filesystems I've looked at.
>
> [snip]
>
> > Such a change would require a patch that touched
> > nearly every filesystem so it's clearly not to
> > be taken lightly.
> >
> > Any thoughts on this?
>
> How about "tell us what do you need that for", for starters?

(Wow, that was fast! /me pictures a 64-core Al Viro
parallelizing incoming lkml email.)

It's for some work I'm building on top of cleancache.
Since cleancache isn't merged (yet), it's not pressing,
but this seemed a reasonable approach so, before I
started looking at more complicated alternatives,
I thought I'd get some idea if this is feasible or not.

The situation arises when the inode is in cache but
the dentry is not, but I still need a filehandle.
In the non-connectable case, this should still be OK.
Seems like a case that might be more broadly useful.

Thanks,
Dan