summaryrefslogtreecommitdiff
path: root/include/linux/shmem_fs.h
blob: dce3d7f9c2523ee219ff07b2eba30f83c78b0555 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef __SHMEM_FS_H
#define __SHMEM_FS_H

#include <linux/swap.h>

/* inode in-kernel data */

#define SHMEM_NR_DIRECT 16

extern atomic_t shmem_nrpages;

struct shmem_inode_info {
	spinlock_t		lock;
	unsigned long		next_index;
	swp_entry_t		i_direct[SHMEM_NR_DIRECT]; /* for the first blocks */
	struct page	       *i_indirect; /* indirect blocks */
	unsigned long		alloced;    /* data pages allocated to file */
	unsigned long		swapped;    /* subtotal assigned to swap */
	unsigned long		flags;
	struct list_head	list;
	struct inode		vfs_inode;
};

struct shmem_sb_info {
	unsigned long max_blocks;   /* How many blocks are allowed */
	unsigned long free_blocks;  /* How many are left for allocation */
	unsigned long max_inodes;   /* How many inodes are allowed */
	unsigned long free_inodes;  /* How many are left for allocation */
	spinlock_t    stat_lock;
};

static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
{
	return container_of(inode, struct shmem_inode_info, vfs_inode);
}

#endif