On Saturday June 10, uzairr_bs1b@xxxxxxxxx wrote: > > Hello All, > > Continuing the above discusssion I want to ask one > question. If a file system allocated new inodes using > new_inode() then after this uses d_add or > d_instantiate to attach this inode to a dentry, then > what will happen when we get short of memory. Maybe you should spend a week reading the code? It can be a lot of fun, and you might even find a bug or two... Each dentry hold a reference on it's parent, and on it's inode. Neither a dentry nor an inode can be freed when anyone holds a reference on it. From this it is fairly easy to deduce that the first things to go when there is memory pressure are the leaf dentries. Once these are gone, the inodes they referred to, and the parents of the dentries will become available for being discarded. NeilBrown > > In other words since new_inode() alolocates the memory > for the inode in the inode cache and since we are > getting short of memory so we can loose this inode but > we already have attached this inode with a dentry. > Then how the kernel will get the inode for this dentry > since we already have loose the inode for this dentry. > > Similarly the file system allocates the memory for > dentries using d_alloc; is this can also create > problems like for the inodes. > > Thanks, > Uzair Lakhani, > Karachi, Pakistan. - 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