Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Typedefs | Enumerations | Functions
pagemap.h File Reference
#include <linux/mm.h>
#include <linux/fs.h>
#include <linux/list.h>
#include <linux/highmem.h>
#include <linux/compiler.h>
#include <asm/uaccess.h>
#include <linux/gfp.h>
#include <linux/bitops.h>
#include <linux/hardirq.h>
#include <linux/hugetlb_inline.h>

Go to the source code of this file.

Macros

#define PAGE_CACHE_SHIFT   PAGE_SHIFT
 
#define PAGE_CACHE_SIZE   PAGE_SIZE
 
#define PAGE_CACHE_MASK   PAGE_MASK
 
#define PAGE_CACHE_ALIGN(addr)   (((addr)+PAGE_CACHE_SIZE-1)&PAGE_CACHE_MASK)
 
#define page_cache_get(page)   get_page(page)
 
#define page_cache_release(page)   put_page(page)
 

Typedefs

typedef int filler_t (void *, struct page *)
 

Enumerations

enum  mapping_flags { AS_EIO = __GFP_BITS_SHIFT + 0, AS_ENOSPC = __GFP_BITS_SHIFT + 1, AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3 }
 

Functions

void release_pages (struct page **pages, int nr, int cold)
 
struct pagefind_get_page (struct address_space *mapping, pgoff_t index)
 
struct pagefind_lock_page (struct address_space *mapping, pgoff_t index)
 
struct pagefind_or_create_page (struct address_space *mapping, pgoff_t index, gfp_t gfp_mask)
 
unsigned find_get_pages (struct address_space *mapping, pgoff_t start, unsigned int nr_pages, struct page **pages)
 
unsigned find_get_pages_contig (struct address_space *mapping, pgoff_t start, unsigned int nr_pages, struct page **pages)
 
unsigned find_get_pages_tag (struct address_space *mapping, pgoff_t *index, int tag, unsigned int nr_pages, struct page **pages)
 
struct pagegrab_cache_page_write_begin (struct address_space *mapping, pgoff_t index, unsigned flags)
 
struct pagegrab_cache_page_nowait (struct address_space *mapping, pgoff_t index)
 
struct pageread_cache_page_async (struct address_space *mapping, pgoff_t index, filler_t *filler, void *data)
 
struct pageread_cache_page (struct address_space *mapping, pgoff_t index, filler_t *filler, void *data)
 
struct pageread_cache_page_gfp (struct address_space *mapping, pgoff_t index, gfp_t gfp_mask)
 
int read_cache_pages (struct address_space *mapping, struct list_head *pages, filler_t *filler, void *data)
 
pgoff_t linear_hugepage_index (struct vm_area_struct *vma, unsigned long address)
 
void __lock_page (struct page *page)
 
int __lock_page_killable (struct page *page)
 
int __lock_page_or_retry (struct page *page, struct mm_struct *mm, unsigned int flags)
 
void unlock_page (struct page *page)
 
void wait_on_page_bit (struct page *page, int bit_nr)
 
int wait_on_page_bit_killable (struct page *page, int bit_nr)
 
void end_page_writeback (struct page *page)
 
void add_page_wait_queue (struct page *page, wait_queue_t *waiter)
 
int add_to_page_cache_locked (struct page *page, struct address_space *mapping, pgoff_t index, gfp_t gfp_mask)
 
int add_to_page_cache_lru (struct page *page, struct address_space *mapping, pgoff_t index, gfp_t gfp_mask)
 
void delete_from_page_cache (struct page *page)
 
void __delete_from_page_cache (struct page *page)
 
int replace_page_cache_page (struct page *old, struct page *new, gfp_t gfp_mask)
 

Macro Definition Documentation

#define PAGE_CACHE_ALIGN (   addr)    (((addr)+PAGE_CACHE_SIZE-1)&PAGE_CACHE_MASK)

Definition at line 82 of file pagemap.h.

#define page_cache_get (   page)    get_page(page)

Definition at line 84 of file pagemap.h.

#define PAGE_CACHE_MASK   PAGE_MASK

Definition at line 81 of file pagemap.h.

#define page_cache_release (   page)    put_page(page)

Definition at line 85 of file pagemap.h.

#define PAGE_CACHE_SHIFT   PAGE_SHIFT

Definition at line 79 of file pagemap.h.

#define PAGE_CACHE_SIZE   PAGE_SIZE

Definition at line 80 of file pagemap.h.

Typedef Documentation

typedef int filler_t(void *, struct page *)

Definition at line 228 of file pagemap.h.

Enumeration Type Documentation

Enumerator:
AS_EIO 
AS_ENOSPC 
AS_MM_ALL_LOCKS 
AS_UNEVICTABLE 

Definition at line 22 of file pagemap.h.

Function Documentation

void __delete_from_page_cache ( struct page page)

Definition at line 112 of file filemap.c.

void __lock_page ( struct page page)

Definition at line 618 of file filemap.c.

int __lock_page_killable ( struct page page)

Definition at line 627 of file filemap.c.

int __lock_page_or_retry ( struct page page,
struct mm_struct mm,
unsigned int  flags 
)

Definition at line 636 of file filemap.c.

void add_page_wait_queue ( struct page page,
wait_queue_t waiter 
)

Definition at line 565 of file filemap.c.

int add_to_page_cache_locked ( struct page page,
struct address_space mapping,
pgoff_t  index,
gfp_t  gfp_mask 
)

Definition at line 442 of file filemap.c.

int add_to_page_cache_lru ( struct page page,
struct address_space mapping,
pgoff_t  index,
gfp_t  gfp_mask 
)

