Lines Matching refs:page
24 int reiserfs_commit_write(struct file *f, struct page *page,
169 * about what happens for reading a file. For each page,
185 * If this page has a file tail in it, and
186 * it was read in by get_block_create_0, the page data is valid,
188 * it. So, look through this page, and check all the mapped buffers
193 static inline void fix_tail_page_for_writing(struct page *page)
197 if (page && page_has_buffers(page)) {
198 head = page_buffers(page);
281 * of page (bh_result)
313 * We do not return -ENOENT if there is a hole but page is
345 * page is uptodate, because it means that there is
372 * if we've got a direct item, and the buffer or page was uptodate,
381 * up to date pages without any buffers. If the page is up
389 /* read file tail into part of page */
394 * we only want to kmap if we are reading the tail into the page.
494 * in a page. Where it does not produce a valid page for holes, or past the
583 struct page *tail_page;
584 struct page *hole_page = bh_result->b_page;
597 * that we cannot get here if we write with O_DIRECT into tail page
611 * we were locking the page because anyone that could convert
614 * We must fix the tail page for writing because it might have buffers
616 * data that has been read directly into the page, and
625 /* tail conversion might change the data in the page */
910 * also get into page cache
997 * but it sets the page dirty too, which makes
2169 * finds the tail page in the page cache,
2172 * On success, page_result is set to a locked, pinned page, and bh_result
2182 struct page **page_result,
2187 * we want the page with the last byte in the file,
2188 * not the page that will hold the next byte for appending
2197 struct page *page;
2209 page = grab_cache_page(inode->i_mapping, index);
2211 if (!page) {
2214 /* start within the page of the last block in the file */
2217 error = __block_write_begin(page, start, offset - start,
2222 head = page_buffers(page);
2245 *page_result = page;
2251 unlock_page(page);
2252 put_page(page);
2269 struct page *page = NULL;
2277 error = grab_tail_page(inode, &page, &bh);
2288 page = NULL;
2294 * so, if page != NULL, we have a buffer head for the offset at
2318 err2 = reiserfs_do_truncate(&th, inode, page, update_timestamps);
2335 if (page) {
2340 zero_user(page, offset, length);
2345 unlock_page(page);
2346 put_page(page);
2353 if (page) {
2354 unlock_page(page);
2355 put_page(page);
2507 * we've copied data from the page into the direct item, so the
2508 * buffer in the page is now clean, mark it to reflect that.
2522 static int reiserfs_write_full_page(struct page *page,
2525 struct inode *inode = page->mapping->host;
2533 int checked = PageChecked(page);
2541 redirty_page_for_writepage(wbc, page);
2542 unlock_page(page);
2547 * The page dirty bit is cleared before writepage is called, which
2549 * The page really should be up to date at this point, so tossing
2552 if (!page_has_buffers(page)) {
2553 create_empty_buffers(page, s->s_blocksize,
2556 head = page_buffers(page);
2559 * last page in the file, zero out any contents past the
2562 if (page->index >= end_index) {
2566 /* no file contents in this page */
2567 if (page->index >= end_index + 1 || !last_offset) {
2568 unlock_page(page);
2571 zero_user_segment(page, last_offset, PAGE_SIZE);
2574 block = page->index << (PAGE_SHIFT - s->s_blocksize_bits);
2581 * the page size. The corresponding bytes in the page
2610 ClearPageChecked(page);
2619 /* now go through and lock any dirty buffers on the page */
2640 redirty_page_for_writepage(wbc, page);
2657 BUG_ON(PageWriteback(page));
2658 set_page_writeback(page);
2659 unlock_page(page);
2662 * since any buffer might be the only dirty buffer on the page,
2663 * the first submit_bh can bring the page out of writeback.
2680 * if this page only had a direct item, it is very possible for
2683 * pipe without locking the page
2694 SetPageUptodate(page);
2695 end_page_writeback(page);
2702 * get to the media. The page is currently locked and not marked for
2705 ClearPageUptodate(page);
2715 * getting attached to a dirty page
2721 SetPageError(page);
2722 BUG_ON(PageWriteback(page));
2723 set_page_writeback(page);
2724 unlock_page(page);
2738 static int reiserfs_readpage(struct file *f, struct page *page)
2740 return block_read_full_page(page, reiserfs_get_block);
2743 static int reiserfs_writepage(struct page *page, struct writeback_control *wbc)
2745 struct inode *inode = page->mapping->host;
2747 return reiserfs_write_full_page(page, wbc);
2759 struct page **pagep, void **fsdata)
2762 struct page *page;
2776 page = grab_cache_page_write_begin(mapping, index, flags);
2777 if (!page)
2779 *pagep = page;
2782 fix_tail_page_for_writing(page);
2792 ret = __block_write_begin(page, pos, len, reiserfs_get_block);
2822 unlock_page(page);
2823 put_page(page);
2830 int __reiserfs_write_begin(struct page *page, unsigned from, unsigned len)
2832 struct inode *inode = page->mapping->host;
2841 fix_tail_page_for_writing(page);
2852 ret = __block_write_begin(page, from, len, reiserfs_get_block);
2892 struct page *page, void *fsdata)
2894 struct inode *inode = page->mapping->host;
2912 if (!PageUptodate(page))
2915 page_zero_new_buffers(page, start + copied, start + len);
2917 flush_dcache_page(page);
2919 reiserfs_commit_page(inode, page, start, start + copied);
2974 unlock_page(page);
2975 put_page(page);
2993 int reiserfs_commit_write(struct file *f, struct page *page,
2996 struct inode *inode = page->mapping->host;
2997 loff_t pos = ((loff_t) page->index << PAGE_SHIFT) + to;
3010 reiserfs_commit_page(inode, page, from, to);
3110 * the page is locked, and the only places that log a data buffer
3111 * also lock the page.
3153 static void reiserfs_invalidatepage(struct page *page, unsigned int offset,
3157 struct inode *inode = page->mapping->host;
3163 BUG_ON(!PageLocked(page));
3166 ClearPageChecked(page);
3168 if (!page_has_buffers(page))
3171 head = page_buffers(page);
3194 * We release buffers only if the entire page is being invalidated.
3199 ret = try_to_release_page(page, 0);
3206 static int reiserfs_set_page_dirty(struct page *page)
3208 struct inode *inode = page->mapping->host;
3210 SetPageChecked(page);
3211 return __set_page_dirty_nobuffers(page);
3213 return __set_page_dirty_buffers(page);
3217 * Returns 1 if the page's buffers were dropped. The page is locked.
3220 * in the buffers at page_buffers(page).
3225 static int reiserfs_releasepage(struct page *page, gfp_t unused_gfp_flags)
3227 struct inode *inode = page->mapping->host;
3233 WARN_ON(PageChecked(page));
3235 head = page_buffers(page);
3249 ret = try_to_free_buffers(page);