linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [sysfs] why ->delete_inode() instead of ->clear_inode()?
@ 2010-05-29  5:43 Al Viro
  2010-05-29  7:06 ` Eric W. Biederman
  0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2010-05-29  5:43 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: linux-fsdevel

	Is there any problem with simply doing

void sysfs_clear_inode(struct inode *inode)
{
	struct sysfs_dirent *sd  = inode->i_private;
	sysfs_put(sd);
}

instead of (mis)using ->delete_inode()?  Note that clear_inode() is
not going to be called on any inodes with positive i_count, that
you are forcibly evicting them from icache on the final iput() anyway
and that clear_inode() is never called twice on the same struct
inode()...

Al, very unenthusiastic about ->delete_inode() instances in general - that
sucker gets abused in the strangest ways by a lot of filesystems ;-/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [sysfs] why ->delete_inode() instead of ->clear_inode()?
  2010-05-29  5:43 [sysfs] why ->delete_inode() instead of ->clear_inode()? Al Viro
@ 2010-05-29  7:06 ` Eric W. Biederman
  2010-05-29 11:36   ` Al Viro
  0 siblings, 1 reply; 4+ messages in thread
From: Eric W. Biederman @ 2010-05-29  7:06 UTC (permalink / raw)
  To: Al Viro; +Cc: Eric W. Biederman, linux-fsdevel

Al Viro <viro@ZenIV.linux.org.uk> writes:

> 	Is there any problem with simply doing
>
> void sysfs_clear_inode(struct inode *inode)
> {
> 	struct sysfs_dirent *sd  = inode->i_private;
> 	sysfs_put(sd);
> }

I can't see any problems with a quick review.

Given that drop_inode calls generic_delete_inode I don't see that
changing that will make any difference in the case of sysfs.

I can't remember why I did it that way but I can say nothing terribly subtle
is going on.  We need a reference to the sysfs_dirent from the inode and when
the inode goes away we need to clear the reference.

>From the look of things proc_delete_inode can also be changed to a clear_inode
method if that is preferred.

Eric

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [sysfs] why ->delete_inode() instead of ->clear_inode()?
  2010-05-29  7:06 ` Eric W. Biederman
@ 2010-05-29 11:36   ` Al Viro
  2010-05-30  0:45     ` Eric W. Biederman
  0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2010-05-29 11:36 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: Eric W. Biederman, linux-fsdevel

On Sat, May 29, 2010 at 12:06:34AM -0700, Eric W. Biederman wrote:

> >From the look of things proc_delete_inode can also be changed to a clear_inode
> method if that is preferred.

Already that way in the local tree, along with quite a few other filesystems...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [sysfs] why ->delete_inode() instead of ->clear_inode()?
  2010-05-29 11:36   ` Al Viro
@ 2010-05-30  0:45     ` Eric W. Biederman
  0 siblings, 0 replies; 4+ messages in thread
From: Eric W. Biederman @ 2010-05-30  0:45 UTC (permalink / raw)
  To: Al Viro; +Cc: Eric W. Biederman, linux-fsdevel

Al Viro <viro@ZenIV.linux.org.uk> writes:

> On Sat, May 29, 2010 at 12:06:34AM -0700, Eric W. Biederman wrote:
>
>> >From the look of things proc_delete_inode can also be changed to a clear_inode
>> method if that is preferred.
>
> Already that way in the local tree, along with quite a few other filesystems...

It has been my goal, to get sysfs looking roughly like other filesystems
in the kernel.  I'm glad to see that sysfs is finally looking enough
like other filesystems it can participate in global cleanups.

Eric


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-30  0:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-29  5:43 [sysfs] why ->delete_inode() instead of ->clear_inode()? Al Viro
2010-05-29  7:06 ` Eric W. Biederman
2010-05-29 11:36   ` Al Viro
2010-05-30  0:45     ` Eric W. Biederman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).