summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2015-01-29 12:02:27 +0000
committerAl Viro <viro@zeniv.linux.org.uk>2015-02-22 11:38:37 -0500
commite7f7d2253c05143ed76ddc5e11f4cf0a9b814a27 (patch)
treea4313648e0c389911439deb18633951b4678561b
parent155e35d4daa804582f75acaa2c74ec797a89c615 (diff)
downloadop-kernel-dev-e7f7d2253c05143ed76ddc5e11f4cf0a9b814a27.zip
op-kernel-dev-e7f7d2253c05143ed76ddc5e11f4cf0a9b814a27.tar.gz
VFS: Add a whiteout dentry type
Add DCACHE_WHITEOUT_TYPE and provide a d_is_whiteout() accessor function. A d_is_miss() accessor is also added for ordinary cache misses and d_is_negative() is modified to indicate either an ordinary miss or an enforced miss (whiteout). Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--include/linux/dcache.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 047c0db..98d2a94 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -215,11 +215,12 @@ struct dentry_operations {
#define DCACHE_LRU_LIST 0x00080000
#define DCACHE_ENTRY_TYPE 0x00700000
-#define DCACHE_MISS_TYPE 0x00000000 /* Negative dentry */
-#define DCACHE_DIRECTORY_TYPE 0x00100000 /* Normal directory */
-#define DCACHE_AUTODIR_TYPE 0x00200000 /* Lookupless directory (presumed automount) */
-#define DCACHE_SYMLINK_TYPE 0x00300000 /* Symlink */
-#define DCACHE_FILE_TYPE 0x00400000 /* Other file type */
+#define DCACHE_MISS_TYPE 0x00000000 /* Negative dentry (maybe fallthru to nowhere) */
+#define DCACHE_WHITEOUT_TYPE 0x00100000 /* Whiteout dentry (stop pathwalk) */
+#define DCACHE_DIRECTORY_TYPE 0x00200000 /* Normal directory */
+#define DCACHE_AUTODIR_TYPE 0x00300000 /* Lookupless directory (presumed automount) */
+#define DCACHE_SYMLINK_TYPE 0x00400000 /* Symlink (or fallthru to such) */
+#define DCACHE_FILE_TYPE 0x00500000 /* Other file type (or fallthru to such) */
#define DCACHE_MAY_FREE 0x00800000
@@ -423,6 +424,16 @@ static inline unsigned __d_entry_type(const struct dentry *dentry)
return dentry->d_flags & DCACHE_ENTRY_TYPE;
}
+static inline bool d_is_miss(const struct dentry *dentry)
+{
+ return __d_entry_type(dentry) == DCACHE_MISS_TYPE;
+}
+
+static inline bool d_is_whiteout(const struct dentry *dentry)
+{
+ return __d_entry_type(dentry) == DCACHE_WHITEOUT_TYPE;
+}
+
static inline bool d_can_lookup(const struct dentry *dentry)
{
return __d_entry_type(dentry) == DCACHE_DIRECTORY_TYPE;
@@ -450,7 +461,8 @@ static inline bool d_is_file(const struct dentry *dentry)
static inline bool d_is_negative(const struct dentry *dentry)
{
- return __d_entry_type(dentry) == DCACHE_MISS_TYPE;
+ // TODO: check d_is_whiteout(dentry) also.
+ return d_is_miss(dentry);
}
static inline bool d_is_positive(const struct dentry *dentry)
OpenPOWER on IntegriCloud