lkml.org 
[lkml]   [2012]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 30/73] union-mount: Create needs_lookup_union() [ver #2]
Date
From: Valerie Aurora <vaurora@redhat.com>

needs_lookup_union() tests if a path could possibly require a union
lookup.

Original-author: Valerie Aurora <vaurora@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
---

fs/union.h | 25 +++++++++++++++++++++++++
include/linux/dcache.h | 2 ++
2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/fs/union.h b/fs/union.h
index 990dd16..757f28c 100644
--- a/fs/union.h
+++ b/fs/union.h
@@ -73,6 +73,26 @@ struct path *union_find_dir(struct dentry *dentry, unsigned int layer)
return &dentry->d_union_stack->u_dirs[layer];
}

+/*
+ * Determine whether we need to perform unionmount traversal or the copyup of a
+ * dentry.
+ */
+static inline
+bool needs_lookup_union(struct path *parent_path, struct path *path)
+{
+ if (!IS_DIR_UNIONED(parent_path->dentry))
+ return false;
+
+ /* Either already built or crossed a mountpoint to not-unioned mnt */
+ /* XXX are bind mounts root? think not */
+ if (IS_ROOT(path->dentry))
+ return false;
+
+ /* It's okay not to have the lock; will recheck in lookup_union() */
+ /* XXX set for root dentry at mount? */
+ return !(path->dentry->d_flags & DCACHE_UNION_LOOKUP_DONE);
+}
+
#else /* CONFIG_UNION_MOUNT */

static inline
@@ -100,4 +120,9 @@ static inline int union_create_topmost_dir(struct path *parent, struct qstr *nam
return 0;
}

+static inline bool needs_lookup_union(struct path *parent_path, struct path *path)
+{
+ return false;
+}
+
#endif /* CONFIG_UNION_MOUNT */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index e2d44e1..79833ae 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -245,6 +245,8 @@ struct dentry_operations {
#define DCACHE_MANAGED_DENTRY \
(DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)

+#define DCACHE_UNION_LOOKUP_DONE 0x100000 /* Union lookup was called on this dentry */
+
extern seqlock_t rename_lock;

static inline int dname_external(struct dentry *dentry)


\
 
 \ /
  Last update: 2012-02-21 21:09    [W:0.265 / U:1.724 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site