ocfs2: Remove mlog(0) from fs/ocfs2/dir.c
authorTao Ma <boyu.mt@taobao.com>
Wed, 23 Feb 2011 14:30:23 +0000 (22:30 +0800)
committerTao Ma <boyu.mt@taobao.com>
Wed, 23 Feb 2011 14:30:23 +0000 (22:30 +0800)
This is the 2nd step to remove the debug info of NAMEI.

Signed-off-by: Tao Ma <boyu.mt@taobao.com>
fs/ocfs2/dir.c
fs/ocfs2/ocfs2_trace.h

index 2fc6c3673beaa107e8cea33c66f7860a2efbf318..0740752ca31eb11b7543b877c538418bfae3e381 100644 (file)
@@ -43,7 +43,6 @@
 #include <linux/quotaops.h>
 #include <linux/sort.h>
 
 #include <linux/quotaops.h>
 #include <linux/sort.h>
 
-#define MLOG_MASK_PREFIX ML_NAMEI
 #include <cluster/masklog.h>
 
 #include "ocfs2.h"
 #include <cluster/masklog.h>
 
 #include "ocfs2.h"
@@ -61,6 +60,7 @@
 #include "super.h"
 #include "sysfile.h"
 #include "uptodate.h"
 #include "super.h"
 #include "sysfile.h"
 #include "uptodate.h"
+#include "ocfs2_trace.h"
 
 #include "buffer_head_io.h"
 
 
 #include "buffer_head_io.h"
 
@@ -400,7 +400,7 @@ static int inline ocfs2_search_dirblock(struct buffer_head *bh,
        }
 
 bail:
        }
 
 bail:
-       mlog(0, "ret = %d\n", ret);
+       trace_ocfs2_search_dirblock(ret);
        return ret;
 }
 
        return ret;
 }
 
@@ -445,8 +445,7 @@ static int ocfs2_validate_dir_block(struct super_block *sb,
         * We don't validate dirents here, that's handled
         * in-place when the code walks them.
         */
         * We don't validate dirents here, that's handled
         * in-place when the code walks them.
         */
-       mlog(0, "Validating dirblock %llu\n",
-            (unsigned long long)bh->b_blocknr);
+       trace_ocfs2_validate_dir_block((unsigned long long)bh->b_blocknr);
 
        BUG_ON(!buffer_uptodate(bh));
 
 
        BUG_ON(!buffer_uptodate(bh));
 
@@ -784,7 +783,7 @@ cleanup_and_exit:
        for (; ra_ptr < ra_max; ra_ptr++)
                brelse(bh_use[ra_ptr]);
 
        for (; ra_ptr < ra_max; ra_ptr++)
                brelse(bh_use[ra_ptr]);
 
-       mlog(0, "ret = %p\n", ret);
+       trace_ocfs2_find_entry_el(ret);
        return ret;
 }
 
        return ret;
 }
 
@@ -946,11 +945,9 @@ static int ocfs2_dx_dir_search(const char *name, int namelen,
                goto out;
        }
 
                goto out;
        }
 
