From 2664bd0897c2889258472a1ee922ef9d4c5fa58f Mon Sep 17 00:00:00 2001 From: Vivek Goyal Date: Fri, 11 May 2018 11:49:30 -0400 Subject: ovl: Store lower data inode in ovl_inode Right now ovl_inode stores inode pointer for lower inode. This helps with quickly getting lower inode given overlay inode (ovl_inode_lower()). Now with metadata only copy-up, we can have metacopy inode in middle layer as well and inode containing data can be different from ->lower. I need to be able to open the real file in ovl_open_realfile() and for that I need to quickly find the lower data inode. Hence store lower data inode also in ovl_inode. Also provide an helper ovl_inode_lowerdata() to access this field. Signed-off-by: Vivek Goyal Reviewed-by: Amir Goldstein Signed-off-by: Miklos Szeredi --- fs/overlayfs/ovl_entry.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'fs/overlayfs/ovl_entry.h') diff --git a/fs/overlayfs/ovl_entry.h b/fs/overlayfs/ovl_entry.h index ea4134e97d0d..ec237035333a 100644 --- a/fs/overlayfs/ovl_entry.h +++ b/fs/overlayfs/ovl_entry.h @@ -89,7 +89,10 @@ static inline struct ovl_entry *OVL_E(struct dentry *dentry) } struct ovl_inode { - struct ovl_dir_cache *cache; + union { + struct ovl_dir_cache *cache; /* directory */ + struct inode *lowerdata; /* regular file */ + }; const char *redirect; u64 version; unsigned long flags; -- cgit v1.2.3