Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4823d49c authored by Vivek Goyal's avatar Vivek Goyal Committed by Miklos Szeredi
Browse files

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: default avatarVivek Goyal <vgoyal@redhat.com>
Reviewed-by: default avatarAmir Goldstein <amir73il@gmail.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 2664bd08
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -229,6 +229,7 @@ struct inode *ovl_inode_upper(struct inode *inode);
struct inode *ovl_inode_lower(struct inode *inode);
struct inode *ovl_inode_lower(struct inode *inode);
struct inode *ovl_inode_lowerdata(struct inode *inode);
struct inode *ovl_inode_lowerdata(struct inode *inode);
struct inode *ovl_inode_real(struct inode *inode);
struct inode *ovl_inode_real(struct inode *inode);
struct inode *ovl_inode_realdata(struct inode *inode);
struct ovl_dir_cache *ovl_dir_cache(struct inode *inode);
struct ovl_dir_cache *ovl_dir_cache(struct inode *inode);
void ovl_set_dir_cache(struct inode *inode, struct ovl_dir_cache *cache);
void ovl_set_dir_cache(struct inode *inode, struct ovl_dir_cache *cache);
void ovl_dentry_set_flag(unsigned long flag, struct dentry *dentry);
void ovl_dentry_set_flag(unsigned long flag, struct dentry *dentry);
+12 −0
Original line number Original line Diff line number Diff line
@@ -256,6 +256,18 @@ struct inode *ovl_inode_lowerdata(struct inode *inode)
	return OVL_I(inode)->lowerdata ?: ovl_inode_lower(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)
struct ovl_dir_cache *ovl_dir_cache(struct inode *inode)
{
{
	return OVL_I(inode)->cache;
	return OVL_I(inode)->cache;