-       mlog(0, "Dir %llu: name: \"%.*s\", lookup of hash: %u.0x%x "
-            "returns: %llu\n",
-            (unsigned long long)OCFS2_I(dir)->ip_blkno,
-            namelen, name, hinfo->major_hash, hinfo->minor_hash,
-            (unsigned long long)phys);
+       trace_ocfs2_dx_dir_search((unsigned long long)OCFS2_I(dir)->ip_blkno,
+                                 namelen, name, hinfo->major_hash,
+                                 hinfo->minor_hash, (unsigned long long)phys);
 
        ret = ocfs2_read_dx_leaf(dir, phys, &dx_leaf_bh);
        if (ret) {
 
        ret = ocfs2_read_dx_leaf(dir, phys, &dx_leaf_bh);
        if (ret) {
@@ -960,9 +957,9 @@ static int ocfs2_dx_dir_search(const char *name, int namelen,
 
        dx_leaf = (struct ocfs2_dx_leaf *) dx_leaf_bh->b_data;
 
 
        dx_leaf = (struct ocfs2_dx_leaf *) dx_leaf_bh->b_data;
 
-       mlog(0, "leaf info: num_used: %d, count: %d\n",
-            le16_to_cpu(dx_leaf->dl_list.de_num_used),
-            le16_to_cpu(dx_leaf->dl_list.de_count));
+       trace_ocfs2_dx_dir_search_leaf_info(
+                       le16_to_cpu(dx_leaf->dl_list.de_num_used),
+                       le16_to_cpu(dx_leaf->dl_list.de_count));
 
        entry_list = &dx_leaf->dl_list;
 
 
        entry_list = &dx_leaf->dl_list;
 
@@ -1162,8 +1159,6 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir,
        int i, status = -ENOENT;
        ocfs2_journal_access_func access = ocfs2_journal_access_db;
 
        int i, status = -ENOENT;
        ocfs2_journal_access_func access = ocfs2_journal_access_db;
 
-       mlog(0, "(0x%p, 0x%p, 0x%p, 0x%p)\n", handle, dir, de_del, bh);
-
        if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
                access = ocfs2_journal_access_di;
 
        if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
                access = ocfs2_journal_access_di;
 
@@ -1343,8 +1338,8 @@ static int ocfs2_delete_entry_dx(handle_t *handle, struct inode *dir,
                }
        }
 
                }
        }
 
-       mlog(0, "Dir %llu: delete entry at index: %d\n",
-            (unsigned long long)OCFS2_I(dir)->ip_blkno, index);
+       trace_ocfs2_delete_entry_dx((unsigned long long)OCFS2_I(dir)->ip_blkno,
+                                   index);
 
        ret = __ocfs2_delete_entry(handle, dir, lookup->dl_entry,
                                   leaf_bh, leaf_bh->b_data, leaf_bh->b_size);
 
        ret = __ocfs2_delete_entry(handle, dir, lookup->dl_entry,
                                   leaf_bh, leaf_bh->b_data, leaf_bh->b_size);
@@ -2022,8 +2017,7 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir)
        struct inode *inode = filp->f_path.dentry->d_inode;
        int lock_level = 0;
 
        struct inode *inode = filp->f_path.dentry->d_inode;
        int lock_level = 0;
 
