dm: Call proper helper to determine dax support
[linux/fpc-iii.git] / fs / overlayfs / ovl_entry.h
blob28348c44ea5b2a808277598bc6206168955d4c50
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
4 * Copyright (C) 2011 Novell Inc.
5 * Copyright (C) 2016 Red Hat, Inc.
6 */
8 struct ovl_config {
9 char *lowerdir;
10 char *upperdir;
11 char *workdir;
12 bool default_permissions;
13 bool redirect_dir;
14 bool redirect_follow;
15 const char *redirect_mode;
16 bool index;
17 bool nfs_export;
18 int xino;
19 bool metacopy;
22 struct ovl_sb {
23 struct super_block *sb;
24 dev_t pseudo_dev;
25 /* Unusable (conflicting) uuid */
26 bool bad_uuid;
29 struct ovl_layer {
30 struct vfsmount *mnt;
31 /* Trap in ovl inode cache */
32 struct inode *trap;
33 struct ovl_sb *fs;
34 /* Index of this layer in fs root (upper idx == 0) */
35 int idx;
36 /* One fsid per unique underlying sb (upper fsid == 0) */
37 int fsid;
40 struct ovl_path {
41 struct ovl_layer *layer;
42 struct dentry *dentry;
45 /* private information held for overlayfs's superblock */
46 struct ovl_fs {
47 struct vfsmount *upper_mnt;
48 unsigned int numlower;
49 /* Number of unique lower sb that differ from upper sb */
50 unsigned int numlowerfs;
51 struct ovl_layer *lower_layers;
52 struct ovl_sb *lower_fs;
53 /* workbasedir is the path at workdir= mount option */
54 struct dentry *workbasedir;
55 /* workdir is the 'work' directory under workbasedir */
56 struct dentry *workdir;
57 /* index directory listing overlay inodes by origin file handle */
58 struct dentry *indexdir;
59 long namelen;
60 /* pathnames of lower and upper dirs, for show_options */
61 struct ovl_config config;
62 /* creds of process who forced instantiation of super block */
63 const struct cred *creator_cred;
64 bool tmpfile;
65 bool noxattr;
66 /* Did we take the inuse lock? */
67 bool upperdir_locked;
68 bool workdir_locked;
69 /* Traps in ovl inode cache */
70 struct inode *upperdir_trap;
71 struct inode *workbasedir_trap;
72 struct inode *workdir_trap;
73 struct inode *indexdir_trap;
74 /* Inode numbers in all layers do not use the high xino_bits */
75 unsigned int xino_bits;
78 /* private information held for every overlayfs dentry */
79 struct ovl_entry {
80 union {
81 struct {
82 unsigned long flags;
84 struct rcu_head rcu;
86 unsigned numlower;
87 struct ovl_path lowerstack[];
90 struct ovl_entry *ovl_alloc_entry(unsigned int numlower);
92 static inline struct ovl_entry *OVL_E(struct dentry *dentry)
94 return (struct ovl_entry *) dentry->d_fsdata;
97 struct ovl_inode {
98 union {
99 struct ovl_dir_cache *cache; /* directory */
100 struct inode *lowerdata; /* regular file */
102 const char *redirect;
103 u64 version;
104 unsigned long flags;
105 struct inode vfs_inode;
106 struct dentry *__upperdentry;
107 struct inode *lower;
109 /* synchronize copy up and more */
110 struct mutex lock;
113 static inline struct ovl_inode *OVL_I(struct inode *inode)
115 return container_of(inode, struct ovl_inode, vfs_inode);
118 static inline struct dentry *ovl_upperdentry_dereference(struct ovl_inode *oi)
120 return READ_ONCE(oi->__upperdentry);