Skip to content

Commit

Permalink
ocfs2: Remove masklog ML_UPTODATE.
Browse files Browse the repository at this point in the history
Remove mlog(0,...) and mlog(ML_UPTODATE,...) from
fs/ocfs2/uptodate.c and fs/ocfs2/buffer_head_io.c.

The masklog UPTODATE is removed finally.

Signed-off-by: Tao Ma <boyu.mt@taobao.com>
  • Loading branch information
Tao Ma committed Feb 24, 2011
1 parent 15057e9 commit d701485
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 41 deletions.
3 changes: 1 addition & 2 deletions fs/ocfs2/buffer_head_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,7 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
*/

if (!ignore_cache && !ocfs2_buffer_uptodate(ci, bh)) {
mlog(ML_UPTODATE,
"bh (%llu), owner %llu not uptodate\n",
trace_ocfs2_read_blocks_from_disk(
(unsigned long long)bh->b_blocknr,
(unsigned long long)ocfs2_metadata_cache_owner(ci));
/* We're using ignore_cache here to say
Expand Down
1 change: 0 additions & 1 deletion fs/ocfs2/cluster/masklog.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ static struct mlog_attribute mlog_attrs[MLOG_MAX_BITS] = {
define_mask(DLM_RECOVERY),
define_mask(AIO),
define_mask(DLM_GLUE),
define_mask(UPTODATE),
define_mask(VOTE),
define_mask(CONN),
define_mask(QUORUM),
Expand Down
1 change: 0 additions & 1 deletion fs/ocfs2/cluster/masklog.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
#define ML_DLM_RECOVERY 0x0000000000001000ULL /* dlm master functions */
#define ML_AIO 0x0000000000002000ULL /* ocfs2 aio read and write */
#define ML_DLM_GLUE 0x0000000000080000ULL /* ocfs2 dlm glue layer */
#define ML_UPTODATE 0x0000000000200000ULL /* ocfs2 caching sequence #'s */
#define ML_VOTE 0x0000000001000000ULL /* ocfs2 node messaging */
#define ML_CONN 0x0000000004000000ULL /* net connection management */
#define ML_QUORUM 0x0000000008000000ULL /* net connection quorum */
Expand Down
42 changes: 42 additions & 0 deletions fs/ocfs2/ocfs2_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -2649,6 +2649,8 @@ DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_read_blocks_sync);

DEFINE_OCFS2_ULL_EVENT(ocfs2_read_blocks_sync_jbd);

DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_read_blocks_from_disk);

DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_read_blocks_bh);

DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_read_blocks_end);
Expand Down Expand Up @@ -2688,6 +2690,46 @@ TRACE_EVENT(ocfs2_read_blocks_begin,
);

/* End of trace events for fs/ocfs2/buffer_head_io.c. */

/* Trace events for fs/ocfs2/uptodate.c. */

DEFINE_OCFS2_ULL_EVENT(ocfs2_purge_copied_metadata_tree);

DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_metadata_cache_purge);

DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_buffer_cached_begin);

TRACE_EVENT(ocfs2_buffer_cached_end,
TP_PROTO(int index, void *item),
TP_ARGS(index, item),
TP_STRUCT__entry(
__field(int, index)
__field(void *, item)
),
TP_fast_assign(
__entry->index = index;
__entry->item = item;
),
TP_printk("%d %p", __entry->index, __entry->item)
);

DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_append_cache_array);

DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_insert_cache_tree);

DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_expand_cache);

DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_set_buffer_uptodate);

DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_set_buffer_uptodate_begin);

DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_remove_metadata_array);

DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_remove_metadata_tree);

DEFINE_OCFS2_ULL_ULL_UINT_UINT_EVENT(ocfs2_remove_block_from_cache);

/* End of trace events for fs/ocfs2/uptodate.c. */
#endif /* _TRACE_OCFS2_H */

/* This part must be outside protection */
Expand Down
73 changes: 36 additions & 37 deletions fs/ocfs2/uptodate.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,13 @@
#include <linux/buffer_head.h>
#include <linux/rbtree.h>

