summaryrefslogtreecommitdiffstats
path: root/fs/overlayfs/ovl_entry.h
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2023-04-01 09:29:19 +0200
committerAmir Goldstein <amir73il@gmail.com>2023-06-19 13:01:13 +0200
commitab1eb5ffb7d2a69c9b24083026a63cbdd758d96b (patch)
treea49397129b8bc021ac1acc5250f4a2ba440ee953 /fs/overlayfs/ovl_entry.h
parentovl: deduplicate lowerpath and lowerstack[] (diff)
downloadlinux-ab1eb5ffb7d2a69c9b24083026a63cbdd758d96b.tar.xz
linux-ab1eb5ffb7d2a69c9b24083026a63cbdd758d96b.zip
ovl: deduplicate lowerdata and lowerstack[]
The ovl_inode contains a copy of lowerdata in lowerstack[], so the lowerdata inode member can be removed. Use accessors ovl_lowerdata*() to get the lowerdata whereever the member was accessed directly. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs/ovl_entry.h')
-rw-r--r--fs/overlayfs/ovl_entry.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/fs/overlayfs/ovl_entry.h b/fs/overlayfs/ovl_entry.h
index 0bb8ab3aa8a7..548c93e030fc 100644
--- a/fs/overlayfs/ovl_entry.h
+++ b/fs/overlayfs/ovl_entry.h
@@ -125,6 +125,20 @@ static inline struct ovl_path *ovl_lowerpath(struct ovl_entry *oe)
return ovl_lowerstack(oe);
}
+static inline struct ovl_path *ovl_lowerdata(struct ovl_entry *oe)
+{
+ struct ovl_path *lowerstack = ovl_lowerstack(oe);
+
+ return lowerstack ? &lowerstack[oe->__numlower - 1] : NULL;
+}
+
+static inline struct dentry *ovl_lowerdata_dentry(struct ovl_entry *oe)
+{
+ struct ovl_path *lowerdata = ovl_lowerdata(oe);
+
+ return lowerdata ? lowerdata->dentry : NULL;
+}
+
/* private information held for every overlayfs dentry */
static inline unsigned long *OVL_E_FLAGS(struct dentry *dentry)
{
@@ -134,7 +148,7 @@ static inline unsigned long *OVL_E_FLAGS(struct dentry *dentry)
struct ovl_inode {
union {
struct ovl_dir_cache *cache; /* directory */
- struct inode *lowerdata; /* regular file */
+ /* place holder for non-dir */ /* regular file */
};
const char *redirect;
u64 version;