hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/include/linux/shmem_fs.h
....@@ -8,6 +8,7 @@
88 #include <linux/pagemap.h>
99 #include <linux/percpu_counter.h>
1010 #include <linux/xattr.h>
11
+#include <linux/fs_parser.h>
1112
1213 /* inode in-kernel data */
1314
....@@ -21,6 +22,7 @@
2122 struct list_head swaplist; /* chain of maybes on swap */
2223 struct shared_policy policy; /* NUMA memory alloc policy */
2324 struct simple_xattrs xattrs; /* list of xattrs */
25
+ atomic_t stop_eviction; /* hold when working on inode */
2426 struct inode vfs_inode;
2527 };
2628
....@@ -34,6 +36,9 @@
3436 unsigned char huge; /* Whether to try for hugepages */
3537 kuid_t uid; /* Mount uid for root directory */
3638 kgid_t gid; /* Mount gid for root directory */
39
+ bool full_inums; /* If i_ino should be uint or ino_t */
40
+ ino_t next_ino; /* The next per-sb inode number to use */
41
+ ino_t __percpu *ino_batch; /* The next per-cpu inode number to use */
3742 struct mempolicy *mpol; /* default memory policy for mappings */
3843 spinlock_t shrinklist_lock; /* Protects shrinklist */
3944 struct list_head shrinklist; /* List of shinkable inodes */
....@@ -48,8 +53,9 @@
4853 /*
4954 * Functions in mm/shmem.c called directly from elsewhere:
5055 */
56
+extern const struct fs_parameter_spec shmem_fs_parameters[];
5157 extern int shmem_init(void);
52
-extern int shmem_fill_super(struct super_block *sb, void *data, int silent);
58
+extern int shmem_init_fs_context(struct fs_context *fc);
5359 extern struct file *shmem_file_setup(const char *name,
5460 loff_t size, unsigned long flags);
5561 extern struct file *shmem_kernel_file_setup(const char *name, loff_t size,
....@@ -72,11 +78,14 @@
7278 extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
7379 pgoff_t index, gfp_t gfp_mask);
7480 extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end);
75
-extern int shmem_unuse(swp_entry_t entry, struct page *page);
81
+extern int shmem_unuse(unsigned int type, bool frontswap,
82
+ unsigned long *fs_pages_to_unuse);
7683
84
+extern bool shmem_huge_enabled(struct vm_area_struct *vma);
7785 extern unsigned long shmem_swap_usage(struct vm_area_struct *vma);
7886 extern unsigned long shmem_partial_swap_usage(struct address_space *mapping,
7987 pgoff_t start, pgoff_t end);
88
+extern void shmem_mark_page_lazyfree(struct page *page, bool tail);
8089
8190 /* Flag allocation requirements to shmem_getpage */
8291 enum sgp_type {
....@@ -110,30 +119,18 @@
110119 extern bool shmem_charge(struct inode *inode, long pages);
111120 extern void shmem_uncharge(struct inode *inode, long pages);
112121
113
-#ifdef CONFIG_TRANSPARENT_HUGE_PAGECACHE
114
-extern bool shmem_huge_enabled(struct vm_area_struct *vma);
115
-#else
116
-static inline bool shmem_huge_enabled(struct vm_area_struct *vma)
117
-{
118
- return false;
119
-}
120
-#endif
121
-
122
+#ifdef CONFIG_USERFAULTFD
122123 #ifdef CONFIG_SHMEM
123
-extern int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd,
124
+extern int shmem_mfill_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd,
124125 struct vm_area_struct *dst_vma,
125126 unsigned long dst_addr,
126127 unsigned long src_addr,
128
+ bool zeropage,
127129 struct page **pagep);
128
-extern int shmem_mfill_zeropage_pte(struct mm_struct *dst_mm,
129
- pmd_t *dst_pmd,
130
- struct vm_area_struct *dst_vma,
131
- unsigned long dst_addr);
132
-#else
133
-#define shmem_mcopy_atomic_pte(dst_mm, dst_pte, dst_vma, dst_addr, \
134
- src_addr, pagep) ({ BUG(); 0; })
135
-#define shmem_mfill_zeropage_pte(dst_mm, dst_pmd, dst_vma, \
136
- dst_addr) ({ BUG(); 0; })
137
-#endif
130
+#else /* !CONFIG_SHMEM */
131
+#define shmem_mfill_atomic_pte(dst_mm, dst_pmd, dst_vma, dst_addr, \
132
+ src_addr, zeropage, pagep) ({ BUG(); 0; })
133
+#endif /* CONFIG_SHMEM */
134
+#endif /* CONFIG_USERFAULTFD */
138135
139136 #endif