Blame view
include/linux/shmem_fs.h
4.37 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 |
#ifndef __SHMEM_FS_H #define __SHMEM_FS_H |
40e041a2c shm: add sealing API |
3 |
#include <linux/file.h> |
1da177e4c Linux-2.6.12-rc2 |
4 5 |
#include <linux/swap.h> #include <linux/mempolicy.h> |
d9d90e5eb tmpfs: add shmem_... |
6 |
#include <linux/pagemap.h> |
7e496299d tmpfs: make tmpfs... |
7 |
#include <linux/percpu_counter.h> |
38f386574 xattr: extract si... |
8 |
#include <linux/xattr.h> |
1da177e4c Linux-2.6.12-rc2 |
9 10 |
/* inode in-kernel data */ |
1da177e4c Linux-2.6.12-rc2 |
11 12 |
struct shmem_inode_info { spinlock_t lock; |
40e041a2c shm: add sealing API |
13 |
unsigned int seals; /* shmem seals */ |
1da177e4c Linux-2.6.12-rc2 |
14 15 |
unsigned long flags; unsigned long alloced; /* data pages alloced to file */ |
3ed47db34 make sure that fr... |
16 |
unsigned long swapped; /* subtotal assigned to swap */ |
779750d20 shmem: split huge... |
17 |
struct list_head shrinklist; /* shrinkable hpage inodes */ |
1da177e4c Linux-2.6.12-rc2 |
18 |
struct list_head swaplist; /* chain of maybes on swap */ |
779750d20 shmem: split huge... |
19 |
struct shared_policy policy; /* NUMA memory alloc policy */ |
38f386574 xattr: extract si... |
20 |
struct simple_xattrs xattrs; /* list of xattrs */ |
1da177e4c Linux-2.6.12-rc2 |
21 22 23 24 25 |
struct inode vfs_inode; }; struct shmem_sb_info { unsigned long max_blocks; /* How many blocks are allowed */ |
7e496299d tmpfs: make tmpfs... |
26 |
struct percpu_counter used_blocks; /* How many are allocated */ |
1da177e4c Linux-2.6.12-rc2 |
27 28 |
unsigned long max_inodes; /* How many inodes are allowed */ unsigned long free_inodes; /* How many are left for allocation */ |
680d794ba mount options: fi... |
29 |
spinlock_t stat_lock; /* Serialize shmem_sb_info changes */ |
5a6e75f81 shmem: prepare hu... |
30 31 |
umode_t mode; /* Mount mode for root directory */ unsigned char huge; /* Whether to try for hugepages */ |
8751e0395 userns: Convert t... |
32 33 |
kuid_t uid; /* Mount uid for root directory */ kgid_t gid; /* Mount gid for root directory */ |
71fe804b6 mempolicy: use st... |
34 |
struct mempolicy *mpol; /* default memory policy for mappings */ |
779750d20 shmem: split huge... |
35 36 37 |
spinlock_t shrinklist_lock; /* Protects shrinklist */ struct list_head shrinklist; /* List of shinkable inodes */ unsigned long shrinklist_len; /* Length of shrinklist */ |
1da177e4c Linux-2.6.12-rc2 |
38 39 40 41 42 43 |
}; static inline struct shmem_inode_info *SHMEM_I(struct inode *inode) { return container_of(inode, struct shmem_inode_info, vfs_inode); } |
072441e21 mm: move shmem pr... |
44 45 46 |
/* * Functions in mm/shmem.c called directly from elsewhere: */ |
41ffe5d5c tmpfs: miscellane... |
47 |
extern int shmem_init(void); |
2b2af54a5 Driver Core: devt... |
48 |
extern int shmem_fill_super(struct super_block *sb, void *data, int silent); |
072441e21 mm: move shmem pr... |
49 50 |
extern struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); |
c72770909 security: shmem: ... |
51 52 |
extern struct file *shmem_kernel_file_setup(const char *name, loff_t size, unsigned long flags); |
072441e21 mm: move shmem pr... |
53 |
extern int shmem_zero_setup(struct vm_area_struct *); |
c01d5b300 shmem: get_unmapp... |
54 55 |
extern unsigned long shmem_get_unmapped_area(struct file *, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags); |
072441e21 mm: move shmem pr... |
56 |
extern int shmem_lock(struct file *file, int lock, struct user_struct *user); |
0cd6144aa mm + fs: prepare ... |
57 |
extern bool shmem_mapping(struct address_space *mapping); |
245132643 SHM_UNLOCK: fix U... |
58 |
extern void shmem_unlock_mapping(struct address_space *mapping); |
d9d90e5eb tmpfs: add shmem_... |
59 60 |
extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping, pgoff_t index, gfp_t gfp_mask); |
94c1e62df tmpfs: take contr... |
61 |
extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end); |
072441e21 mm: move shmem pr... |
62 |
extern int shmem_unuse(swp_entry_t entry, struct page *page); |
2b2af54a5 Driver Core: devt... |
63 |
|
6a15a3709 mm, proc: reduce ... |
64 |
extern unsigned long shmem_swap_usage(struct vm_area_struct *vma); |
48131e03c mm, proc: reduce ... |
65 66 |
extern unsigned long shmem_partial_swap_usage(struct address_space *mapping, pgoff_t start, pgoff_t end); |
6a15a3709 mm, proc: reduce ... |
67 |
|
f3f0e1d21 khugepaged: add s... |
68 69 70 71 72 73 74 75 76 77 78 79 |
/* Flag allocation requirements to shmem_getpage */ enum sgp_type { SGP_READ, /* don't exceed i_size, don't allocate page */ SGP_CACHE, /* don't exceed i_size, may allocate page */ SGP_NOHUGE, /* like SGP_CACHE, but no huge pages */ SGP_HUGE, /* like SGP_CACHE, huge pages preferred */ SGP_WRITE, /* may exceed i_size, may allocate !Uptodate page */ SGP_FALLOC, /* like SGP_WRITE, but make existing page Uptodate */ }; extern int shmem_getpage(struct inode *inode, pgoff_t index, struct page **pagep, enum sgp_type sgp); |
d9d90e5eb tmpfs: add shmem_... |
80 81 82 83 84 85 |
static inline struct page *shmem_read_mapping_page( struct address_space *mapping, pgoff_t index) { return shmem_read_mapping_page_gfp(mapping, index, mapping_gfp_mask(mapping)); } |
f3f0e1d21 khugepaged: add s... |
86 87 88 89 90 91 92 93 |
static inline bool shmem_file(struct file *file) { if (!IS_ENABLED(CONFIG_SHMEM)) return false; if (!file || !file->f_mapping) return false; return shmem_mapping(file->f_mapping); } |
800d8c63b shmem: add huge p... |
94 95 |
extern bool shmem_charge(struct inode *inode, long pages); extern void shmem_uncharge(struct inode *inode, long pages); |
40e041a2c shm: add sealing API |
96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
#ifdef CONFIG_TMPFS extern int shmem_add_seals(struct file *file, unsigned int seals); extern int shmem_get_seals(struct file *file); extern long shmem_fcntl(struct file *file, unsigned int cmd, unsigned long arg); #else static inline long shmem_fcntl(struct file *f, unsigned int c, unsigned long a) { return -EINVAL; } #endif |
e496cf3d7 thp: introduce CO... |
110 111 112 113 114 115 116 117 |
#ifdef CONFIG_TRANSPARENT_HUGE_PAGECACHE extern bool shmem_huge_enabled(struct vm_area_struct *vma); #else static inline bool shmem_huge_enabled(struct vm_area_struct *vma) { return false; } #endif |
1da177e4c Linux-2.6.12-rc2 |
118 |
#endif |