shmem_fs.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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;
  25. };
  26. static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
  27. {
  28. return container_of(inode, struct shmem_inode_info, vfs_inode);
  29. }
  30. #endif