Definition at line 482 of file filemap.c.

void delete_from_page_cache ( struct page page)

Definition at line 156 of file filemap.c.

void end_page_writeback ( struct page page)

Definition at line 601 of file filemap.c.

struct page* find_get_page ( struct address_space mapping,
pgoff_t  offset 
)
read

find_get_page - find and get a page reference : the address_space to search : the page index

Is there a pagecache struct page at the given (mapping, offset) tuple? If yes, increment its refcount and return it; if no, return NULL.

Definition at line 676 of file filemap.c.

unsigned find_get_pages ( struct address_space mapping,
pgoff_t  start,
unsigned int  nr_pages,
struct page **  pages 
)

find_get_pages - gang pagecache lookup : The address_space to search : The starting page index : The maximum number of pages : Where the resulting pages are placed

find_get_pages() will search for and return a group of up to pages in the mapping. The pages are placed at . find_get_pages() takes a reference against the returned pages.

The search returns a group of mapping-contiguous pages with ascending indexes. There may be holes in the indices due to not-present pages.

find_get_pages() returns the number of pages which were found.

Definition at line 812 of file filemap.c.

unsigned find_get_pages_contig ( struct address_space mapping,
pgoff_t  index,
unsigned int  nr_pages,
struct page **  pages 
)

find_get_pages_contig - gang contiguous pagecache lookup : The address_space to search : The starting page index : The maximum number of pages : Where the resulting pages are placed

find_get_pages_contig() works exactly like find_get_pages(), except that the returned number of pages are guaranteed to be contiguous.

find_get_pages_contig() returns the number of pages which were found.

Definition at line 879 of file filemap.c.

unsigned find_get_pages_tag ( struct address_space mapping,
pgoff_t index,
int  tag,
unsigned int  nr_pages,
struct page **  pages 
)

find_get_pages_tag - find and return pages that match : the address_space to search : the starting page index : the tag index : the maximum number of pages : where the resulting pages are placed

Like find_get_pages, except we only return pages which are tagged with . We update to index the next page for the traversal.

Definition at line 955 of file filemap.c.

struct page* find_lock_page ( struct address_space mapping,
pgoff_t  offset 
)
read

find_lock_page - locate, pin and lock a pagecache page : the address_space to search : the page index

Locates the desired pagecache page, locks it, increments its reference count and returns its address.

Returns zero if the page was not present. find_lock_page() may sleep.

Definition at line 729 of file filemap.c.

struct page* find_or_create_page ( struct address_space mapping,
pgoff_t  index,
gfp_t  gfp_mask 
)
read

find_or_create_page - locate or add a pagecache page : the page's address_space : the page's index into the mapping : page allocation mode

Locates a page in the pagecache. If the page is not present, a new page is allocated using and is added to the pagecache and to the VM's LRU list. The returned page is locked and has its reference count incremented.

find_or_create_page() may sleep, even if specifies an atomic allocation!

find_or_create_page() returns the desired page's address, or zero on memory exhaustion.

Definition at line 766 of file filemap.c.

struct page* grab_cache_page_nowait ( struct address_space mapping,
pgoff_t  index 
)
read

grab_cache_page_nowait - returns locked page at given index in given cache : target address_space : the page index

Same as grab_cache_page(), but do not wait if the page is unavailable. This is intended for speculative data generators, where the data can be regenerated if the page couldn't be grabbed. This routine should be safe to call while holding the lock for another page.

Clear __GFP_FS when allocating the page to avoid recursion into the fs and deadlock against the caller's locked page.

Definition at line 1028 of file filemap.c.

struct page* grab_cache_page_write_begin ( struct address_space mapping,
pgoff_t  index,
unsigned  flags 
)
read

Definition at line 2247 of file filemap.c.

pgoff_t linear_hugepage_index ( struct vm_area_struct vma,
unsigned long  address 
)

Definition at line 303 of file hugetlb.c.

struct page* read_cache_page ( struct address_space mapping,
pgoff_t  index,
filler_t filler,
void data 
)
read
struct page* read_cache_page_async ( struct address_space mapping,
pgoff_t  index,
filler_t filler,
void data 
)
read
struct page* read_cache_page_gfp ( struct address_space mapping,
pgoff_t  index,
gfp_t  gfp 
)
read

read_cache_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 is the same as "read_mapping_page(mapping, index, NULL)", but with any new page allocations done using the specified allocation flags.

If the page does not get brought uptodate, return -EIO.

Definition at line 1894 of file filemap.c.

int read_cache_pages ( struct address_space mapping,
struct list_head pages,
filler_t filler,
void data 
)
void release_pages ( struct page **  pages,
int  nr,
int  cold 
)

Definition at line 670 of file swap.c.

int replace_page_cache_page ( struct page old,
struct page new,
gfp_t  gfp_mask 
)

replace_page_cache_page - replace a pagecache page with a new one : page to be replaced : page to replace with : allocation mode

This function replaces a page in the pagecache with a new one. On success it acquires the pagecache reference for the new page and drops it for the old page. Both the old and new pages must be locked. This function does not add the new page to the LRU, the caller must do that.

The remove + add is atomic. The only way this function can fail is memory allocation failure.

Definition at line 391 of file filemap.c.

void unlock_page ( struct page page)

Definition at line 588 of file filemap.c.

void wait_on_page_bit ( struct page page,
int  bit_nr 
)

Definition at line 537 of file filemap.c.

int wait_on_page_bit_killable ( struct page page,
int  bit_nr 
)

Definition at line 547 of file filemap.c.