Lines Matching refs:page
3 * Buffer/page management specific to NILFS
14 #include <linux/page-flags.h>
20 #include "page.h"
29 __nilfs_get_page_block(struct page *page, unsigned long block, pgoff_t index,
36 if (!page_has_buffers(page))
37 create_empty_buffers(page, 1 << blkbits, b_state);
40 bh = nilfs_page_get_nth_block(page, block - first_block);
54 struct page *page;
57 page = grab_cache_page(mapping, index);
58 if (unlikely(!page))
61 bh = __nilfs_get_page_block(page, blkoff, index, blkbits, b_state);
63 unlock_page(page);
64 put_page(page);
76 struct page *page = bh->b_page;
84 if (nilfs_page_buffers_clean(page))
85 __nilfs_clear_page_dirty(page);
88 ClearPageUptodate(page);
89 ClearPageMappedToDisk(page);
103 struct page *spage = sbh->b_page, *dpage = dbh->b_page;
134 * nilfs_page_buffers_clean - check if a page has dirty buffers or not.
135 * @page: page to be checked
137 * nilfs_page_buffers_clean() returns zero if the page has dirty buffers.
140 int nilfs_page_buffers_clean(struct page *page)
144 bh = head = page_buffers(page);
153 void nilfs_page_bug(struct page *page)
158 if (unlikely(!page)) {
163 m = page->mapping;
168 page, page_ref_count(page),
169 (unsigned long long)page->index, page->flags, m, ino);
171 if (page_has_buffers(page)) {
175 bh = head = page_buffers(page);
187 * nilfs_copy_page -- copy the page with buffers
188 * @dst: destination page
189 * @src: source page
190 * @copy_dirty: flag whether to copy dirty states on the page's buffer heads.
193 * should be treated by caller. The page must not be under i/o.
194 * Both src and dst page must be locked
196 static void nilfs_copy_page(struct page *dst, struct page *src, int copy_dirty)
259 NILFS_PAGE_BUG(&folio->page, "inconsistent dirty state");
263 /* No empty page is added to the page cache */
269 NILFS_PAGE_BUG(&folio->page,
270 "found empty page in dat page cache");
272 nilfs_copy_page(&dfolio->page, &folio->page, 1);
289 * @dmap: destination page cache
290 * @smap: source page cache
317 nilfs_copy_page(&dfolio->page, &folio->page, 0);
380 nilfs_clear_dirty_page(&folio->page, silent);
390 * nilfs_clear_dirty_page - discard dirty page
391 * @page: dirty page that will be discarded
394 void nilfs_clear_dirty_page(struct page *page, bool silent)
396 struct inode *inode = page->mapping->host;
399 BUG_ON(!PageLocked(page));
402 nilfs_warn(sb, "discard dirty page: offset=%lld, ino=%lu",
403 page_offset(page), inode->i_ino);
405 ClearPageUptodate(page);
406 ClearPageMappedToDisk(page);
408 if (page_has_buffers(page)) {
415 bh = head = page_buffers(page);
428 __nilfs_clear_page_dirty(page);
431 unsigned int nilfs_page_count_clean_buffers(struct page *page,
438 for (bh = head = page_buffers(page), block_start = 0;
458 int __nilfs_clear_page_dirty(struct page *page)
460 struct address_space *mapping = page->mapping;
464 if (test_bit(PG_dirty, &page->flags)) {
465 __xa_clear_mark(&mapping->i_pages, page_index(page),
468 return clear_page_dirty_for_io(page);
473 return TestClearPageDirty(page);