shmem_fs.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef __SHMEM_FS_H
  2. #define __SHMEM_FS_H
  3. #include <linux/swap.h>
  4. #include <linux/mempolicy.h>
  5. /* inode in-kernel data */
  6. #define SHMEM_NR_DIRECT 16
  7. struct shmem_inode_info {
  8. spinlock_t lock;
  9. unsigned long flags;
  10. unsigned long alloced; /* data pages alloced to file */
  11. unsigned long swapped; /* subtotal assigned to swap */
  12. unsigned long next_index; /* highest alloced index + 1 */
  13. struct shared_policy policy; /* NUMA memory alloc policy */
  14. struct page *i_indirect; /* top indirect blocks page */
  15. swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* first blocks */
  16. struct list_head swaplist; /* chain of maybes on swap */
  17. struct inode vfs_inode;
  18. };
  19. struct shmem_sb_info {
  20. unsigned long max_blocks; /* How many blocks are allowed */
  21. unsigned long free_blocks; /* How many are left for allocation */
  22. unsigned long max_inodes; /* How many inodes are allowed */
  23. unsigned long free_inodes; /* How many are left for allocation */
  24. spinlock_t stat_lock; /* Serialize shmem_sb_info changes */
  25. uid_t uid; /* Mount uid for root directory */
  26. gid_t gid; /* Mount gid for root directory */
  27. mode_t mode; /* Mount mode for root directory */
  28. struct mempolicy *mpol; /* default memory policy for mappings */
  29. };
  30. static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
  31. {
  32. return container_of(inode, struct shmem_inode_info, vfs_inode);
  33. }
  34. extern int init_tmpfs(void);
  35. extern int shmem_fill_super(struct super_block *sb, void *data, int silent);
  36. #endif