summaryrefslogtreecommitdiff
path: root/fs/overlayfs/util.c
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2018-05-11 18:49:31 +0300
committerMiklos Szeredi <mszeredi@redhat.com>2018-07-20 10:56:11 +0300
commit4823d49c26eaf269cd2c2723bed8249aaed80795 (patch)
treeb843d3babb5b0a66a331670298fb0c7569643e11 /fs/overlayfs/util.c
parent2664bd0897c2889258472a1ee922ef9d4c5fa58f (diff)
downloadlinux-4823d49c26eaf269cd2c2723bed8249aaed80795.tar.xz
ovl: Add helper ovl_inode_realdata()
Add an helper to retrieve real data inode associated with overlay inode. This helper will ignore all metacopy inodes and will return only the real inode which has data. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs/util.c')
-rw-r--r--fs/overlayfs/util.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index 63311c536216..73939e08d8bf 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -256,6 +256,18 @@ struct inode *ovl_inode_lowerdata(struct inode *inode)
return OVL_I(inode)->lowerdata ?: ovl_inode_lower(inode);
}
+/* Return real inode which contains data. Does not return metacopy inode */
+struct inode *ovl_inode_realdata(struct inode *inode)
+{
+ struct inode *upperinode;
+
+ upperinode = ovl_inode_upper(inode);
+ if (upperinode && ovl_has_upperdata(inode))
+ return upperinode;
+
+ return ovl_inode_lowerdata(inode);
+}
+
struct ovl_dir_cache *ovl_dir_cache(struct inode *inode)
{
return OVL_I(inode)->cache;