[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <26966.1391801457@warthog.procyon.org.uk>
Date: Fri, 07 Feb 2014 19:30:57 +0000
From: David Howells <dhowells@...hat.com>
To: "J. Bruce Fields" <bfields@...ldses.org>
Cc: dhowells@...hat.com, Miklos Szeredi <miklos@...redi.hu>,
viro@...iv.linux.org.uk, torvalds@...ux-foundation.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
hch@...radead.org, akpm@...ux-foundation.org, zab@...hat.com,
jack@...e.cz, luto@...capital.net, mszeredi@...e.cz
Subject: Re: [PATCH 01/13] vfs: add d_is_dir()
J. Bruce Fields <bfields@...ldses.org> wrote:
> On Fri, Feb 07, 2014 at 05:48:59PM +0100, Miklos Szeredi wrote:
> > From: Miklos Szeredi <mszeredi@...e.cz>
> >
> > 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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists