| .. | .. |
|---|
| 8 | 8 | #include <linux/pagemap.h> |
|---|
| 9 | 9 | #include <linux/percpu_counter.h> |
|---|
| 10 | 10 | #include <linux/xattr.h> |
|---|
| 11 | +#include <linux/fs_parser.h> |
|---|
| 11 | 12 | |
|---|
| 12 | 13 | /* inode in-kernel data */ |
|---|
| 13 | 14 | |
|---|
| .. | .. |
|---|
| 21 | 22 | struct list_head swaplist; /* chain of maybes on swap */ |
|---|
| 22 | 23 | struct shared_policy policy; /* NUMA memory alloc policy */ |
|---|
| 23 | 24 | struct simple_xattrs xattrs; /* list of xattrs */ |
|---|
| 25 | + atomic_t stop_eviction; /* hold when working on inode */ |
|---|
| 24 | 26 | struct inode vfs_inode; |
|---|
| 25 | 27 | }; |
|---|
| 26 | 28 | |
|---|
| .. | .. |
|---|
| 34 | 36 | unsigned char huge; /* Whether to try for hugepages */ |
|---|
| 35 | 37 | kuid_t uid; /* Mount uid for root directory */ |
|---|
| 36 | 38 | 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 */ |
|---|
| 37 | 42 | struct mempolicy *mpol; /* default memory policy for mappings */ |
|---|
| 38 | 43 | spinlock_t shrinklist_lock; /* Protects shrinklist */ |
|---|
| 39 | 44 | struct list_head shrinklist; /* List of shinkable inodes */ |
|---|
| .. | .. |
|---|
| 48 | 53 | /* |
|---|
| 49 | 54 | * Functions in mm/shmem.c called directly from elsewhere: |
|---|
| 50 | 55 | */ |
|---|
| 56 | +extern const struct fs_parameter_spec shmem_fs_parameters[]; |
|---|
| 51 | 57 | 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); |
|---|
| 53 | 59 | extern struct file *shmem_file_setup(const char *name, |
|---|
| 54 | 60 | loff_t size, unsigned long flags); |
|---|
| 55 | 61 | extern struct file *shmem_kernel_file_setup(const char *name, loff_t size, |
|---|
| .. | .. |
|---|
| 72 | 78 | extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping, |
|---|
| 73 | 79 | pgoff_t index, gfp_t gfp_mask); |
|---|
| 74 | 80 | 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); |
|---|
| 76 | 83 | |
|---|
| 84 | +extern bool shmem_huge_enabled(struct vm_area_struct *vma); |
|---|
| 77 | 85 | extern unsigned long shmem_swap_usage(struct vm_area_struct *vma); |
|---|
| 78 | 86 | extern unsigned long shmem_partial_swap_usage(struct address_space *mapping, |
|---|
| 79 | 87 | pgoff_t start, pgoff_t end); |
|---|
| 88 | +extern void shmem_mark_page_lazyfree(struct page *page, bool tail); |
|---|
| 80 | 89 | |
|---|
| 81 | 90 | /* Flag allocation requirements to shmem_getpage */ |
|---|
| 82 | 91 | enum sgp_type { |
|---|
| .. | .. |
|---|
| 110 | 119 | extern bool shmem_charge(struct inode *inode, long pages); |
|---|
| 111 | 120 | extern void shmem_uncharge(struct inode *inode, long pages); |
|---|
| 112 | 121 | |
|---|
| 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 |
|---|
| 122 | 123 | #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, |
|---|
| 124 | 125 | struct vm_area_struct *dst_vma, |
|---|
| 125 | 126 | unsigned long dst_addr, |
|---|
| 126 | 127 | unsigned long src_addr, |
|---|
| 128 | + bool zeropage, |
|---|
| 127 | 129 | 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 */ |
|---|
| 138 | 135 | |
|---|
| 139 | 136 | #endif |
|---|