ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / linux / shmem_fs.h
1 #ifndef __SHMEM_FS_H
2 #define __SHMEM_FS_H
3
4 #include <linux/swap.h>
5
6 /* inode in-kernel data */
7
8 #define SHMEM_NR_DIRECT 16
9
10 struct shmem_inode_info {
11         spinlock_t              lock;
12         unsigned long           next_index;
13         swp_entry_t             i_direct[SHMEM_NR_DIRECT]; /* for the first blocks */
14         struct page            *i_indirect; /* indirect blocks */
15         unsigned long           alloced;    /* data pages allocated to file */
16         unsigned long           swapped;    /* subtotal assigned to swap */
17         unsigned long           flags;
18         struct list_head        list;
19         struct inode            vfs_inode;
20 };
21
22 struct shmem_sb_info {
23         unsigned long max_blocks;   /* How many blocks are allowed */
24         unsigned long free_blocks;  /* How many are left for allocation */
25         unsigned long max_inodes;   /* How many inodes are allowed */
26         unsigned long free_inodes;  /* How many are left for allocation */
27         spinlock_t    stat_lock;
28 };
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
35 #endif