diff options
Diffstat (limited to 'fs/nilfs2/page.c')
| -rw-r--r-- | fs/nilfs2/page.c | 79 | 
1 files changed, 6 insertions, 73 deletions
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c index 1168059c7ef..65221a04c6f 100644 --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c @@ -37,8 +37,7 @@  #define NILFS_BUFFER_INHERENT_BITS  \  	((1UL << BH_Uptodate) | (1UL << BH_Mapped) | (1UL << BH_NILFS_Node) | \ -	 (1UL << BH_NILFS_Volatile) | (1UL << BH_NILFS_Allocated) | \ -	 (1UL << BH_NILFS_Checked)) +	 (1UL << BH_NILFS_Volatile) | (1UL << BH_NILFS_Checked))  static struct buffer_head *  __nilfs_get_page_block(struct page *page, unsigned long block, pgoff_t index, @@ -59,19 +58,6 @@ __nilfs_get_page_block(struct page *page, unsigned long block, pgoff_t index,  	return bh;  } -/* - * Since the page cache of B-tree node pages or data page cache of pseudo - * inodes does not have a valid mapping->host pointer, calling - * mark_buffer_dirty() for their buffers causes a NULL pointer dereference; - * it calls __mark_inode_dirty(NULL) through __set_page_dirty(). - * To avoid this problem, the old style mark_buffer_dirty() is used instead. - */ -void nilfs_mark_buffer_dirty(struct buffer_head *bh) -{ -	if (!buffer_dirty(bh) && !test_set_buffer_dirty(bh)) -		__set_page_dirty_nobuffers(bh->b_page); -} -  struct buffer_head *nilfs_grab_buffer(struct inode *inode,  				      struct address_space *mapping,  				      unsigned long blkoff, @@ -183,7 +169,7 @@ int nilfs_page_buffers_clean(struct page *page)  void nilfs_page_bug(struct page *page)  {  	struct address_space *m; -	unsigned long ino = 0; +	unsigned long ino;  	if (unlikely(!page)) {  		printk(KERN_CRIT "NILFS_PAGE_BUG(NULL)\n"); @@ -191,11 +177,8 @@ void nilfs_page_bug(struct page *page)  	}  	m = page->mapping; -	if (m) { -		struct inode *inode = NILFS_AS_I(m); -		if (inode != NULL) -			ino = inode->i_ino; -	} +	ino = m ? m->host->i_ino : 0; +  	printk(KERN_CRIT "NILFS_PAGE_BUG(%p): cnt=%d index#=%llu flags=0x%lx "  	       "mapping=%p ino=%lu\n",  	       page, atomic_read(&page->_count), @@ -217,56 +200,6 @@ void nilfs_page_bug(struct page *page)  }  /** - * nilfs_alloc_private_page - allocate a private page with buffer heads - * - * Return Value: On success, a pointer to the allocated page is returned. - * On error, NULL is returned. - */ -struct page *nilfs_alloc_private_page(struct block_device *bdev, int size, -				      unsigned long state) -{ -	struct buffer_head *bh, *head, *tail; -	struct page *page; - -	page = alloc_page(GFP_NOFS); /* page_count of the returned page is 1 */ -	if (unlikely(!page)) -		return NULL; - -	lock_page(page); -	head = alloc_page_buffers(page, size, 0); -	if (unlikely(!head)) { -		unlock_page(page); -		__free_page(page); -		return NULL; -	} - -	bh = head; -	do { -		bh->b_state = (1UL << BH_NILFS_Allocated) | state; -		tail = bh; -		bh->b_bdev = bdev; -		bh = bh->b_this_page; -	} while (bh); - -	tail->b_this_page = head; -	attach_page_buffers(page, head); - -	return page; -} - -void nilfs_free_private_page(struct page *page) -{ -	BUG_ON(!PageLocked(page)); -	BUG_ON(page->mapping); - -	if (page_has_buffers(page) && !try_to_free_buffers(page)) -		NILFS_PAGE_BUG(page, "failed to free page"); - -	unlock_page(page); -	__free_page(page); -} - -/**   * nilfs_copy_page -- copy the page with buffers   * @dst: destination page   * @src: source page @@ -492,10 +425,10 @@ unsigned nilfs_page_count_clean_buffers(struct page *page,  	return nc;  } -void nilfs_mapping_init(struct address_space *mapping, +void nilfs_mapping_init(struct address_space *mapping, struct inode *inode,  			struct backing_dev_info *bdi)  { -	mapping->host = NULL; +	mapping->host = inode;  	mapping->flags = 0;  	mapping_set_gfp_mask(mapping, GFP_NOFS);  	mapping->assoc_mapping = NULL;  |