#define MLOG_MASK_PREFIX ML_UPTODATE

#include <cluster/masklog.h>

#include "ocfs2.h"

#include "inode.h"
#include "uptodate.h"
#include "ocfs2_trace.h"

struct ocfs2_meta_cache_item {
struct rb_node c_node;
Expand Down Expand Up @@ -152,8 +151,8 @@ static unsigned int ocfs2_purge_copied_metadata_tree(struct rb_root *root)
while ((node = rb_last(root)) != NULL) {
item = rb_entry(node, struct ocfs2_meta_cache_item, c_node);

mlog(0, "Purge item %llu\n",
(unsigned long long) item->c_block);
trace_ocfs2_purge_copied_metadata_tree(
(unsigned long long) item->c_block);

rb_erase(&item->c_node, root);
kmem_cache_free(ocfs2_uptodate_cachep, item);
Expand All @@ -180,9 +179,9 @@ void ocfs2_metadata_cache_purge(struct ocfs2_caching_info *ci)
tree = !(ci->ci_flags & OCFS2_CACHE_FL_INLINE);
to_purge = ci->ci_num_cached;

mlog(0, "Purge %u %s items from Owner %llu\n", to_purge,
tree ? "array" : "tree",
(unsigned long long)ocfs2_metadata_cache_owner(ci));
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
Expand Down Expand Up @@ -249,10 +248,10 @@ static int ocfs2_buffer_cached(struct ocfs2_caching_info *ci,

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));
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);
Expand All @@ -261,7 +260,7 @@ static int ocfs2_buffer_cached(struct ocfs2_caching_info *ci,

ocfs2_metadata_cache_unlock(ci);

mlog(0, "index = %d, item = %p\n", index, item);
trace_ocfs2_buffer_cached_end(index, item);

return (index != -1) || (item != NULL);
}
Expand Down Expand Up @@ -306,8 +305,9 @@ static void ocfs2_append_cache_array(struct ocfs2_caching_info *ci,
{
BUG_ON(ci->ci_num_cached >= OCFS2_CACHE_INFO_MAX_ARRAY);

mlog(0, "block %llu takes position %u\n", (unsigned long long) block,
ci->ci_num_cached);
trace_ocfs2_append_cache_array(
(unsigned long long)ocfs2_metadata_cache_owner(ci),
(unsigned long long)block, ci->ci_num_cached);

ci->ci_cache.ci_array[ci->ci_num_cached] = block;
ci->ci_num_cached++;
Expand All @@ -324,8 +324,9 @@ static void __ocfs2_insert_cache_tree(struct ocfs2_caching_info *ci,
struct rb_node **p = &ci->ci_cache.ci_tree.rb_node;
struct ocfs2_meta_cache_item *tmp;

mlog(0, "Insert block %llu num = %u\n", (unsigned long long) block,
ci->ci_num_cached);
trace_ocfs2_insert_cache_tree(
(unsigned long long)ocfs2_metadata_cache_owner(ci),
(unsigned long long)block, ci->ci_num_cached);

while(*p) {
parent = *p;
Expand Down Expand Up @@ -389,9 +390,9 @@ static void ocfs2_expand_cache(struct ocfs2_caching_info *ci,
tree[i] = NULL;
}

mlog(0, "Expanded %llu to a tree cache: flags 0x%x, num = %u\n",
(unsigned long long)ocfs2_metadata_cache_owner(ci),
ci->ci_flags, ci->ci_num_cached);
trace_ocfs2_expand_cache(
(unsigned long long)ocfs2_metadata_cache_owner(ci),
ci->ci_flags, ci->ci_num_cached);
}

/* Slow path function - memory allocation is necessary. See the
Expand All @@ -405,9 +406,9 @@ static void __ocfs2_set_buffer_uptodate(struct ocfs2_caching_info *ci,
struct ocfs2_meta_cache_item *tree[OCFS2_CACHE_INFO_MAX_ARRAY] =
{ NULL, };

mlog(0, "Owner %llu, block %llu, expand = %d\n",
(unsigned long long)ocfs2_metadata_cache_owner(ci),
(unsigned long long)block, expand_tree);
trace_ocfs2_set_buffer_uptodate(
(unsigned long long)ocfs2_metadata_cache_owner(ci),
(unsigned long long)block, expand_tree);

new = kmem_cache_alloc(ocfs2_uptodate_cachep, GFP_NOFS);
if (!new) {
Expand All @@ -433,7 +434,6 @@ static void __ocfs2_set_buffer_uptodate(struct ocfs2_caching_info *ci,

ocfs2_metadata_cache_lock(ci);
if (ocfs2_insert_can_use_array(ci)) {
mlog(0, "Someone cleared the tree underneath us\n");
/* Ok, items were removed from the cache in between
* locks. Detect this and revert back to the fast path */
ocfs2_append_cache_array(ci, block);
Expand Down Expand Up @@ -490,9 +490,9 @@ void ocfs2_set_buffer_uptodate(struct ocfs2_caching_info *ci,
if (ocfs2_buffer_cached(ci, bh))
return;

mlog(0, "Owner %llu, inserting block %llu\n",
(unsigned long long)ocfs2_metadata_cache_owner(ci),
(unsigned long long)bh->b_blocknr);
trace_ocfs2_set_buffer_uptodate_begin(
(unsigned long long)ocfs2_metadata_cache_owner(ci),
(unsigned long long)bh->b_blocknr);

/* No need to recheck under spinlock - insertion is guarded by
* co_io_lock() */
Expand Down Expand Up @@ -542,8 +542,9 @@ static void ocfs2_remove_metadata_array(struct ocfs2_caching_info *ci,
BUG_ON(index >= ci->ci_num_cached);
BUG_ON(!ci->ci_num_cached);

mlog(0, "remove index %d (num_cached = %u\n", index,
ci->ci_num_cached);
trace_ocfs2_remove_metadata_array(
(unsigned long long)ocfs2_metadata_cache_owner(ci),
index, ci->ci_num_cached);

ci->ci_num_cached--;

Expand All @@ -559,8 +560,9 @@ static void ocfs2_remove_metadata_array(struct ocfs2_caching_info *ci,
static void ocfs2_remove_metadata_tree(struct ocfs2_caching_info *ci,
struct ocfs2_meta_cache_item *item)
{
mlog(0, "remove block %llu from tree\n",
(unsigned long long) item->c_block);
trace_ocfs2_remove_metadata_tree(
(unsigned long long)ocfs2_metadata_cache_owner(ci),
(unsigned long long)item->c_block);

rb_erase(&item->c_node, &ci->ci_cache.ci_tree);
ci->ci_num_cached--;
Expand All @@ -573,10 +575,10 @@ static void ocfs2_remove_block_from_cache(struct ocfs2_caching_info *ci,
struct ocfs2_meta_cache_item *item = NULL;

ocfs2_metadata_cache_lock(ci);
mlog(0, "Owner %llu, remove %llu, items = %u, array = %u\n",
(unsigned long long)ocfs2_metadata_cache_owner(ci),
(unsigned long long) block, ci->ci_num_cached,
ci->ci_flags & OCFS2_CACHE_FL_INLINE);
trace_ocfs2_remove_block_from_cache(
(unsigned long long)ocfs2_metadata_cache_owner(ci),
(unsigned long long) block, ci->ci_num_cached,
ci->ci_flags);

if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) {
index = ocfs2_search_cache_array(ci, block);
Expand Down Expand Up @@ -626,9 +628,6 @@ int __init init_ocfs2_uptodate_cache(void)
if (!ocfs2_uptodate_cachep)
return -ENOMEM;

mlog(0, "%u inlined cache items per inode.\n",
OCFS2_CACHE_INFO_MAX_ARRAY);

return 0;
}

Expand Down

0 comments on commit d701485

Please sign in to comment.