shmem_fs.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. #ifdef CONFIG_TMPFS_POSIX_ACL
  19. struct posix_acl *i_acl;
  20. struct posix_acl *i_default_acl;
  21. #endif
  22. };
  23. struct shmem_sb_info {
  24. unsigned long max_blocks; /* How many blocks are allowed */
  25. unsigned long free_blocks; /* How many are left for allocation */
  26. unsigned long max_inodes; /* How many inodes are allowed */
  27. unsigned long free_inodes; /* How many are left for allocation */
  28. int policy; /* Default NUMA memory alloc policy */
  29. nodemask_t policy_nodes; /* nodemask for preferred and bind */
  30. spinlock_t stat_lock;
  31. };
  32. static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
  33. {
  34. return container_of(inode, struct shmem_inode_info, vfs_inode);
  35. }
  36. #ifdef CONFIG_TMPFS_POSIX_ACL
  37. int shmem_permission(struct inode *, int, struct nameidata *);
  38. int shmem_acl_init(struct inode *, struct inode *);
  39. void shmem_acl_destroy_inode(struct inode *);
  40. extern struct xattr_handler shmem_xattr_acl_access_handler;
  41. extern struct xattr_handler shmem_xattr_acl_default_handler;
  42. extern struct generic_acl_operations shmem_acl_ops;
  43. #else
  44. static inline int shmem_acl_init(struct inode *inode, struct inode *dir)
  45. {
  46. return 0;
  47. }
  48. static inline void shmem_acl_destroy_inode(struct inode *inode)
  49. {
  50. }
  51. #endif /* CONFIG_TMPFS_POSIX_ACL */
  52. #endif