• Home
  • Raw
  • Download

Lines Matching refs:page

57 static inline struct ceph_snap_context *page_snap_context(struct page *page)  in page_snap_context()  argument
59 if (PagePrivate(page)) in page_snap_context()
60 return (void *)page->private; in page_snap_context()
68 static int ceph_set_page_dirty(struct page *page) in ceph_set_page_dirty() argument
70 struct address_space *mapping = page->mapping; in ceph_set_page_dirty()
77 return !TestSetPageDirty(page); in ceph_set_page_dirty()
79 if (TestSetPageDirty(page)) { in ceph_set_page_dirty()
81 mapping->host, page, page->index); in ceph_set_page_dirty()
104 mapping->host, page, page->index, in ceph_set_page_dirty()
112 if (page->mapping) { /* Race with truncate? */ in ceph_set_page_dirty()
113 WARN_ON_ONCE(!PageUptodate(page)); in ceph_set_page_dirty()
114 account_page_dirtied(page, page->mapping); in ceph_set_page_dirty()
116 page_index(page), PAGECACHE_TAG_DIRTY); in ceph_set_page_dirty()
122 page->private = (unsigned long)snapc; in ceph_set_page_dirty()
123 SetPagePrivate(page); in ceph_set_page_dirty()
125 dout("ANON set_page_dirty %p (raced truncate?)\n", page); in ceph_set_page_dirty()
137 BUG_ON(!PageDirty(page)); in ceph_set_page_dirty()
146 static void ceph_invalidatepage(struct page *page, unsigned int offset, in ceph_invalidatepage() argument
151 struct ceph_snap_context *snapc = page_snap_context(page); in ceph_invalidatepage()
153 BUG_ON(!PageLocked(page)); in ceph_invalidatepage()
154 BUG_ON(!PagePrivate(page)); in ceph_invalidatepage()
155 BUG_ON(!page->mapping); in ceph_invalidatepage()
157 inode = page->mapping->host; in ceph_invalidatepage()
164 if (!PageDirty(page)) in ceph_invalidatepage()
165 pr_err("%p invalidatepage %p page not dirty\n", inode, page); in ceph_invalidatepage()
168 ClearPageChecked(page); in ceph_invalidatepage()
173 inode, page, page->index, offset); in ceph_invalidatepage()
176 page->private = 0; in ceph_invalidatepage()
177 ClearPagePrivate(page); in ceph_invalidatepage()
180 inode, page, page->index); in ceph_invalidatepage()
185 static int ceph_releasepage(struct page *page, gfp_t g) in ceph_releasepage() argument
187 struct inode *inode = page->mapping ? page->mapping->host : NULL; in ceph_releasepage()
188 dout("%p releasepage %p idx %lu\n", inode, page, page->index); in ceph_releasepage()
189 WARN_ON(PageDirty(page)); in ceph_releasepage()
190 WARN_ON(PagePrivate(page)); in ceph_releasepage()
197 static int readpage_nounlock(struct file *filp, struct page *page) in readpage_nounlock() argument
207 inode, filp, page, page->index); in readpage_nounlock()
209 (u64) page_offset(page), &len, in readpage_nounlock()
211 &page, 1, 0); in readpage_nounlock()
215 SetPageError(page); in readpage_nounlock()
219 zero_user_segment(page, err, PAGE_CACHE_SIZE); in readpage_nounlock()
221 SetPageUptodate(page); in readpage_nounlock()
227 static int ceph_readpage(struct file *filp, struct page *page) in ceph_readpage() argument
229 int r = readpage_nounlock(filp, page); in ceph_readpage()
230 unlock_page(page); in ceph_readpage()
254 struct page *page = osd_data->pages[i]; in finish_read() local
259 zero_user_segment(page, s, PAGE_CACHE_SIZE); in finish_read()
261 dout("finish_read %p uptodate %p idx %lu\n", inode, page, in finish_read()
262 page->index); in finish_read()
263 flush_dcache_page(page); in finish_read()
264 SetPageUptodate(page); in finish_read()
265 unlock_page(page); in finish_read()
266 page_cache_release(page); in finish_read()
272 static void ceph_unlock_page_vector(struct page **pages, int num_pages) in ceph_unlock_page_vector()
289 struct page *page = list_entry(page_list->prev, struct page, lru); in start_read() local
295 struct page **pages; in start_read()
300 off = (u64) page_offset(page); in start_read()
303 next_index = page->index; in start_read()
304 list_for_each_entry_reverse(page, page_list, lru) { in start_read()
305 if (page->index != next_index) in start_read()
331 page = list_entry(page_list->prev, struct page, lru); in start_read()
332 BUG_ON(PageLocked(page)); in start_read()
333 list_del(&page->lru); in start_read()
335 dout("start_read %p adding %p idx %lu\n", inode, page, in start_read()
336 page->index); in start_read()
337 if (add_to_page_cache_lru(page, &inode->i_data, page->index, in start_read()
339 page_cache_release(page); in start_read()
341 inode, page); in start_read()
345 pages[i] = page; in start_read()
436 static int writepage_nounlock(struct page *page, struct writeback_control *wbc) in writepage_nounlock() argument
442 loff_t page_off = page_offset(page); in writepage_nounlock()
450 dout("writepage %p idx %lu\n", page, page->index); in writepage_nounlock()
452 if (!page->mapping || !page->mapping->host) { in writepage_nounlock()
453 dout("writepage %p - no mapping\n", page); in writepage_nounlock()
456 inode = page->mapping->host; in writepage_nounlock()
462 snapc = page_snap_context(page); in writepage_nounlock()
464 dout("writepage %p page %p not dirty?\n", inode, page); in writepage_nounlock()
470 inode, page, snapc); in writepage_nounlock()
487 inode, page, page->index, page_off, len, snapc); in writepage_nounlock()
494 set_page_writeback(page); in writepage_nounlock()
499 &inode->i_mtime, &page, 1); in writepage_nounlock()
501 dout("writepage setting page/mapping error %d %p\n", err, page); in writepage_nounlock()
502 SetPageError(page); in writepage_nounlock()
507 dout("writepage cleaned page %p\n", page); in writepage_nounlock()
510 page->private = 0; in writepage_nounlock()
511 ClearPagePrivate(page); in writepage_nounlock()
512 end_page_writeback(page); in writepage_nounlock()
519 static int ceph_writepage(struct page *page, struct writeback_control *wbc) in ceph_writepage() argument
522 struct inode *inode = page->mapping->host; in ceph_writepage()
525 err = writepage_nounlock(page, wbc); in ceph_writepage()
526 unlock_page(page); in ceph_writepage()
536 static void ceph_release_pages(struct page **pages, int num) in ceph_release_pages()
563 struct page *page; in writepages_finish() local
595 page = osd_data->pages[i]; in writepages_finish()
596 BUG_ON(!page); in writepages_finish()
597 WARN_ON(!PageUptodate(page)); in writepages_finish()
606 ceph_put_snap_context(page_snap_context(page)); in writepages_finish()
607 page->private = 0; in writepages_finish()
608 ClearPagePrivate(page); in writepages_finish()
609 dout("unlocking %d %p\n", i, page); in writepages_finish()
610 end_page_writeback(page); in writepages_finish()
619 generic_error_remove_page(inode->i_mapping, page); in writepages_finish()
621 unlock_page(page); in writepages_finish()
748 struct page **pages = NULL; in ceph_writepages_start()
750 struct page *page; in ceph_writepages_start() local
772 page = pvec.pages[i]; in ceph_writepages_start()
773 dout("? %p idx %lu\n", page, page->index); in ceph_writepages_start()
775 lock_page(page); /* first page */ in ceph_writepages_start()
776 else if (!trylock_page(page)) in ceph_writepages_start()
780 if (unlikely(!PageDirty(page)) || in ceph_writepages_start()
781 unlikely(page->mapping != mapping)) { in ceph_writepages_start()
782 dout("!dirty or !mapping %p\n", page); in ceph_writepages_start()
783 unlock_page(page); in ceph_writepages_start()
786 if (!wbc->range_cyclic && page->index > end) { in ceph_writepages_start()
787 dout("end of range %p\n", page); in ceph_writepages_start()
789 unlock_page(page); in ceph_writepages_start()
792 if (next && (page->index != next)) { in ceph_writepages_start()
793 dout("not consecutive %p\n", page); in ceph_writepages_start()
794 unlock_page(page); in ceph_writepages_start()
798 dout("waiting on writeback %p\n", page); in ceph_writepages_start()
799 wait_on_page_writeback(page); in ceph_writepages_start()
801 if (page_offset(page) >= snap_size) { in ceph_writepages_start()
802 dout("%p page eof %llu\n", page, snap_size); in ceph_writepages_start()
804 unlock_page(page); in ceph_writepages_start()
807 if (PageWriteback(page)) { in ceph_writepages_start()
808 dout("%p under writeback\n", page); in ceph_writepages_start()
809 unlock_page(page); in ceph_writepages_start()
814 pgsnapc = page_snap_context(page); in ceph_writepages_start()
818 unlock_page(page); in ceph_writepages_start()
824 if (!clear_page_dirty_for_io(page)) { in ceph_writepages_start()
825 dout("%p !clear_page_dirty_for_io\n", page); in ceph_writepages_start()
826 unlock_page(page); in ceph_writepages_start()
842 offset = (u64)page_offset(page); in ceph_writepages_start()
850 unlock_page(page); in ceph_writepages_start()
871 inode, page, page->index); in ceph_writepages_start()
881 set_page_writeback(page); in ceph_writepages_start()
882 pages[locked_pages] = page; in ceph_writepages_start()
884 next = page->index + 1; in ceph_writepages_start()
996 struct page *page) in ceph_update_writeable_page() argument
1010 wait_on_page_writeback(page); in ceph_update_writeable_page()
1016 snapc = page_snap_context(page); in ceph_update_writeable_page()
1028 page, snapc); in ceph_update_writeable_page()
1034 unlock_page(page); in ceph_update_writeable_page()
1047 page, snapc); in ceph_update_writeable_page()
1048 if (!clear_page_dirty_for_io(page)) in ceph_update_writeable_page()
1050 r = writepage_nounlock(page, NULL); in ceph_update_writeable_page()
1056 if (PageUptodate(page)) { in ceph_update_writeable_page()
1057 dout(" page %p already uptodate\n", page); in ceph_update_writeable_page()
1078 page, pos_in_page, end_in_page, (int)PAGE_CACHE_SIZE); in ceph_update_writeable_page()
1079 zero_user_segments(page, in ceph_update_writeable_page()
1087 r = readpage_nounlock(file, page); in ceph_update_writeable_page()
1095 unlock_page(page); in ceph_update_writeable_page()
1105 struct page **pagep, void **fsdata) in ceph_write_begin()
1108 struct page *page; in ceph_write_begin() local
1114 page = grab_cache_page_write_begin(mapping, index, 0); in ceph_write_begin()
1115 if (!page) in ceph_write_begin()
1117 *pagep = page; in ceph_write_begin()
1120 inode, page, (int)pos, (int)len); in ceph_write_begin()
1122 r = ceph_update_writeable_page(file, pos, len, page); in ceph_write_begin()
1135 struct page *page, void *fsdata) in ceph_write_end() argument
1144 inode, page, (int)pos, (int)copied, (int)len); in ceph_write_end()
1148 zero_user_segment(page, from+copied, len); in ceph_write_end()
1155 if (!PageUptodate(page)) in ceph_write_end()
1156 SetPageUptodate(page); in ceph_write_end()
1158 set_page_dirty(page); in ceph_write_end()
1160 unlock_page(page); in ceph_write_end()
1162 page_cache_release(page); in ceph_write_end()
1207 struct page *page = vmf->page; in ceph_page_mkwrite() local
1209 loff_t off = page_offset(page); in ceph_page_mkwrite()
1223 off, len, page, page->index); in ceph_page_mkwrite()
1225 lock_page(page); in ceph_page_mkwrite()
1229 (page->mapping != inode->i_mapping)) in ceph_page_mkwrite()
1232 ret = ceph_update_writeable_page(vma->vm_file, off, len, page); in ceph_page_mkwrite()
1235 set_page_dirty(page); in ceph_page_mkwrite()
1247 unlock_page(page); in ceph_page_mkwrite()