Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa405b1f authored by Ryusuke Konishi's avatar Ryusuke Konishi
Browse files

nilfs2: always set back pointer to host inode in mapping->host



In the current nilfs, page cache for btree nodes and meta data files
do not set a valid back pointer to the host inode in mapping->host.

This will change it so that every address space in nilfs uses
mapping->host to hold its host inode.

Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
parent 0ef28f9a
Loading
Loading
Loading
Loading
+0 −6
Original line number Original line Diff line number Diff line
@@ -34,12 +34,6 @@
#include "page.h"
#include "page.h"
#include "btnode.h"
#include "btnode.h"


void nilfs_btnode_cache_init(struct address_space *btnc,
			     struct backing_dev_info *bdi)
{
	nilfs_mapping_init(btnc, bdi);
}

void nilfs_btnode_cache_clear(struct address_space *btnc)
void nilfs_btnode_cache_clear(struct address_space *btnc)
{
{
	invalidate_mapping_pages(btnc, 0, -1);
	invalidate_mapping_pages(btnc, 0, -1);
+0 −1
Original line number Original line Diff line number Diff line
@@ -37,7 +37,6 @@ struct nilfs_btnode_chkey_ctxt {
	struct buffer_head *newbh;
	struct buffer_head *newbh;
};
};


void nilfs_btnode_cache_init(struct address_space *, struct backing_dev_info *);
void nilfs_btnode_cache_clear(struct address_space *);
void nilfs_btnode_cache_clear(struct address_space *);
struct buffer_head *nilfs_btnode_create_block(struct address_space *btnc,
struct buffer_head *nilfs_btnode_create_block(struct address_space *btnc,
					      __u64 blocknr);
					      __u64 blocknr);
+2 −2
Original line number Original line Diff line number Diff line
@@ -450,9 +450,9 @@ int nilfs_mdt_setup_shadow_map(struct inode *inode,


	INIT_LIST_HEAD(&shadow->frozen_buffers);
	INIT_LIST_HEAD(&shadow->frozen_buffers);
	address_space_init_once(&shadow->frozen_data);
	address_space_init_once(&shadow->frozen_data);
	nilfs_mapping_init(&shadow->frozen_data, bdi);
	nilfs_mapping_init(&shadow->frozen_data, inode, bdi);
	address_space_init_once(&shadow->frozen_btnodes);
	address_space_init_once(&shadow->frozen_btnodes);
	nilfs_mapping_init(&shadow->frozen_btnodes, bdi);
	nilfs_mapping_init(&shadow->frozen_btnodes, inode, bdi);
	mi->mi_shadow = shadow;
	mi->mi_shadow = shadow;
	return 0;
	return 0;
}
}
+0 −6
Original line number Original line Diff line number Diff line
@@ -80,12 +80,6 @@ static inline struct inode *NILFS_BTNC_I(struct address_space *btnc)
	return &ii->vfs_inode;
	return &ii->vfs_inode;
}
}


static inline struct inode *NILFS_AS_I(struct address_space *mapping)
{
	return (mapping->host) ? :
		container_of(mapping, struct inode, i_data);
}

/*
/*
 * Dynamic state flags of NILFS on-memory inode (i_state)
 * Dynamic state flags of NILFS on-memory inode (i_state)
 */
 */
+5 −8
Original line number Original line Diff line number Diff line
@@ -182,7 +182,7 @@ int nilfs_page_buffers_clean(struct page *page)
void nilfs_page_bug(struct page *page)
void nilfs_page_bug(struct page *page)
{
{
	struct address_space *m;
	struct address_space *m;
	unsigned long ino = 0;
	unsigned long ino;


	if (unlikely(!page)) {
	if (unlikely(!page)) {
		printk(KERN_CRIT "NILFS_PAGE_BUG(NULL)\n");
		printk(KERN_CRIT "NILFS_PAGE_BUG(NULL)\n");
@@ -190,11 +190,8 @@ void nilfs_page_bug(struct page *page)
	}
	}


	m = page->mapping;
	m = page->mapping;
	if (m) {
	ino = m ? m->host->i_ino : 0;
		struct inode *inode = NILFS_AS_I(m);

		if (inode != NULL)
			ino = inode->i_ino;
	}
	printk(KERN_CRIT "NILFS_PAGE_BUG(%p): cnt=%d index#=%llu flags=0x%lx "
	printk(KERN_CRIT "NILFS_PAGE_BUG(%p): cnt=%d index#=%llu flags=0x%lx "
	       "mapping=%p ino=%lu\n",
	       "mapping=%p ino=%lu\n",
	       page, atomic_read(&page->_count),
	       page, atomic_read(&page->_count),
@@ -441,10 +438,10 @@ unsigned nilfs_page_count_clean_buffers(struct page *page,
	return nc;
	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)
			struct backing_dev_info *bdi)
{
{
	mapping->host = NULL;
	mapping->host = inode;
	mapping->flags = 0;
	mapping->flags = 0;
	mapping_set_gfp_mask(mapping, GFP_NOFS);
	mapping_set_gfp_mask(mapping, GFP_NOFS);
	mapping->assoc_mapping = NULL;
	mapping->assoc_mapping = NULL;
Loading