diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2017-07-04 22:03:16 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2017-07-04 22:03:16 +0200 |
commit | 04a01ac7ed3c5cd718713ef6341249a143c96b10 (patch) | |
tree | 737c6c92f91dab8c7dba5b43bab4af82cfd68462 | |
parent | a015dafcaf5b0316654a39bc598a76804595af90 (diff) | |
download | linux-04a01ac7ed3c5cd718713ef6341249a143c96b10.tar.bz2 |
ovl: move cache and version to ovl_inode
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
-rw-r--r-- | fs/overlayfs/ovl_entry.h | 8 | ||||
-rw-r--r-- | fs/overlayfs/super.c | 2 | ||||
-rw-r--r-- | fs/overlayfs/util.c | 20 |
3 files changed, 13 insertions, 17 deletions
diff --git a/fs/overlayfs/ovl_entry.h b/fs/overlayfs/ovl_entry.h index d8f514a474ca..6a90a48c3589 100644 --- a/fs/overlayfs/ovl_entry.h +++ b/fs/overlayfs/ovl_entry.h @@ -35,12 +35,8 @@ struct ovl_fs { /* private information held for every overlayfs dentry */ struct ovl_entry { - struct ovl_dir_cache *cache; union { - struct { - u64 version; - bool opaque; - }; + bool opaque; struct rcu_head rcu; }; unsigned numlower; @@ -50,7 +46,9 @@ struct ovl_entry { struct ovl_entry *ovl_alloc_entry(unsigned int numlower); struct ovl_inode { + struct ovl_dir_cache *cache; const char *redirect; + u64 version; unsigned long flags; struct inode vfs_inode; struct dentry *__upperdentry; diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index b0d539af1fad..e0a51ea773ec 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -169,7 +169,9 @@ static struct inode *ovl_alloc_inode(struct super_block *sb) { struct ovl_inode *oi = kmem_cache_alloc(ovl_inode_cachep, GFP_KERNEL); + oi->cache = NULL; oi->redirect = NULL; + oi->version = 0; oi->flags = 0; oi->__upperdentry = NULL; oi->lower = NULL; diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c index a0baaa7e224c..f093fcf2b4bd 100644 --- a/fs/overlayfs/util.c +++ b/fs/overlayfs/util.c @@ -160,16 +160,12 @@ struct inode *ovl_inode_real(struct inode *inode) struct ovl_dir_cache *ovl_dir_cache(struct dentry *dentry) { - struct ovl_entry *oe = dentry->d_fsdata; - - return oe->cache; + return OVL_I(d_inode(dentry))->cache; } void ovl_set_dir_cache(struct dentry *dentry, struct ovl_dir_cache *cache) { - struct ovl_entry *oe = dentry->d_fsdata; - - oe->cache = cache; + OVL_I(d_inode(dentry))->cache = cache; } bool ovl_dentry_is_opaque(struct dentry *dentry) @@ -242,18 +238,18 @@ void ovl_inode_update(struct inode *inode, struct dentry *upperdentry) void ovl_dentry_version_inc(struct dentry *dentry) { - struct ovl_entry *oe = dentry->d_fsdata; + struct inode *inode = d_inode(dentry); - WARN_ON(!inode_is_locked(dentry->d_inode)); - oe->version++; + WARN_ON(!inode_is_locked(inode)); + OVL_I(inode)->version++; } u64 ovl_dentry_version_get(struct dentry *dentry) { - struct ovl_entry *oe = dentry->d_fsdata; + struct inode *inode = d_inode(dentry); - WARN_ON(!inode_is_locked(dentry->d_inode)); - return oe->version; + WARN_ON(!inode_is_locked(inode)); + return OVL_I(inode)->version; } bool ovl_is_whiteout(struct dentry *dentry) |