diff options
author | Tao Ma <tao.ma@oracle.com> | 2009-08-17 23:21:00 -0400 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2009-09-22 23:09:28 -0400 |
commit | c732eb16bf07f9bfb7fa72b6868462471273bdbd (patch) | |
tree | 8e6cfce9d9d5ca1d5dcd1d52ca1e291a3928c6fe /fs/ocfs2 | |
parent | 8dec98edfe9684ce00b580a09dde3dcd21ee785b (diff) |
ocfs2: Add caching info for refcount tree.
refcount tree should use its own caching info so that when
we downconvert the refcount tree lock, we can drop all the
cached buffer head.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/refcounttree.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index a923535d9c37..eb0f4a047938 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -26,6 +26,13 @@ | |||
26 | #include "super.h" | 26 | #include "super.h" |
27 | #include "buffer_head_io.h" | 27 | #include "buffer_head_io.h" |
28 | #include "blockcheck.h" | 28 | #include "blockcheck.h" |
29 | #include "refcounttree.h" | ||
30 | |||
31 | static inline struct ocfs2_refcount_tree * | ||
32 | cache_info_to_refcount(struct ocfs2_caching_info *ci) | ||
33 | { | ||
34 | return container_of(ci, struct ocfs2_refcount_tree, rf_ci); | ||
35 | } | ||
29 | 36 | ||
30 | static int ocfs2_validate_refcount_block(struct super_block *sb, | 37 | static int ocfs2_validate_refcount_block(struct super_block *sb, |
31 | struct buffer_head *bh) | 38 | struct buffer_head *bh) |
@@ -97,3 +104,55 @@ static int ocfs2_read_refcount_block(struct ocfs2_caching_info *ci, | |||
97 | 104 | ||
98 | return rc; | 105 | return rc; |
99 | } | 106 | } |
107 | |||
108 | static u64 ocfs2_refcount_cache_owner(struct ocfs2_caching_info *ci) | ||
109 | { | ||
110 | struct ocfs2_refcount_tree *rf = cache_info_to_refcount(ci); | ||
111 | |||
112 | return rf->rf_blkno; | ||
113 | } | ||
114 | |||
115 | static struct super_block * | ||
116 | ocfs2_refcount_cache_get_super(struct ocfs2_caching_info *ci) | ||
117 | { | ||
118 | struct ocfs2_refcount_tree *rf = cache_info_to_refcount(ci); | ||
119 | |||
120 | return rf->rf_sb; | ||
121 | } | ||
122 | |||
123 | static void ocfs2_refcount_cache_lock(struct ocfs2_caching_info *ci) | ||
124 | { | ||
125 | struct ocfs2_refcount_tree *rf = cache_info_to_refcount(ci); | ||
126 | |||
127 | spin_lock(&rf->rf_lock); | ||
128 | } | ||
129 | |||
130 | static void ocfs2_refcount_cache_unlock(struct ocfs2_caching_info *ci) | ||
131 | { | ||
132 | struct ocfs2_refcount_tree *rf = cache_info_to_refcount(ci); | ||
133 | |||
134 | spin_unlock(&rf->rf_lock); | ||
135 | } | ||
136 | |||
137 | static void ocfs2_refcount_cache_io_lock(struct ocfs2_caching_info *ci) | ||
138 | { | ||
139 | struct ocfs2_refcount_tree *rf = cache_info_to_refcount(ci); | ||
140 | |||
141 | mutex_lock(&rf->rf_io_mutex); | ||
142 | } | ||
143 | |||
144 | static void ocfs2_refcount_cache_io_unlock(struct ocfs2_caching_info *ci) | ||
145 | { | ||
146 | struct ocfs2_refcount_tree *rf = cache_info_to_refcount(ci); | ||
147 | |||
148 | mutex_unlock(&rf->rf_io_mutex); | ||
149 | } | ||
150 | |||
151 | static const struct ocfs2_caching_operations ocfs2_refcount_caching_ops = { | ||
152 | .co_owner = ocfs2_refcount_cache_owner, | ||
153 | .co_get_super = ocfs2_refcount_cache_get_super, | ||
154 | .co_cache_lock = ocfs2_refcount_cache_lock, | ||
155 | .co_cache_unlock = ocfs2_refcount_cache_unlock, | ||
156 | .co_io_lock = ocfs2_refcount_cache_io_lock, | ||
157 | .co_io_unlock = ocfs2_refcount_cache_io_unlock, | ||
158 | }; | ||