Lines Matching refs:page

20 static int afs_readpage(struct file *file, struct page *page);
21 static void afs_invalidatepage(struct page *page, unsigned int offset,
23 static int afs_releasepage(struct page *page, gfp_t gfp_flags);
207 * deal with notification that a page was read from the cache
209 static void afs_file_readpage_read_complete(struct page *page,
213 _enter("%p,%p,%d", page, data, error);
215 /* if the read completes with an error, we just unlock the page and let
218 SetPageUptodate(page);
219 unlock_page(page);
272 * read page from file, directory or symlink, given a key to use
274 int afs_page_filler(void *data, struct page *page)
276 struct inode *inode = page->mapping->host;
282 _enter("{%x},{%lu},{%lu}", key_serial(key), inode->i_ino, page->index);
284 BUG_ON(!PageLocked(page));
293 page,
301 /* read BIO submitted (page in cache) */
305 /* page not yet cached */
310 /* page will not be cached */
321 /* We request a full page. If the page is a partial one at the
326 req->pos = (loff_t)page->index << PAGE_SHIFT;
330 req->pages[0] = page;
331 get_page(page);
334 * page */
347 fscache_uncache_page(vnode->cache, page);
349 BUG_ON(PageFsCache(page));
359 SetPageUptodate(page);
361 /* send the page to the cache */
363 if (PageFsCache(page) &&
364 fscache_write_page(vnode->cache, page, vnode->status.size,
366 fscache_uncache_page(vnode->cache, page);
367 BUG_ON(PageFsCache(page));
370 unlock_page(page);
377 SetPageError(page);
382 unlock_page(page);
388 * read page from file, directory or symlink, given a file to nominate the key
391 static int afs_readpage(struct file *file, struct page *page)
399 ret = afs_page_filler(key, page);
401 struct inode *inode = page->mapping->host;
406 ret = afs_page_filler(key, page);
421 struct page *page = req->pages[req->index];
424 SetPageUptodate(page);
426 /* send the page to the cache */
428 if (PageFsCache(page) &&
429 fscache_write_page(vnode->cache, page, vnode->status.size,
431 fscache_uncache_page(vnode->cache, page);
432 BUG_ON(PageFsCache(page));
435 unlock_page(page);
436 put_page(page);
448 struct page *first, *page;
460 page = list_entry(p, struct page, lru);
461 if (page->index != index)
485 * page at the end of the file.
488 page = lru_to_page(pages);
489 list_del(&page->lru);
490 index = page->index;
491 if (add_to_page_cache_lru(page, mapping, index,
494 fscache_uncache_page(vnode->cache, page);
496 put_page(page);
500 req->pages[req->nr_pages++] = page;
526 page = req->pages[i];
527 if (page) {
529 fscache_uncache_page(vnode->cache, page);
531 SetPageError(page);
532 unlock_page(page);
604 * Adjust the dirty region of the page on truncation or full invalidation,
607 static void afs_invalidate_dirty(struct page *page, unsigned int offset,
610 struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
614 priv = page_private(page);
616 /* we clean up only if the entire page is being invalidated */
617 if (offset == 0 && length == thp_size(page))
620 /* If the page was dirtied by page_mkwrite(), the PTE stays writable
648 set_page_private(page, priv);
649 trace_afs_page_dirty(vnode, tracepoint_string("trunc"), page->index, priv);
653 trace_afs_page_dirty(vnode, tracepoint_string("undirty"), page->index, priv);
654 clear_page_dirty_for_io(page);
656 priv = (unsigned long)detach_page_private(page);
657 trace_afs_page_dirty(vnode, tracepoint_string("inval"), page->index, priv);
661 * invalidate part or all of a page
662 * - release a page and clean up its private data if offset is 0 (indicating
663 * the entire page)
665 static void afs_invalidatepage(struct page *page, unsigned int offset,
668 _enter("{%lu},%u,%u", page->index, offset, length);
670 BUG_ON(!PageLocked(page));
673 /* we clean up only if the entire page is being invalidated */
675 if (PageFsCache(page)) {
676 struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
677 fscache_wait_on_page_write(vnode->cache, page);
678 fscache_uncache_page(vnode->cache, page);
683 if (PagePrivate(page))
684 afs_invalidate_dirty(page, offset, length);
690 * release a page and clean up its private state if it's not busy
691 * - return true if the page can now be released, false if not
693 static int afs_releasepage(struct page *page, gfp_t gfp_flags)
695 struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
699 vnode->fid.vid, vnode->fid.vnode, page->index, page->flags,
702 /* deny if page is being written to the cache and the caller hasn't
705 if (!fscache_maybe_release_page(vnode->cache, page, gfp_flags)) {
711 if (PagePrivate(page)) {
712 priv = (unsigned long)detach_page_private(page);
714 page->index, priv);
717 /* indicate that the page can be released */