2005-04-17 06:20:36 +08:00
|
|
|
#ifndef __SHMEM_FS_H
|
|
|
|
#define __SHMEM_FS_H
|
|
|
|
|
|
|
|
#include <linux/swap.h>
|
|
|
|
#include <linux/mempolicy.h>
|
|
|
|
|
|
|
|
/* inode in-kernel data */
|
|
|
|
|
|
|
|
#define SHMEM_NR_DIRECT 16
|
|
|
|
|
|
|
|
struct shmem_inode_info {
|
|
|
|
spinlock_t lock;
|
|
|
|
unsigned long flags;
|
|
|
|
unsigned long alloced; /* data pages alloced to file */
|
|
|
|
unsigned long swapped; /* subtotal assigned to swap */
|
|
|
|
unsigned long next_index; /* highest alloced index + 1 */
|
|
|
|
struct shared_policy policy; /* NUMA memory alloc policy */
|
|
|
|
struct page *i_indirect; /* top indirect blocks page */
|
|
|
|
swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* first blocks */
|
|
|
|
struct list_head swaplist; /* chain of maybes on swap */
|
|
|
|
struct inode vfs_inode;
|
2006-09-29 17:01:35 +08:00
|
|
|
#ifdef CONFIG_TMPFS_POSIX_ACL
|
|
|
|
struct posix_acl *i_acl;
|
|
|
|
struct posix_acl *i_default_acl;
|
|
|
|
#endif
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
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 */
|
2008-02-08 20:21:48 +08:00
|
|
|
spinlock_t stat_lock; /* Serialize shmem_sb_info changes */
|
|
|
|
uid_t uid; /* Mount uid for root directory */
|
|
|
|
gid_t gid; /* Mount gid for root directory */
|
|
|
|
mode_t mode; /* Mount mode for root directory */
|
mempolicy: convert MPOL constants to enum
The mempolicy mode constants, MPOL_DEFAULT, MPOL_PREFERRED, MPOL_BIND, and
MPOL_INTERLEAVE, are better declared as part of an enum since they are
sequentially numbered and cannot be combined.
The policy member of struct mempolicy is also converted from type short to
type unsigned short. A negative policy does not have any legitimate meaning,
so it is possible to change its type in preparation for adding optional mode
flags later.
The equivalent member of struct shmem_sb_info is also changed from int to
unsigned short.
For compatibility, the policy formal to get_mempolicy() remains as a pointer
to an int:
int get_mempolicy(int *policy, unsigned long *nmask,
unsigned long maxnode, unsigned long addr,
unsigned long flags);
although the only possible values is the range of type unsigned short.
Cc: Paul Jackson <pj@sgi.com>
Cc: Christoph Lameter <clameter@sgi.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 17:12:23 +08:00
|
|
|
unsigned short policy; /* Default NUMA memory alloc policy */
|
2008-04-28 17:12:25 +08:00
|
|
|
unsigned short flags; /* Optional mempolicy flags */
|
2006-01-15 05:20:48 +08:00
|
|
|
nodemask_t policy_nodes; /* nodemask for preferred and bind */
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
|
|
|
|
{
|
|
|
|
return container_of(inode, struct shmem_inode_info, vfs_inode);
|
|
|
|
}
|
|
|
|
|
2006-09-29 17:01:35 +08:00
|
|
|
#ifdef CONFIG_TMPFS_POSIX_ACL
|
|
|
|
int shmem_permission(struct inode *, int, struct nameidata *);
|
|
|
|
int shmem_acl_init(struct inode *, struct inode *);
|
|
|
|
void shmem_acl_destroy_inode(struct inode *);
|
|
|
|
|
|
|
|
extern struct xattr_handler shmem_xattr_acl_access_handler;
|
|
|
|
extern struct xattr_handler shmem_xattr_acl_default_handler;
|
|
|
|
|
|
|
|
extern struct generic_acl_operations shmem_acl_ops;
|
|
|
|
|
|
|
|
#else
|
|
|
|
static inline int shmem_acl_init(struct inode *inode, struct inode *dir)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static inline void shmem_acl_destroy_inode(struct inode *inode)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_TMPFS_POSIX_ACL */
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|