Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
shmem.c File Reference
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/vfs.h>
#include <linux/mount.h>
#include <linux/pagemap.h>
#include <linux/file.h>
#include <linux/mm.h>
#include <linux/export.h>
#include <linux/swap.h>
#include <linux/ramfs.h>

Go to the source code of this file.

Macros

#define shmem_vm_ops   generic_file_vm_ops
 
#define shmem_file_operations   ramfs_file_operations
 
#define shmem_get_inode(sb, dir, mode, dev, flags)   ramfs_get_inode(sb, dir, mode, dev)
 
#define shmem_acct_size(flags, size)   0
 
#define shmem_unacct_size(flags, size)   do {} while (0)
 

Functions

int __init shmem_init (void)
 
int shmem_unuse (swp_entry_t swap, struct page *page)
 
int shmem_lock (struct file *file, int lock, struct user_struct *user)
 
void shmem_unlock_mapping (struct address_space *mapping)
 
void shmem_truncate_range (struct inode *inode, loff_t lstart, loff_t lend)
 
 EXPORT_SYMBOL_GPL (shmem_truncate_range)
 
: name for dentry (to be seen in /proc/<pid>/maps

shmem_file_setup - get an unlinked file living in tmpfs

: size to be set for the file : VM_NORESERVE suppresses pre-accounting of the entire object size

struct fileshmem_file_setup (const char *name, loff_t size, unsigned long flags)
 
 EXPORT_SYMBOL_GPL (shmem_file_setup)
 
int shmem_zero_setup (struct vm_area_struct *vma)
 
struct pageshmem_read_mapping_page_gfp (struct address_space *mapping, pgoff_t index, gfp_t gfp)
 
 EXPORT_SYMBOL_GPL (shmem_read_mapping_page_gfp)
 

Macro Definition Documentation

#define shmem_acct_size (   flags,
  size 
)    0

Definition at line 2771 of file shmem.c.

#define shmem_file_operations   ramfs_file_operations

Definition at line 2769 of file shmem.c.

#define shmem_get_inode (   sb,
  dir,
  mode,
  dev,
  flags 
)    ramfs_get_inode(sb, dir, mode, dev)

Definition at line 2770 of file shmem.c.

#define shmem_unacct_size (   flags,
  size 
)    do {} while (0)

Definition at line 2772 of file shmem.c.

#define shmem_vm_ops   generic_file_vm_ops

Definition at line 2768 of file shmem.c.

Function Documentation

EXPORT_SYMBOL_GPL ( shmem_truncate_range  )
EXPORT_SYMBOL_GPL ( shmem_file_setup  )
EXPORT_SYMBOL_GPL ( shmem_read_mapping_page_gfp  )
struct file* shmem_file_setup ( const char name,
loff_t  size,
unsigned long  flags 
)
read

Definition at line 2784 of file shmem.c.

int __init shmem_init ( void  )

Definition at line 2738 of file shmem.c.

int shmem_lock ( struct file file,
int  lock,
struct user_struct user 
)

Definition at line 2753 of file shmem.c.

struct page* shmem_read_mapping_page_gfp ( struct address_space mapping,
pgoff_t  index,
gfp_t  gfp 
)
read

shmem_read_mapping_page_gfp - read into page cache, using specified page allocation flags. : the page's address_space : the page index : the page allocator flags to use if allocating

This behaves as a tmpfs "read_cache_page_gfp(mapping, index, gfp)", with any new page allocations done using the specified allocation flags. But read_cache_page_gfp() uses the ->readpage() method: which does not suit tmpfs, since it may have pages in swapcache, and needs to find those for itself; although drivers/gpu/drm i915 and ttm rely upon this support.

i915_gem_object_get_pages_gtt() mixes __GFP_NORETRY | __GFP_NOWARN in with the mapping_gfp_mask(), to avoid OOMing the machine unnecessarily.

Definition at line 2877 of file shmem.c.

void shmem_truncate_range ( struct inode inode,
loff_t  lstart,
loff_t  lend 
)

Definition at line 2762 of file shmem.c.

void shmem_unlock_mapping ( struct address_space mapping)

Definition at line 2758 of file shmem.c.

int shmem_unuse ( swp_entry_t  swap,
struct page page 
)

Definition at line 2748 of file shmem.c.

int shmem_zero_setup ( struct vm_area_struct vma)

shmem_zero_setup - setup a shared anonymous mapping : the vma to be mmapped is prepared by do_mmap_pgoff

Definition at line 2846 of file shmem.c.