[PATCH 06/17] fs: Don't store backing dev mapping in inode->i_mapping->private_data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There's no need to store inode mapping in inode->i_mapping->private_data
since we can easily get to it via
inode->i_sb->s_bdev->bd_inode->i_mapping and it's not really a
performance critical thing.

Also remove address_space->private_data because noone uses it anymore.

Signed-off-by: Jan Kara <jack@xxxxxxx>
---
 fs/buffer.c        | 23 +++++++++++++----------
 fs/inode.c         |  1 -
 fs/nilfs2/page.c   |  1 -
 include/linux/fs.h |  1 -
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 27265a8b43c1..d7a88a0ab0d4 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -583,6 +583,11 @@ void emergency_thaw_all(void)
 	}
 }
 
+static inline struct address_space *inode_buffer_mapping(struct inode *inode)
+{
+	return inode->i_sb->s_bdev->bd_inode->i_mapping;
+}
+
 /**
  * sync_mapping_buffers - write out & wait upon a mapping's "associated" buffers
  * @mapping: the mapping which wants those buffers written
@@ -596,11 +601,12 @@ void emergency_thaw_all(void)
  */
 int sync_mapping_buffers(struct address_space *mapping)
 {
-	struct address_space *buffer_mapping = mapping->private_data;
+	struct address_space *buffer_mapping;
 
-	if (buffer_mapping == NULL || list_empty(&mapping->private_list))
+	if (list_empty(&mapping->private_list))
 		return 0;
 
+	buffer_mapping = inode_buffer_mapping(mapping->host);
 	return fsync_buffers_list(&buffer_mapping->private_lock,
 					&mapping->private_list);
 }
@@ -626,14 +632,9 @@ void write_boundary_block(struct block_device *bdev,
 void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode)
 {
 	struct address_space *mapping = inode->i_mapping;
-	struct address_space *buffer_mapping = bh->b_page->mapping;
+	struct address_space *buffer_mapping = inode_buffer_mapping(inode);
 
 	mark_buffer_dirty(bh);
-	if (!mapping->private_data) {
-		mapping->private_data = buffer_mapping;
-	} else {
-		BUG_ON(mapping->private_data != buffer_mapping);
-	}
 	if (!bh->b_assoc_map) {
 		spin_lock(&buffer_mapping->private_lock);
 		list_move_tail(&bh->b_assoc_buffers,
@@ -831,8 +832,9 @@ void invalidate_inode_buffers(struct inode *inode)
 	if (inode_has_buffers(inode)) {
 		struct address_space *mapping = &inode->i_data;
 		struct list_head *list = &mapping->private_list;
-		struct address_space *buffer_mapping = mapping->private_data;
+		struct address_space *buffer_mapping;
 
+		buffer_mapping = inode_buffer_mapping(inode);
 		spin_lock(&buffer_mapping->private_lock);
 		while (!list_empty(list))
 			__remove_assoc_queue(BH_ENTRY(list->next));
@@ -854,8 +856,9 @@ int remove_inode_buffers(struct inode *inode)
 	if (inode_has_buffers(inode)) {
 		struct address_space *mapping = &inode->i_data;
 		struct list_head *list = &mapping->private_list;
-		struct address_space *buffer_mapping = mapping->private_data;
+		struct address_space *buffer_mapping;
 
+		buffer_mapping = inode_buffer_mapping(inode);
 		spin_lock(&buffer_mapping->private_lock);
 		while (!list_empty(list)) {
 			struct buffer_head *bh = BH_ENTRY(list->next);
diff --git a/fs/inode.c b/fs/inode.c
index 1b888eb524ca..1f22605768cf 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -166,7 +166,6 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
 	mapping->host = inode;
 	mapping->flags = 0;
 	mapping_set_gfp_mask(mapping, GFP_HIGHUSER_MOVABLE);
-	mapping->private_data = NULL;
 	mapping->backing_dev_info = &default_backing_dev_info;
 	mapping->writeback_index = 0;
 
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c
index da276640f776..a9c69c624bd5 100644
--- a/fs/nilfs2/page.c
+++ b/fs/nilfs2/page.c
@@ -467,7 +467,6 @@ void nilfs_mapping_init(struct address_space *mapping, struct inode *inode,
 	mapping->host = inode;
 	mapping->flags = 0;
 	mapping_set_gfp_mask(mapping, GFP_NOFS);
-	mapping->private_data = NULL;
 	mapping->backing_dev_info = bdi;
 	mapping->a_ops = &empty_aops;
 }
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b76720852f5f..2fd48bbf756b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -425,7 +425,6 @@ struct address_space {
 	struct backing_dev_info *backing_dev_info; /* device readahead, etc */
 	spinlock_t		private_lock;	/* for use by the address_space */
 	struct list_head	private_list;	/* ditto */
-	void			*private_data;	/* ditto */
 } __attribute__((aligned(sizeof(long))));
 	/*
 	 * On most architectures that alignment is already the case; but
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux