J. Bruce Fields <bfields@xxxxxxxxxxxx> wrote: > On Fri, Feb 07, 2014 at 05:48:59PM +0100, Miklos Szeredi wrote: > > From: Miklos Szeredi <mszeredi@xxxxxxx> > > > > Add d_is_dir(dentry) helper which is analogous to S_ISDIR(). > > While trying to get up to speed I notice that these flags were > introduced by b18825a7c8e37a7cf6abb97a12a6ad71af160de7 "VFS: Put a small > type field into struct dentry::d_flags" whose changelog tells me "what" > but not "why". So out of curiosity: was that some kind of optimization, > or was there some other reason for it? The idea is to put into the dentry information about objects that pathwalk specifically needs to know about, ie. negative dentries, dirs, automount points and symlinks so that you don't have to look this up in the inode. We can use this to distinguish lookupable dirs from nonlookupable dirs (ie. automounts), thereby subsuming the can_lookup query. However, the real power comes in support for fs unioning. There are two additional uses for this field: (1) Whiteout dentry type. An additional type is added for this field which causes d_is_negative() to return true, but can be distinguished when trying to decide whether to look in a lower layer or not. (2) Fallthroughs. Whilst the dentry may appear negative by virtue of having a NULL d_inode pointer, it does in fact correspond to a real object on a lower layer. The type of the lower object is set in this field so that pathwalk can immediately know how to deal with it. David -- 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