Re: [RFC PATCH 2/6] pipes: use alloc-file instead of duplicating code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2009-12-04 at 07:08 +0100, Miklos Szeredi wrote:
> On Thu, 03 Dec 2009, Eric Paris wrote:
> > The pipe code duplicates the functionality of alloc-file and init-file.  Use
> > the generic vfs functions instead of duplicating code.
> > 
> > Signed-off-by: Eric Paris <eparis@xxxxxxxxxx>
> 
> Acked-by: Miklos Szeredi <miklos@xxxxxxxxxx>
> 
> As a side note: I wonder why we aren't passing a "struct path" to
> alloc_file() and why are the refcount rules wrt. dentries/vfsmounts so
> weird?

It's probably because of the slightly weird refcnt rules that it asks
for the dentry and vfsmount separately rather than as a struct path.
The rules make perfect sense if you consider

d_alloc()  <-- reference on dentry
d_instantiate()
alloc_file() <-- reference on vfsmount
  so here file->f_path() is all good.

Which a number of callers user.  They make less sense when you consider
something that is not allocating the dentry right there (like this path)

dget(dentry);  <-- reference here
alloc_file() <-- reference on vfsmount;
  so here file->f_path is all good.

It would be a reasonable interface if it took a struct path and then
took a reference on the struct path.  The second case would look more
clean, but the first case would turn into

d_alloc()
d_instantiate()
alloc_file()
d_put() /* matches d_alloc() */

and

alloc_file()

Is this better?  I'll gladly do it if other think so it makes more
sense....

-Eric

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux