aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/uptodate.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2009-02-12 18:24:40 -0500
committerJoel Becker <joel.becker@oracle.com>2009-09-04 19:07:49 -0400
commit66fb345ddd2d343e36692da0ff66126d7a99dc1b (patch)
tree7e53f68bbf4c910cd81be7e39378d9552bbce4c3 /fs/ocfs2/uptodate.c
parent8cb471e8f82506937fe5e2e9fb0bf90f6b1f1170 (diff)
ocfs2: move ip_last_trans to struct ocfs2_caching_info
We have the read side of metadata caching isolated to struct ocfs2_caching_info, now we need the write side. This means the journal functions. The journal only does a couple of things with struct inode. This change moves the ip_last_trans field onto struct ocfs2_caching_info as ci_last_trans. This field tells the journal whether a pending journal flush is required. Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/uptodate.c')
-rw-r--r--fs/ocfs2/uptodate.c22
1 files changed, 19 insertions, 3 deletions
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
121static 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
121void ocfs2_metadata_cache_init(struct ocfs2_caching_info *ci, 131void 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
140void 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. */
133static unsigned int ocfs2_purge_copied_metadata_tree(struct rb_root *root) 149static 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);