Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __SHMEM_FS_H |
| 2 | #define __SHMEM_FS_H |
| 3 | |
| 4 | #include <linux/swap.h> |
| 5 | #include <linux/mempolicy.h> |
| 6 | |
| 7 | /* inode in-kernel data */ |
| 8 | |
| 9 | #define SHMEM_NR_DIRECT 16 |
| 10 | |
| 11 | struct shmem_inode_info { |
| 12 | spinlock_t lock; |
| 13 | unsigned long flags; |
| 14 | unsigned long alloced; /* data pages alloced to file */ |
| 15 | unsigned long swapped; /* subtotal assigned to swap */ |
| 16 | unsigned long next_index; /* highest alloced index + 1 */ |
| 17 | struct shared_policy policy; /* NUMA memory alloc policy */ |
| 18 | struct page *i_indirect; /* top indirect blocks page */ |
| 19 | swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* first blocks */ |
| 20 | struct list_head swaplist; /* chain of maybes on swap */ |
| 21 | struct inode vfs_inode; |
| 22 | }; |
| 23 | |
| 24 | struct shmem_sb_info { |
| 25 | unsigned long max_blocks; /* How many blocks are allowed */ |
| 26 | unsigned long free_blocks; /* How many are left for allocation */ |
| 27 | unsigned long max_inodes; /* How many inodes are allowed */ |
| 28 | unsigned long free_inodes; /* How many are left for allocation */ |
akpm@linux-foundation.org | 680d794 | 2008-02-08 04:21:48 -0800 | [diff] [blame] | 29 | spinlock_t stat_lock; /* Serialize shmem_sb_info changes */ |
| 30 | uid_t uid; /* Mount uid for root directory */ |
| 31 | gid_t gid; /* Mount gid for root directory */ |
| 32 | mode_t mode; /* Mount mode for root directory */ |
Lee Schermerhorn | 71fe804 | 2008-04-28 02:13:26 -0700 | [diff] [blame] | 33 | struct mempolicy *mpol; /* default memory policy for mappings */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | static inline struct shmem_inode_info *SHMEM_I(struct inode *inode) |
| 37 | { |
| 38 | return container_of(inode, struct shmem_inode_info, vfs_inode); |
| 39 | } |
| 40 | |
Kay Sievers | 2b2af54 | 2009-04-30 15:23:42 +0200 | [diff] [blame] | 41 | extern int init_tmpfs(void); |
| 42 | extern int shmem_fill_super(struct super_block *sb, void *data, int silent); |
| 43 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #endif |