pagemap.h (712cba5d87a6c0e980ee5fad45734e189c4d7151) | pagemap.h (5cbc198ae08d84bd416b672ad8bd1222acd0855c) |
---|---|
1#ifndef _LINUX_PAGEMAP_H 2#define _LINUX_PAGEMAP_H 3 4/* 5 * Copyright 1995 Linus Torvalds 6 */ 7#include <linux/mm.h> 8#include <linux/fs.h> --- 360 unchanged lines hidden (view full) --- 369static inline struct page *read_mapping_page(struct address_space *mapping, 370 pgoff_t index, void *data) 371{ 372 filler_t *filler = (filler_t *)mapping->a_ops->readpage; 373 return read_cache_page(mapping, index, filler, data); 374} 375 376/* | 1#ifndef _LINUX_PAGEMAP_H 2#define _LINUX_PAGEMAP_H 3 4/* 5 * Copyright 1995 Linus Torvalds 6 */ 7#include <linux/mm.h> 8#include <linux/fs.h> --- 360 unchanged lines hidden (view full) --- 369static inline struct page *read_mapping_page(struct address_space *mapping, 370 pgoff_t index, void *data) 371{ 372 filler_t *filler = (filler_t *)mapping->a_ops->readpage; 373 return read_cache_page(mapping, index, filler, data); 374} 375 376/* |
377 * Get the offset in PAGE_SIZE. 378 * (TODO: hugepage should have ->index in PAGE_SIZE) | 377 * Get index of the page with in radix-tree 378 * (TODO: remove once hugetlb pages will have ->index in PAGE_SIZE) |
379 */ | 379 */ |
380static inline pgoff_t page_to_pgoff(struct page *page) | 380static inline pgoff_t page_to_index(struct page *page) |
381{ 382 pgoff_t pgoff; 383 | 381{ 382 pgoff_t pgoff; 383 |
384 if (unlikely(PageHeadHuge(page))) 385 return page->index << compound_order(page); 386 | |
387 if (likely(!PageTransTail(page))) 388 return page->index; 389 390 /* 391 * We don't initialize ->index for tail pages: calculate based on 392 * head page 393 */ 394 pgoff = compound_head(page)->index; 395 pgoff += page - compound_head(page); 396 return pgoff; 397} 398 399/* | 384 if (likely(!PageTransTail(page))) 385 return page->index; 386 387 /* 388 * We don't initialize ->index for tail pages: calculate based on 389 * head page 390 */ 391 pgoff = compound_head(page)->index; 392 pgoff += page - compound_head(page); 393 return pgoff; 394} 395 396/* |
397 * Get the offset in PAGE_SIZE. 398 * (TODO: hugepage should have ->index in PAGE_SIZE) 399 */ 400static inline pgoff_t page_to_pgoff(struct page *page) 401{ 402 if (unlikely(PageHeadHuge(page))) 403 return page->index << compound_order(page); 404 405 return page_to_index(page); 406} 407 408/* |
|
400 * Return byte-offset into filesystem object for page. 401 */ 402static inline loff_t page_offset(struct page *page) 403{ 404 return ((loff_t)page->index) << PAGE_SHIFT; 405} 406 407static inline loff_t page_file_offset(struct page *page) --- 210 unchanged lines hidden --- | 409 * Return byte-offset into filesystem object for page. 410 */ 411static inline loff_t page_offset(struct page *page) 412{ 413 return ((loff_t)page->index) << PAGE_SHIFT; 414} 415 416static inline loff_t page_file_offset(struct page *page) --- 210 unchanged lines hidden --- |