• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6.36/fs/ocfs2/

Lines Matching refs:ci

73 u64 ocfs2_metadata_cache_owner(struct ocfs2_caching_info *ci)
75 BUG_ON(!ci || !ci->ci_ops);
77 return ci->ci_ops->co_owner(ci);
80 struct super_block *ocfs2_metadata_cache_get_super(struct ocfs2_caching_info *ci)
82 BUG_ON(!ci || !ci->ci_ops);
84 return ci->ci_ops->co_get_super(ci);
87 static void ocfs2_metadata_cache_lock(struct ocfs2_caching_info *ci)
89 BUG_ON(!ci || !ci->ci_ops);
91 ci->ci_ops->co_cache_lock(ci);
94 static void ocfs2_metadata_cache_unlock(struct ocfs2_caching_info *ci)
96 BUG_ON(!ci || !ci->ci_ops);
98 ci->ci_ops->co_cache_unlock(ci);
101 void ocfs2_metadata_cache_io_lock(struct ocfs2_caching_info *ci)
103 BUG_ON(!ci || !ci->ci_ops);
105 ci->ci_ops->co_io_lock(ci);
108 void ocfs2_metadata_cache_io_unlock(struct ocfs2_caching_info *ci)
110 BUG_ON(!ci || !ci->ci_ops);
112 ci->ci_ops->co_io_unlock(ci);
116 static void ocfs2_metadata_cache_reset(struct ocfs2_caching_info *ci,
119 ci->ci_flags |= OCFS2_CACHE_FL_INLINE;
120 ci->ci_num_cached = 0;
123 ci->ci_created_trans = 0;
124 ci->ci_last_trans = 0;
128 void ocfs2_metadata_cache_init(struct ocfs2_caching_info *ci,
133 ci->ci_ops = ops;
134 ocfs2_metadata_cache_reset(ci, 1);
137 void ocfs2_metadata_cache_exit(struct ocfs2_caching_info *ci)
139 ocfs2_metadata_cache_purge(ci);
140 ocfs2_metadata_cache_reset(ci, 1);
172 void ocfs2_metadata_cache_purge(struct ocfs2_caching_info *ci)
177 BUG_ON(!ci || !ci->ci_ops);
179 ocfs2_metadata_cache_lock(ci);
180 tree = !(ci->ci_flags & OCFS2_CACHE_FL_INLINE);
181 to_purge = ci->ci_num_cached;
185 (unsigned long long)ocfs2_metadata_cache_owner(ci));
191 root = ci->ci_cache.ci_tree;
193 ocfs2_metadata_cache_reset(ci, 0);
194 ocfs2_metadata_cache_unlock(ci);
202 (unsigned long long)ocfs2_metadata_cache_owner(ci),
208 static int ocfs2_search_cache_array(struct ocfs2_caching_info *ci,
213 for (i = 0; i < ci->ci_num_cached; i++) {
214 if (item == ci->ci_cache.ci_array[i])
224 ocfs2_search_cache_tree(struct ocfs2_caching_info *ci,
227 struct rb_node * n = ci->ci_cache.ci_tree.rb_node;
244 static int ocfs2_buffer_cached(struct ocfs2_caching_info *ci,
250 ocfs2_metadata_cache_lock(ci);
253 (unsigned long long)ocfs2_metadata_cache_owner(ci),
255 !!(ci->ci_flags & OCFS2_CACHE_FL_INLINE));
257 if (ci->ci_flags & OCFS2_CACHE_FL_INLINE)
258 index = ocfs2_search_cache_array(ci, bh->b_blocknr);
260 item = ocfs2_search_cache_tree(ci, bh->b_blocknr);
262 ocfs2_metadata_cache_unlock(ci);
274 int ocfs2_buffer_uptodate(struct ocfs2_caching_info *ci,
290 return ocfs2_buffer_cached(ci, bh);
297 int ocfs2_buffer_read_ahead(struct ocfs2_caching_info *ci,
300 return buffer_locked(bh) && ocfs2_buffer_cached(ci, bh);
304 static void ocfs2_append_cache_array(struct ocfs2_caching_info *ci,
307 BUG_ON(ci->ci_num_cached >= OCFS2_CACHE_INFO_MAX_ARRAY);
310 ci->ci_num_cached);
312 ci->ci_cache.ci_array[ci->ci_num_cached] = block;
313 ci->ci_num_cached++;
319 static void __ocfs2_insert_cache_tree(struct ocfs2_caching_info *ci,
324 struct rb_node **p = &ci->ci_cache.ci_tree.rb_node;
328 ci->ci_num_cached);
348 rb_insert_color(&new->c_node, &ci->ci_cache.ci_tree);
349 ci->ci_num_cached++;
353 static inline int ocfs2_insert_can_use_array(struct ocfs2_caching_info *ci)
355 return (ci->ci_flags & OCFS2_CACHE_FL_INLINE) &&
356 (ci->ci_num_cached < OCFS2_CACHE_INFO_MAX_ARRAY);
364 static void ocfs2_expand_cache(struct ocfs2_caching_info *ci,
369 mlog_bug_on_msg(ci->ci_num_cached != OCFS2_CACHE_INFO_MAX_ARRAY,
371 (unsigned long long)ocfs2_metadata_cache_owner(ci),
372 ci->ci_num_cached, OCFS2_CACHE_INFO_MAX_ARRAY);
373 mlog_bug_on_msg(!(ci->ci_flags & OCFS2_CACHE_FL_INLINE),
375 (unsigned long long)ocfs2_metadata_cache_owner(ci));
380 tree[i]->c_block = ci->ci_cache.ci_array[i];
382 ci->ci_flags &= ~OCFS2_CACHE_FL_INLINE;
383 ci->ci_cache.ci_tree = RB_ROOT;
385 ci->ci_num_cached = 0;
388 __ocfs2_insert_cache_tree(ci, tree[i]);
393 (unsigned long long)ocfs2_metadata_cache_owner(ci),
394 ci->ci_flags, ci->ci_num_cached);
399 static void __ocfs2_set_buffer_uptodate(struct ocfs2_caching_info *ci,
409 (unsigned long long)ocfs2_metadata_cache_owner(ci),
434 ocfs2_metadata_cache_lock(ci);
435 if (ocfs2_insert_can_use_array(ci)) {
439 ocfs2_append_cache_array(ci, block);
440 ocfs2_metadata_cache_unlock(ci);
445 ocfs2_expand_cache(ci, tree);
447 __ocfs2_insert_cache_tree(ci, new);
448 ocfs2_metadata_cache_unlock(ci);
483 void ocfs2_set_buffer_uptodate(struct ocfs2_caching_info *ci,
490 if (ocfs2_buffer_cached(ci, bh))
494 (unsigned long long)ocfs2_metadata_cache_owner(ci),
499 ocfs2_metadata_cache_lock(ci);
500 if (ocfs2_insert_can_use_array(ci)) {
503 ocfs2_append_cache_array(ci, bh->b_blocknr);
504 ocfs2_metadata_cache_unlock(ci);
509 if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) {
513 ocfs2_metadata_cache_unlock(ci);
515 __ocfs2_set_buffer_uptodate(ci, bh->b_blocknr, expand);
521 void ocfs2_set_new_buffer_uptodate(struct ocfs2_caching_info *ci,
525 BUG_ON(ocfs2_buffer_cached(ci, bh));
529 ocfs2_metadata_cache_io_lock(ci);
530 ocfs2_set_buffer_uptodate(ci, bh);
531 ocfs2_metadata_cache_io_unlock(ci);
535 static void ocfs2_remove_metadata_array(struct ocfs2_caching_info *ci,
538 sector_t *array = ci->ci_cache.ci_array;
542 BUG_ON(index >= ci->ci_num_cached);
543 BUG_ON(!ci->ci_num_cached);
546 ci->ci_num_cached);
548 ci->ci_num_cached--;
552 if (ci->ci_num_cached && index < ci->ci_num_cached) {
553 bytes = sizeof(sector_t) * (ci->ci_num_cached - index);
559 static void ocfs2_remove_metadata_tree(struct ocfs2_caching_info *ci,
565 rb_erase(&item->c_node, &ci->ci_cache.ci_tree);
566 ci->ci_num_cached--;
569 static void ocfs2_remove_block_from_cache(struct ocfs2_caching_info *ci,
575 ocfs2_metadata_cache_lock(ci);
577 (unsigned long long)ocfs2_metadata_cache_owner(ci),
578 (unsigned long long) block, ci->ci_num_cached,
579 ci->ci_flags & OCFS2_CACHE_FL_INLINE);
581 if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) {
582 index = ocfs2_search_cache_array(ci, block);
584 ocfs2_remove_metadata_array(ci, index);
586 item = ocfs2_search_cache_tree(ci, block);
588 ocfs2_remove_metadata_tree(ci, item);
590 ocfs2_metadata_cache_unlock(ci);
601 void ocfs2_remove_from_cache(struct ocfs2_caching_info *ci,
606 ocfs2_remove_block_from_cache(ci, block);
610 void ocfs2_remove_xattr_clusters_from_cache(struct ocfs2_caching_info *ci,
614 struct super_block *sb = ocfs2_metadata_cache_get_super(ci);
618 ocfs2_remove_block_from_cache(ci, block);