/* Called from locking and called from ocfs2_clear_inode. Dump the * cache for a given inode. * * This function is a few more lines longer than necessary due to some * accounting done here, but I think it's worth tracking down those * bugs sooner -- Mark */ void ocfs2_metadata_cache_purge(struct ocfs2_caching_info *ci) { unsigned int tree, to_purge, purged; struct rb_root root = RB_ROOT; BUG_ON(!ci || !ci->ci_ops); ocfs2_metadata_cache_lock(ci); tree = !(ci->ci_flags & OCFS2_CACHE_FL_INLINE); to_purge = ci->ci_num_cached; trace_ocfs2_metadata_cache_purge( (unsigned long long)ocfs2_metadata_cache_owner(ci), to_purge, tree); /* If we're a tree, save off the root so that we can safely * initialize the cache. We do the work to free tree members * without the spinlock. */ if (tree) root = ci->ci_cache.ci_tree; ocfs2_metadata_cache_reset(ci, 0); ocfs2_metadata_cache_unlock(ci); purged = ocfs2_purge_copied_metadata_tree(&root); /* If possible, track the number wiped so that we can more * easily detect counting errors. Unfortunately, this is only * meaningful for trees. */ if (tree && purged != to_purge) mlog(ML_ERROR, "Owner %llu, count = %u, purged = %u\n", (unsigned long long)ocfs2_metadata_cache_owner(ci), to_purge, purged); }
static int ocfs2_buffer_cached(struct ocfs2_caching_info *ci, struct buffer_head *bh) { int index = -1; struct ocfs2_meta_cache_item *item = NULL; ocfs2_metadata_cache_lock(ci); trace_ocfs2_buffer_cached_begin( (unsigned long long)ocfs2_metadata_cache_owner(ci), (unsigned long long) bh->b_blocknr, !!(ci->ci_flags & OCFS2_CACHE_FL_INLINE)); if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) index = ocfs2_search_cache_array(ci, bh->b_blocknr); else item = ocfs2_search_cache_tree(ci, bh->b_blocknr); ocfs2_metadata_cache_unlock(ci); trace_ocfs2_buffer_cached_end(index, item); return (index != -1) || (item != NULL); }
static int ocfs2_buffer_cached(struct ocfs2_caching_info *ci, struct buffer_head *bh) { int index = -1; struct ocfs2_meta_cache_item *item = NULL; ocfs2_metadata_cache_lock(ci); mlog(0, "Owner %llu, query block %llu (inline = %u)\n", (unsigned long long)ocfs2_metadata_cache_owner(ci), (unsigned long long) bh->b_blocknr, !!(ci->ci_flags & OCFS2_CACHE_FL_INLINE)); if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) index = ocfs2_search_cache_array(ci, bh->b_blocknr); else item = ocfs2_search_cache_tree(ci, bh->b_blocknr); ocfs2_metadata_cache_unlock(ci); mlog(0, "index = %d, item = %p\n", index, item); return (index != -1) || (item != NULL); }