-       mlog(0, "dirino=%llu\n",
-            (unsigned long long)OCFS2_I(inode)->ip_blkno);
+       trace_ocfs2_readdir((unsigned long long)OCFS2_I(inode)->ip_blkno);
 
        error = ocfs2_inode_lock_atime(inode, filp->f_vfsmnt, &lock_level);
        if (lock_level && error >= 0) {
 
        error = ocfs2_inode_lock_atime(inode, filp->f_vfsmnt, &lock_level);
        if (lock_level && error >= 0) {
@@ -2064,8 +2058,8 @@ int ocfs2_find_files_on_disk(const char *name,
 {
        int status = -ENOENT;
 
 {
        int status = -ENOENT;
 
-       mlog(0, "name=%.*s, blkno=%p, inode=%llu\n", namelen, name, blkno,
-            (unsigned long long)OCFS2_I(inode)->ip_blkno);
+       trace_ocfs2_find_files_on_disk(namelen, name, blkno,
+                               (unsigned long long)OCFS2_I(inode)->ip_blkno);
 
        status = ocfs2_find_entry(name, namelen, inode, lookup);
        if (status)
 
        status = ocfs2_find_entry(name, namelen, inode, lookup);
        if (status)
@@ -2109,8 +2103,8 @@ int ocfs2_check_dir_for_entry(struct inode *dir,
        int ret;
        struct ocfs2_dir_lookup_result lookup = { NULL, };
 
        int ret;
        struct ocfs2_dir_lookup_result lookup = { NULL, };
 
-       mlog(0, "dir %llu, name '%.*s'\n",
-            (unsigned long long)OCFS2_I(dir)->ip_blkno, namelen, name);
+       trace_ocfs2_check_dir_for_entry(
+               (unsigned long long)OCFS2_I(dir)->ip_blkno, namelen, name);
 
        ret = -EEXIST;
        if (ocfs2_find_entry(name, namelen, dir, &lookup) == 0)
 
        ret = -EEXIST;
        if (ocfs2_find_entry(name, namelen, dir, &lookup) == 0)
@@ -2402,9 +2396,9 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb,
                goto out;
        }
 
                goto out;
        }
 
-       mlog(0, "Dir %llu, attach new index block: %llu\n",
-            (unsigned long long)OCFS2_I(dir)->ip_blkno,
-            (unsigned long long)dr_blkno);
+       trace_ocfs2_dx_dir_attach_index(
+                               (unsigned long long)OCFS2_I(dir)->ip_blkno,
+                               (unsigned long long)dr_blkno);
 
        dx_root_bh = sb_getblk(osb->sb, dr_blkno);
        if (dx_root_bh == NULL) {
 
        dx_root_bh = sb_getblk(osb->sb, dr_blkno);
        if (dx_root_bh == NULL) {
@@ -2504,11 +2498,10 @@ static int ocfs2_dx_dir_format_cluster(struct ocfs2_super *osb,
                dx_leaf->dl_list.de_count =
                        cpu_to_le16(ocfs2_dx_entries_per_leaf(osb->sb));
 
                dx_leaf->dl_list.de_count =
                        cpu_to_le16(ocfs2_dx_entries_per_leaf(osb->sb));
 
-               mlog(0,
-                    "Dir %llu, format dx_leaf: %llu, entry count: %u\n",
-                    (unsigned long long)OCFS2_I(dir)->ip_blkno,
-                    (unsigned long long)bh->b_blocknr,
-                    le16_to_cpu(dx_leaf->dl_list.de_count));
+               trace_ocfs2_dx_dir_format_cluster(
+                               (unsigned long long)OCFS2_I(dir)->ip_blkno,
+                               (unsigned long long)bh->b_blocknr,
+                               le16_to_cpu(dx_leaf->dl_list.de_count));
 
                ocfs2_journal_dirty(handle, bh);
        }
 
                ocfs2_journal_dirty(handle, bh);
        }
@@ -2752,12 +2745,11 @@ static void ocfs2_dx_dir_index_root_block(struct inode *dir,
 
                ocfs2_dx_dir_name_hash(dir, de->name, de->name_len, &hinfo);
 
 
                ocfs2_dx_dir_name_hash(dir, de->name, de->name_len, &hinfo);
 
-               mlog(0,
-                    "dir: %llu, major: 0x%x minor: 0x%x, index: %u, name: %.*s\n",
-                    (unsigned long long)dir->i_ino, hinfo.major_hash,
-                    hinfo.minor_hash,
-                    le16_to_cpu(dx_root->dr_entries.de_num_used),
-                    de->name_len, de->name);
+               trace_ocfs2_dx_dir_index_root_block(
+                               (unsigned long long)dir->i_ino,
+                               hinfo.major_hash, hinfo.minor_hash,
+                               de->name_len, de->name,
+                               le16_to_cpu(dx_root->dr_entries.de_num_used));
 
                ocfs2_dx_entry_list_insert(&dx_root->dr_entries, &hinfo,
                                           dirent_blk);
 
                ocfs2_dx_entry_list_insert(&dx_root->dr_entries, &hinfo,
                                           dirent_blk);
@@ -3310,8 +3302,8 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
        down_write(&OCFS2_I(dir)->ip_alloc_sem);
        drop_alloc_sem = 1;
        dir_i_size = i_size_read(dir);
        down_write(&OCFS2_I(dir)->ip_alloc_sem);
        drop_alloc_sem = 1;
        dir_i_size = i_size_read(dir);
-       mlog(0, "extending dir %llu (i_size = %lld)\n",
-            (unsigned long long)OCFS2_I(dir)->ip_blkno, dir_i_size);
+       trace_ocfs2_extend_dir((unsigned long long)OCFS2_I(dir)->ip_blkno,
+                              dir_i_size);
 
        /* dir->i_size is always block aligned. */
        spin_lock(&OCFS2_I(dir)->ip_lock);
 
        /* dir->i_size is always block aligned. */
        spin_lock(&OCFS2_I(dir)->ip_lock);
@@ -3805,9 +3797,9 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir,
        struct ocfs2_dx_root_block *dx_root;
        struct ocfs2_dx_leaf *tmp_dx_leaf = NULL;
 
        struct ocfs2_dx_root_block *dx_root;
        struct ocfs2_dx_leaf *tmp_dx_leaf = NULL;
 
-       mlog(0, "DX Dir: %llu, rebalance leaf leaf_blkno: %llu insert: %u\n",
-            (unsigned long long)OCFS2_I(dir)->ip_blkno,
-            (unsigned long long)leaf_blkno, insert_hash);
+       trace_ocfs2_dx_dir_rebalance((unsigned long long)OCFS2_I(dir)->ip_blkno,
+                                    (unsigned long long)leaf_blkno,
+                                    insert_hash);
 
        ocfs2_init_dx_root_extent_tree(&et, INODE_CACHE(dir), dx_root_bh);
 
 
        ocfs2_init_dx_root_extent_tree(&et, INODE_CACHE(dir), dx_root_bh);
 
@@ -3887,8 +3879,7 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir,
                goto  out_commit;
        }
 
                goto  out_commit;
        }
 
-       mlog(0, "Split leaf (%u) at %u, insert major hash is %u\n",
-            leaf_cpos, split_hash, insert_hash);
+       trace_ocfs2_dx_dir_rebalance_split(leaf_cpos, split_hash, insert_hash);
 
        /*
         * We have to carefully order operations here. There are items
 
        /*
         * We have to carefully order operations here. There are items
@@ -4345,8 +4336,8 @@ int ocfs2_prepare_dir_for_insert(struct ocfs2_super *osb,
        unsigned int blocks_wanted = 1;
        struct buffer_head *bh = NULL;
 
        unsigned int blocks_wanted = 1;
        struct buffer_head *bh = NULL;
 
-       mlog(0, "getting ready to insert namelen %d into dir %llu\n",
-            namelen, (unsigned long long)OCFS2_I(dir)->ip_blkno);
+       trace_ocfs2_prepare_dir_for_insert(
+               (unsigned long long)OCFS2_I(dir)->ip_blkno, namelen);
 
        if (!namelen) {
                ret = -EINVAL;
 
        if (!namelen) {
                ret = -EINVAL;
index 0f7165914401fa49befd335998e7f3eb3e8be324..25e057e9d14d3d9567f791ab76bbd31105797c19 100644 (file)
@@ -2013,6 +2013,122 @@ DEFINE_OCFS2_UINT_INT_EVENT(ocfs2_acquire_dquot);
 DEFINE_OCFS2_UINT_INT_EVENT(ocfs2_mark_dquot_dirty);
 
 /* End of trace events for fs/ocfs2/quota_global.c. */
 DEFINE_OCFS2_UINT_INT_EVENT(ocfs2_mark_dquot_dirty);
 
 /* End of trace events for fs/ocfs2/quota_global.c. */
+
+/* Trace events for fs/ocfs2/dir.c. */
+DEFINE_OCFS2_INT_EVENT(ocfs2_search_dirblock);
+
+DEFINE_OCFS2_ULL_EVENT(ocfs2_validate_dir_block);
+
+DEFINE_OCFS2_POINTER_EVENT(ocfs2_find_entry_el);
+
+TRACE_EVENT(ocfs2_dx_dir_search,
+       TP_PROTO(unsigned long long ino, int namelen, const char *name,
+                unsigned int major_hash, unsigned int minor_hash,
+                unsigned long long blkno),
+       TP_ARGS(ino, namelen, name, major_hash, minor_hash, blkno),
+       TP_STRUCT__entry(
+               __field(unsigned long long, ino)
+               __field(int, namelen)
+               __string(name, name)
+               __field(unsigned int, major_hash)
+               __field(unsigned int,minor_hash)
+               __field(unsigned long long, blkno)
+       ),
+       TP_fast_assign(
+               __entry->ino = ino;
+               __entry->namelen = namelen;
+               __assign_str(name, name);
+               __entry->major_hash = major_hash;
+               __entry->minor_hash = minor_hash;
+               __entry->blkno = blkno;
+       ),
+       TP_printk("%llu %.*s %u %u %llu", __entry->ino,
+                  __entry->namelen, __get_str(name),
+                 __entry->major_hash, __entry->minor_hash, __entry->blkno)
+);
+
+DEFINE_OCFS2_UINT_UINT_EVENT(ocfs2_dx_dir_search_leaf_info);
+
+DEFINE_OCFS2_ULL_INT_EVENT(ocfs2_delete_entry_dx);
+
+DEFINE_OCFS2_ULL_EVENT(ocfs2_readdir);
+
+TRACE_EVENT(ocfs2_find_files_on_disk,
+       TP_PROTO(int namelen, const char *name, void *blkno,
+                unsigned long long dir),
+       TP_ARGS(namelen, name, blkno, dir),
+       TP_STRUCT__entry(
+               __field(int, namelen)
+               __string(name, name)
+               __field(void *, blkno)
+               __field(unsigned long long, dir)
+       ),
+       TP_fast_assign(
+               __entry->namelen = namelen;
+               __assign_str(name, name);
+               __entry->blkno = blkno;
+               __entry->dir = dir;
+       ),
+       TP_printk("%.*s %p %llu", __entry->namelen, __get_str(name),
+                 __entry->blkno, __entry->dir)
+);
+
+TRACE_EVENT(ocfs2_check_dir_for_entry,
+       TP_PROTO(unsigned long long dir, int namelen, const char *name),
+       TP_ARGS(dir, namelen, name),
+       TP_STRUCT__entry(
+               __field(unsigned long long, dir)
+               __field(int, namelen)
+               __string(name, name)
+       ),
+       TP_fast_assign(
+               __entry->dir = dir;
+               __entry->namelen = namelen;
+               __assign_str(name, name);
+       ),
+       TP_printk("%llu %.*s", __entry->dir,
+                 __entry->namelen, __get_str(name))
+);
+
+DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_dx_dir_attach_index);
+
+DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_dx_dir_format_cluster);
+
+TRACE_EVENT(ocfs2_dx_dir_index_root_block,
+       TP_PROTO(unsigned long long dir,
+                unsigned int major_hash, unsigned int minor_hash,
+                int namelen, const char *name, unsigned int num_used),
+       TP_ARGS(dir, major_hash, minor_hash, namelen, name, num_used),
+       TP_STRUCT__entry(
+               __field(unsigned long long, dir)
+               __field(unsigned int, major_hash)
+               __field(unsigned int, minor_hash)
+               __field(int, namelen)
+               __string(name, name)
+               __field(unsigned int, num_used)
+       ),
+       TP_fast_assign(
+               __entry->dir = dir;
+               __entry->major_hash = major_hash;
+               __entry->minor_hash = minor_hash;
+               __entry->namelen = namelen;
+               __assign_str(name, name);
+               __entry->num_used = num_used;
+       ),
+       TP_printk("%llu %x %x %.*s %u", __entry->dir,
+                 __entry->major_hash, __entry->minor_hash,
+                  __entry->namelen, __get_str(name), __entry->num_used)
+);
+
+DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_extend_dir);
+
+DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_dx_dir_rebalance);
+
+DEFINE_OCFS2_UINT_UINT_UINT_EVENT(ocfs2_dx_dir_rebalance_split);
+
+DEFINE_OCFS2_ULL_INT_EVENT(ocfs2_prepare_dir_for_insert);
+
+/* End of trace events for fs/ocfs2/dir.c. */
 #endif /* _TRACE_OCFS2_H */
 
 /* This part must be outside protection */
 #endif /* _TRACE_OCFS2_H */
 
 /* This part must be outside protection */