4 #include <linux/swap.h>
5 #include <linux/mempolicy.h>
7 /* inode in-kernel data */
9 #define SHMEM_NR_DIRECT 16
11 struct shmem_inode_info
{
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 #ifdef CONFIG_TMPFS_POSIX_ACL
23 struct posix_acl
*i_acl
;
24 struct posix_acl
*i_default_acl
;
28 struct shmem_sb_info
{
29 unsigned long max_blocks
; /* How many blocks are allowed */
30 unsigned long free_blocks
; /* How many are left for allocation */
31 unsigned long max_inodes
; /* How many inodes are allowed */
32 unsigned long free_inodes
; /* How many are left for allocation */
33 spinlock_t stat_lock
; /* Serialize shmem_sb_info changes */
34 uid_t uid
; /* Mount uid for root directory */
35 gid_t gid
; /* Mount gid for root directory */
36 mode_t mode
; /* Mount mode for root directory */
37 struct mempolicy
*mpol
; /* default memory policy for mappings */
40 static inline struct shmem_inode_info
*SHMEM_I(struct inode
*inode
)
42 return container_of(inode
, struct shmem_inode_info
, vfs_inode
);
45 #ifdef CONFIG_TMPFS_POSIX_ACL
46 int shmem_permission(struct inode
*, int);
47 int shmem_acl_init(struct inode
*, struct inode
*);
48 void shmem_acl_destroy_inode(struct inode
*);
50 extern struct xattr_handler shmem_xattr_acl_access_handler
;
51 extern struct xattr_handler shmem_xattr_acl_default_handler
;
53 extern struct generic_acl_operations shmem_acl_ops
;
56 static inline int shmem_acl_init(struct inode
*inode
, struct inode
*dir
)
60 static inline void shmem_acl_destroy_inode(struct inode
*inode
)
63 #endif /* CONFIG_TMPFS_POSIX_ACL */