On Tue, Nov 28, 2006 at 06:51:12AM +0100, Oliver Neukum wrote: > Am Dienstag, 28. November 2006 04:38 schrieb Alan Stern: > > On Mon, 27 Nov 2006, Oliver Neukum wrote: > > > > > OK, let's make some basic observation. Sysfs exists in memory only, > > > as long as the dentry exists the inode cannot be freed. > > > > How do you know that? > > > > For that matter, is there any written explanation at all of how the > > dentry and inode lifecycles work? Trying to read the source code is > > practically hopeless; it's a tangled mess. > > I have to modify the statement. > In fs/namei.c:do_path_lookup() a dget() is done for every open() syscall. > The corresponding dput appears to be in fs/file_table:__fput(). > In contrast sysfs pins/calls dget() only in fs/sysfs/inode.c:sysfs_create() > for directories. > Therefore, opened files have a valid dentry in memory. This should be enough. > Only opened files can have buffers attached. As for inodes see below. > > It seems to me that the Documentation for sysfs is outdated and says that > sysfs works like ramfs. This seems still true only for directories.
Yes, please don't rely on the sysfs documentation. As you have noted, it is very out of date. sysfs now has almost no ramfs innards, it is all "custom" to allow the creation of the trees on the fly when needed. This allows us to have 20000 disks on a s390 partition with 16Mb of ram on a 31bit processor (or some such resource constrained system...) If you have questions about specific issues like these down in sysfs, I suggest you ask Maneesh, as he wrote all of this code. good luck, greg k-h ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel