forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/fs/overlayfs/ovl_entry.h
....@@ -1,11 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 *
34 * Copyright (C) 2011 Novell Inc.
45 * Copyright (C) 2016 Red Hat, Inc.
5
- *
6
- * This program is free software; you can redistribute it and/or modify it
7
- * under the terms of the GNU General Public License version 2 as published by
8
- * the Free Software Foundation.
96 */
107
118 struct ovl_config {
....@@ -20,12 +17,17 @@
2017 bool nfs_export;
2118 int xino;
2219 bool metacopy;
20
+ bool ovl_volatile;
2321 bool override_creds;
2422 };
2523
2624 struct ovl_sb {
2725 struct super_block *sb;
2826 dev_t pseudo_dev;
27
+ /* Unusable (conflicting) uuid */
28
+ bool bad_uuid;
29
+ /* Used as a lower layer (but maybe also as upper) */
30
+ bool is_lower;
2931 };
3032
3133 struct ovl_layer {
....@@ -40,18 +42,17 @@
4042 };
4143
4244 struct ovl_path {
43
- struct ovl_layer *layer;
45
+ const struct ovl_layer *layer;
4446 struct dentry *dentry;
4547 };
4648
4749 /* private information held for overlayfs's superblock */
4850 struct ovl_fs {
49
- struct vfsmount *upper_mnt;
50
- unsigned int numlower;
51
- /* Number of unique lower sb that differ from upper sb */
52
- unsigned int numlowerfs;
53
- struct ovl_layer *lower_layers;
54
- struct ovl_sb *lower_fs;
51
+ unsigned int numlayer;
52
+ /* Number of unique fs among layers including upper fs */
53
+ unsigned int numfs;
54
+ const struct ovl_layer *layers;
55
+ struct ovl_sb *fs;
5556 /* workbasedir is the path at workdir= mount option */
5657 struct dentry *workbasedir;
5758 /* workdir is the 'work' directory under workbasedir */
....@@ -68,15 +69,36 @@
6869 /* Did we take the inuse lock? */
6970 bool upperdir_locked;
7071 bool workdir_locked;
72
+ bool share_whiteout;
7173 /* Traps in ovl inode cache */
72
- struct inode *upperdir_trap;
7374 struct inode *workbasedir_trap;
7475 struct inode *workdir_trap;
7576 struct inode *indexdir_trap;
76
- /* Inode numbers in all layers do not use the high xino_bits */
77
- unsigned int xino_bits;
77
+ /* -1: disabled, 0: same fs, 1..32: number of unused ino bits */
78
+ int xino_mode;
79
+ /* For allocation of non-persistent inode numbers */
80
+ atomic_long_t last_ino;
81
+ /* Whiteout dentry cache */
82
+ struct dentry *whiteout;
83
+ /* r/o snapshot of upperdir sb's only taken on volatile mounts */
84
+ errseq_t errseq;
7885 };
7986
87
+static inline struct vfsmount *ovl_upper_mnt(struct ovl_fs *ofs)
88
+{
89
+ return ofs->layers[0].mnt;
90
+}
91
+
92
+static inline struct ovl_fs *OVL_FS(struct super_block *sb)
93
+{
94
+ return (struct ovl_fs *)sb->s_fs_info;
95
+}
96
+
97
+static inline bool ovl_should_sync(struct ovl_fs *ofs)
98
+{
99
+ return !ofs->config.ovl_volatile;
100
+}
101
+
80102 /* private information held for every overlayfs dentry */
81103 struct ovl_entry {
82104 union {