diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ocfs2/inode.c | 3 | ||||
-rw-r--r-- | fs/ocfs2/inode.h | 2 | ||||
-rw-r--r-- | fs/ocfs2/journal.h | 5 | ||||
-rw-r--r-- | fs/ocfs2/ocfs2.h | 4 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 1 | ||||
-rw-r--r-- | fs/ocfs2/uptodate.c | 22 | ||||
-rw-r--r-- | fs/ocfs2/uptodate.h | 1 |
7 files changed, 28 insertions, 10 deletions
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 1c9713cceb39..a47750dea059 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -1112,7 +1112,7 @@ void ocfs2_clear_inode(struct inode *inode) | |||
1112 | ocfs2_lock_res_free(&oi->ip_inode_lockres); | 1112 | ocfs2_lock_res_free(&oi->ip_inode_lockres); |
1113 | ocfs2_lock_res_free(&oi->ip_open_lockres); | 1113 | ocfs2_lock_res_free(&oi->ip_open_lockres); |
1114 | 1114 | ||
1115 | ocfs2_metadata_cache_purge(INODE_CACHE(inode)); | 1115 | ocfs2_metadata_cache_exit(INODE_CACHE(inode)); |
1116 | 1116 | ||
1117 | mlog_bug_on_msg(INODE_CACHE(inode)->ci_num_cached, | 1117 | mlog_bug_on_msg(INODE_CACHE(inode)->ci_num_cached, |
1118 | "Clear inode of %llu, inode has %u cache items\n", | 1118 | "Clear inode of %llu, inode has %u cache items\n", |
@@ -1148,7 +1148,6 @@ void ocfs2_clear_inode(struct inode *inode) | |||
1148 | /* Clear all other flags. */ | 1148 | /* Clear all other flags. */ |
1149 | oi->ip_flags = 0; | 1149 | oi->ip_flags = 0; |
1150 | oi->ip_created_trans = 0; | 1150 | oi->ip_created_trans = 0; |
1151 | oi->ip_last_trans = 0; | ||
1152 | oi->ip_dir_start_lookup = 0; | 1151 | oi->ip_dir_start_lookup = 0; |
1153 | oi->ip_blkno = 0ULL; | 1152 | oi->ip_blkno = 0ULL; |
1154 | 1153 | ||
diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h index b0a71b22712c..2cae2514e7fb 100644 --- a/fs/ocfs2/inode.h +++ b/fs/ocfs2/inode.h | |||
@@ -63,8 +63,6 @@ struct ocfs2_inode_info | |||
63 | /* next two are protected by trans_inc_lock */ | 63 | /* next two are protected by trans_inc_lock */ |
64 | /* which transaction were we created on? Zero if none. */ | 64 | /* which transaction were we created on? Zero if none. */ |
65 | unsigned long ip_created_trans; | 65 | unsigned long ip_created_trans; |
66 | /* last transaction we were a part of. */ | ||
67 | unsigned long ip_last_trans; | ||
68 | 66 | ||
69 | struct ocfs2_caching_info ip_metadata_cache; | 67 | struct ocfs2_caching_info ip_metadata_cache; |
70 | 68 | ||
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index 2c3222aec622..d4ac19739d7c 100644 --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h | |||
@@ -94,7 +94,7 @@ static inline void ocfs2_set_inode_lock_trans(struct ocfs2_journal *journal, | |||
94 | struct inode *inode) | 94 | struct inode *inode) |
95 | { | 95 | { |
96 | spin_lock(&trans_inc_lock); | 96 | spin_lock(&trans_inc_lock); |
97 | OCFS2_I(inode)->ip_last_trans = journal->j_trans_id; | 97 | INODE_CACHE(inode)->ci_last_trans = journal->j_trans_id; |
98 | spin_unlock(&trans_inc_lock); | 98 | spin_unlock(&trans_inc_lock); |
99 | } | 99 | } |
100 | 100 | ||
@@ -109,7 +109,8 @@ static inline int ocfs2_inode_fully_checkpointed(struct inode *inode) | |||
109 | struct ocfs2_journal *journal = OCFS2_SB(inode->i_sb)->journal; | 109 | struct ocfs2_journal *journal = OCFS2_SB(inode->i_sb)->journal; |
110 | 110 | ||
111 | spin_lock(&trans_inc_lock); | 111 | spin_lock(&trans_inc_lock); |
112 | ret = time_after(journal->j_trans_id, OCFS2_I(inode)->ip_last_trans); | 112 | ret = time_after(journal->j_trans_id, |
113 | INODE_CACHE(inode)->ci_last_trans); | ||
113 | spin_unlock(&trans_inc_lock); | 114 | spin_unlock(&trans_inc_lock); |
114 | return ret; | 115 | return ret; |
115 | } | 116 | } |
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index 6e54a496299e..c9bd7ce30ba6 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
@@ -77,6 +77,10 @@ struct ocfs2_caching_info { | |||
77 | */ | 77 | */ |
78 | const struct ocfs2_caching_operations *ci_ops; | 78 | const struct ocfs2_caching_operations *ci_ops; |
79 | 79 | ||
80 | /* last transaction we were a part of. */ | ||
81 | unsigned long ci_last_trans; | ||
82 | |||
83 | /* Cache structures */ | ||
80 | unsigned int ci_flags; | 84 | unsigned int ci_flags; |
81 | unsigned int ci_num_cached; | 85 | unsigned int ci_num_cached; |
82 | union { | 86 | union { |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index af118ad98c58..4212547e78a2 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -1669,7 +1669,6 @@ static void ocfs2_inode_init_once(void *data) | |||
1669 | ocfs2_extent_map_init(&oi->vfs_inode); | 1669 | ocfs2_extent_map_init(&oi->vfs_inode); |
1670 | INIT_LIST_HEAD(&oi->ip_io_markers); | 1670 | INIT_LIST_HEAD(&oi->ip_io_markers); |
1671 | oi->ip_created_trans = 0; | 1671 | oi->ip_created_trans = 0; |
1672 | oi->ip_last_trans = 0; | ||
1673 | oi->ip_dir_start_lookup = 0; | 1672 | oi->ip_dir_start_lookup = 0; |
1674 | 1673 | ||
1675 | init_rwsem(&oi->ip_alloc_sem); | 1674 | init_rwsem(&oi->ip_alloc_sem); |
diff --git a/fs/ocfs2/uptodate.c b/fs/ocfs2/uptodate.c index 1c829e451019..81c82200b908 100644 --- a/fs/ocfs2/uptodate.c +++ b/fs/ocfs2/uptodate.c | |||
@@ -118,16 +118,32 @@ void ocfs2_metadata_cache_io_unlock(struct ocfs2_caching_info *ci) | |||
118 | } | 118 | } |
119 | 119 | ||
120 | 120 | ||
121 | static void ocfs2_metadata_cache_reset(struct ocfs2_caching_info *ci, | ||
122 | int clear) | ||
123 | { | ||
124 | ci->ci_flags |= OCFS2_CACHE_FL_INLINE; | ||
125 | ci->ci_num_cached = 0; | ||
126 | |||
127 | if (clear) | ||
128 | ci->ci_last_trans = 0; | ||
129 | } | ||
130 | |||
121 | void ocfs2_metadata_cache_init(struct ocfs2_caching_info *ci, | 131 | void ocfs2_metadata_cache_init(struct ocfs2_caching_info *ci, |
122 | const struct ocfs2_caching_operations *ops) | 132 | const struct ocfs2_caching_operations *ops) |
123 | { | 133 | { |
124 | BUG_ON(!ops); | 134 | BUG_ON(!ops); |
125 | 135 | ||
126 | ci->ci_ops = ops; | 136 | ci->ci_ops = ops; |
127 | ci->ci_flags |= OCFS2_CACHE_FL_INLINE; | 137 | ocfs2_metadata_cache_reset(ci, 1); |
128 | ci->ci_num_cached = 0; | 138 | } |
139 | |||
140 | void ocfs2_metadata_cache_exit(struct ocfs2_caching_info *ci) | ||
141 | { | ||
142 | ocfs2_metadata_cache_purge(ci); | ||
143 | ocfs2_metadata_cache_reset(ci, 1); | ||
129 | } | 144 | } |
130 | 145 | ||
146 | |||
131 | /* No lock taken here as 'root' is not expected to be visible to other | 147 | /* No lock taken here as 'root' is not expected to be visible to other |
132 | * processes. */ | 148 | * processes. */ |
133 | static unsigned int ocfs2_purge_copied_metadata_tree(struct rb_root *root) | 149 | static unsigned int ocfs2_purge_copied_metadata_tree(struct rb_root *root) |
@@ -177,7 +193,7 @@ void ocfs2_metadata_cache_purge(struct ocfs2_caching_info *ci) | |||
177 | if (tree) | 193 | if (tree) |
178 | root = ci->ci_cache.ci_tree; | 194 | root = ci->ci_cache.ci_tree; |
179 | 195 | ||
180 | ocfs2_metadata_cache_init(ci, ci->ci_ops); | 196 | ocfs2_metadata_cache_reset(ci, 0); |
181 | ocfs2_metadata_cache_unlock(ci); | 197 | ocfs2_metadata_cache_unlock(ci); |
182 | 198 | ||
183 | purged = ocfs2_purge_copied_metadata_tree(&root); | 199 | purged = ocfs2_purge_copied_metadata_tree(&root); |
diff --git a/fs/ocfs2/uptodate.h b/fs/ocfs2/uptodate.h index f268273d6516..80dbb1db0a5a 100644 --- a/fs/ocfs2/uptodate.h +++ b/fs/ocfs2/uptodate.h | |||
@@ -61,6 +61,7 @@ void exit_ocfs2_uptodate_cache(void); | |||
61 | void ocfs2_metadata_cache_init(struct ocfs2_caching_info *ci, | 61 | void ocfs2_metadata_cache_init(struct ocfs2_caching_info *ci, |
62 | const struct ocfs2_caching_operations *ops); | 62 | const struct ocfs2_caching_operations *ops); |
63 | void ocfs2_metadata_cache_purge(struct ocfs2_caching_info *ci); | 63 | void ocfs2_metadata_cache_purge(struct ocfs2_caching_info *ci); |
64 | void ocfs2_metadata_cache_exit(struct ocfs2_caching_info *ci); | ||
64 | 65 | ||
65 | u64 ocfs2_metadata_cache_owner(struct ocfs2_caching_info *ci); | 66 | u64 ocfs2_metadata_cache_owner(struct ocfs2_caching_info *ci); |
66 | struct super_block *ocfs2_metadata_cache_get_super(struct ocfs2_caching_info *ci); | 67 | struct super_block *ocfs2_metadata_cache_get_super(struct ocfs2_caching_info *ci); |