]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 28 Mar 2011 20:03:31 +0000 (13:03 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 28 Mar 2011 20:03:31 +0000 (13:03 -0700)
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2: (39 commits)
  Treat writes as new when holes span across page boundaries
  fs,ocfs2: Move o2net_get_func_run_time under CONFIG_OCFS2_FS_STATS.
  ocfs2/dlm: Move kmalloc() outside the spinlock
  ocfs2: Make the left masklogs compat.
  ocfs2: Remove masklog ML_AIO.
  ocfs2: Remove masklog ML_UPTODATE.
  ocfs2: Remove masklog ML_BH_IO.
  ocfs2: Remove masklog ML_JOURNAL.
  ocfs2: Remove masklog ML_EXPORT.
  ocfs2: Remove masklog ML_DCACHE.
  ocfs2: Remove masklog ML_NAMEI.
  ocfs2: Remove mlog(0) from fs/ocfs2/dir.c
  ocfs2: remove NAMEI from symlink.c
  ocfs2: Remove masklog ML_QUOTA.
  ocfs2: Remove mlog(0) from quota_local.c.
  ocfs2: Remove masklog ML_RESERVATIONS.
  ocfs2: Remove masklog ML_XATTR.
  ocfs2: Remove masklog ML_SUPER.
  ocfs2: Remove mlog(0) from fs/ocfs2/heartbeat.c
  ocfs2: Remove mlog(0) from fs/ocfs2/slot_map.c
  ...

Fix up trivial conflict in fs/ocfs2/super.c

1  2 
fs/ocfs2/acl.c
fs/ocfs2/aops.c
fs/ocfs2/cluster/heartbeat.c
fs/ocfs2/dir.c
fs/ocfs2/ioctl.c
fs/ocfs2/namei.c
fs/ocfs2/ocfs2.h
fs/ocfs2/quota_global.c
fs/ocfs2/refcounttree.c
fs/ocfs2/super.c
fs/ocfs2/xattr.c

diff --combined fs/ocfs2/acl.c
index 90f2729b7a5bc031e778fad1cf4b665409394247,69786e3eb43cdcc9c8034eabdd9ccbe65e2b5365..e913ad130fdd2cf9eafa0e73e343bad5974583e9
@@@ -24,7 -24,6 +24,6 @@@
  #include <linux/slab.h>
  #include <linux/string.h>
  
- #define MLOG_MASK_PREFIX ML_INODE
  #include <cluster/masklog.h>
  
  #include "ocfs2.h"
@@@ -497,7 -496,7 +496,7 @@@ static int ocfs2_xattr_set_acl(struct d
        if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
                return -EOPNOTSUPP;
  
 -      if (!is_owner_or_cap(inode))
 +      if (!inode_owner_or_capable(inode))
                return -EPERM;
  
        if (value) {
diff --combined fs/ocfs2/aops.c
index daea0359e9740263a525cec5c7f645e456d9a909,b5d7fb9ab1f3eb615b8e6c9d1a1717037952dd2e..ac97bca282d25ebb5943c41ac05fef385d93abf1
@@@ -29,7 -29,6 +29,6 @@@
  #include <linux/mpage.h>
  #include <linux/quotaops.h>
  
- #define MLOG_MASK_PREFIX ML_FILE_IO
  #include <cluster/masklog.h>
  
  #include "ocfs2.h"
@@@ -45,6 -44,7 +44,7 @@@
  #include "super.h"
  #include "symlink.h"
  #include "refcounttree.h"
+ #include "ocfs2_trace.h"
  
  #include "buffer_head_io.h"
  
@@@ -59,8 -59,9 +59,9 @@@ static int ocfs2_symlink_get_block(stru
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
        void *kaddr;
  
-       mlog_entry("(0x%p, %llu, 0x%p, %d)\n", inode,
-                  (unsigned long long)iblock, bh_result, create);
+       trace_ocfs2_symlink_get_block(
+                       (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                       (unsigned long long)iblock, bh_result, create);
  
        BUG_ON(ocfs2_inode_is_fast_symlink(inode));
  
  bail:
        brelse(bh);
  
-       mlog_exit(err);
        return err;
  }
  
@@@ -136,8 -136,8 +136,8 @@@ int ocfs2_get_block(struct inode *inode
        u64 p_blkno, count, past_eof;
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
  
-       mlog_entry("(0x%p, %llu, 0x%p, %d)\n", inode,
-                  (unsigned long long)iblock, bh_result, create);
+       trace_ocfs2_get_block((unsigned long long)OCFS2_I(inode)->ip_blkno,
+                             (unsigned long long)iblock, bh_result, create);
  
        if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SYSTEM_FILE)
                mlog(ML_NOTICE, "get_block on system inode 0x%p (%lu)\n",
        }
  
        past_eof = ocfs2_blocks_for_bytes(inode->i_sb, i_size_read(inode));
-       mlog(0, "Inode %lu, past_eof = %llu\n", inode->i_ino,
-            (unsigned long long)past_eof);
+       trace_ocfs2_get_block_end((unsigned long long)OCFS2_I(inode)->ip_blkno,
+                                 (unsigned long long)past_eof);
        if (create && (iblock >= past_eof))
                set_buffer_new(bh_result);
  
@@@ -208,7 -209,6 +209,6 @@@ bail
        if (err < 0)
                err = -EIO;
  
-       mlog_exit(err);
        return err;
  }
  
@@@ -278,7 -278,8 +278,8 @@@ static int ocfs2_readpage(struct file *
        loff_t start = (loff_t)page->index << PAGE_CACHE_SHIFT;
        int ret, unlock = 1;
  
-       mlog_entry("(0x%p, %lu)\n", file, (page ? page->index : 0));
+       trace_ocfs2_readpage((unsigned long long)oi->ip_blkno,
+                            (page ? page->index : 0));
  
        ret = ocfs2_inode_lock_with_page(inode, NULL, 0, page);
        if (ret != 0) {
@@@ -323,7 -324,6 +324,6 @@@ out_inode_unlock
  out:
        if (unlock)
                unlock_page(page);
-       mlog_exit(ret);
        return ret;
  }
  
@@@ -396,15 -396,11 +396,11 @@@ out_unlock
   */
  static int ocfs2_writepage(struct page *page, struct writeback_control *wbc)
  {
-       int ret;
-       mlog_entry("(0x%p)\n", page);
-       ret = block_write_full_page(page, ocfs2_get_block, wbc);
+       trace_ocfs2_writepage(
+               (unsigned long long)OCFS2_I(page->mapping->host)->ip_blkno,
+               page->index);
  
-       mlog_exit(ret);
-       return ret;
+       return block_write_full_page(page, ocfs2_get_block, wbc);
  }
  
  /* Taken from ext3. We don't necessarily need the full blown
@@@ -450,7 -446,8 +446,8 @@@ static sector_t ocfs2_bmap(struct addre
        int err = 0;
        struct inode *inode = mapping->host;
  
-       mlog_entry("(block = %llu)\n", (unsigned long long)block);
+       trace_ocfs2_bmap((unsigned long long)OCFS2_I(inode)->ip_blkno,
+                        (unsigned long long)block);
  
        /* We don't need to lock journal system files, since they aren't
         * accessed concurrently from multiple nodes.
  bail:
        status = err ? 0 : p_blkno;
  
-       mlog_exit((int)status);
        return status;
  }
  
@@@ -616,9 -611,6 +611,6 @@@ static ssize_t ocfs2_direct_IO(int rw
  {
        struct file *file = iocb->ki_filp;
        struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
-       int ret;
-       mlog_entry_void();
  
        /*
         * Fallback to buffered I/O if we see an inode without
        if (i_size_read(inode) <= offset)
                return 0;
  
-       ret = __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
-                                  iov, offset, nr_segs,
-                                  ocfs2_direct_IO_get_blocks,
-                                  ocfs2_dio_end_io, NULL, 0);
-       mlog_exit(ret);
-       return ret;
+       return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
+                                   iov, offset, nr_segs,
+                                   ocfs2_direct_IO_get_blocks,
+                                   ocfs2_dio_end_io, NULL, 0);
  }
  
  static void ocfs2_figure_cluster_boundaries(struct ocfs2_super *osb,
@@@ -1026,6 -1015,12 +1015,12 @@@ static int ocfs2_prepare_page_for_write
        ocfs2_figure_cluster_boundaries(OCFS2_SB(inode->i_sb), cpos,
                                        &cluster_start, &cluster_end);
  
+       /* treat the write as new if the a hole/lseek spanned across
+        * the page boundary.
+        */
+       new = new | ((i_size_read(inode) <= page_offset(page)) &&
+                       (page_offset(page) <= user_pos));
        if (page == wc->w_target_page) {
                map_from = user_pos & (PAGE_CACHE_SIZE - 1);
                map_to = map_from + user_len;
@@@ -1534,9 -1529,9 +1529,9 @@@ static int ocfs2_try_to_write_inline_da
        struct ocfs2_inode_info *oi = OCFS2_I(inode);
        struct ocfs2_dinode *di = NULL;
  
-       mlog(0, "Inode %llu, write of %u bytes at off %llu. features: 0x%x\n",
-            (unsigned long long)oi->ip_blkno, len, (unsigned long long)pos,
-            oi->ip_dyn_features);
+       trace_ocfs2_try_to_write_inline_data((unsigned long long)oi->ip_blkno,
+                                            len, (unsigned long long)pos,
+                                            oi->ip_dyn_features);
  
        /*
         * Handle inodes which already have inline data 1st.
@@@ -1739,6 -1734,13 +1734,13 @@@ try_again
  
        di = (struct ocfs2_dinode *)wc->w_di_bh->b_data;
  
+       trace_ocfs2_write_begin_nolock(
+                       (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                       (long long)i_size_read(inode),
+                       le32_to_cpu(di->i_clusters),
+                       pos, len, flags, mmap_page,
+                       clusters_to_alloc, extents_to_split);
        /*
         * We set w_target_from, w_target_to here so that
         * ocfs2_write_end() knows which range in the target page to
                 * ocfs2_lock_allocators(). It greatly over-estimates
                 * the work to be done.
                 */
-               mlog(0, "extend inode %llu, i_size = %lld, di->i_clusters = %u,"
-                    " clusters_to_add = %u, extents_to_split = %u\n",
-                    (unsigned long long)OCFS2_I(inode)->ip_blkno,
-                    (long long)i_size_read(inode), le32_to_cpu(di->i_clusters),
-                    clusters_to_alloc, extents_to_split);
                ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode),
                                              wc->w_di_bh);
                ret = ocfs2_lock_allocators(inode, &et,
@@@ -1938,8 -1934,8 +1934,8 @@@ static void ocfs2_write_end_inline(stru
        memcpy(di->id2.i_data.id_data + pos, kaddr + pos, *copied);
        kunmap_atomic(kaddr, KM_USER0);
  
-       mlog(0, "Data written to inode at offset %llu. "
-            "id_count = %u, copied = %u, i_dyn_features = 0x%x\n",
+       trace_ocfs2_write_end_inline(
+            (unsigned long long)OCFS2_I(inode)->ip_blkno,
             (unsigned long long)pos, *copied,
             le16_to_cpu(di->id2.i_data.id_count),
             le16_to_cpu(di->i_dyn_features));
@@@ -2043,6 -2039,7 +2039,6 @@@ const struct address_space_operations o
        .write_begin            = ocfs2_write_begin,
        .write_end              = ocfs2_write_end,
        .bmap                   = ocfs2_bmap,
 -      .sync_page              = block_sync_page,
        .direct_IO              = ocfs2_direct_IO,
        .invalidatepage         = ocfs2_invalidatepage,
        .releasepage            = ocfs2_releasepage,
index 1adab287bd24c814ceb042be381744b3c3fc3e7c,fc9e96a03a6b532458a7e3601124ab4c2a4ef16a..2461eb3272edfab9c6c4949cb435252181938b72
@@@ -367,7 -367,11 +367,7 @@@ static inline void o2hb_bio_wait_dec(st
  static void o2hb_wait_on_io(struct o2hb_region *reg,
                            struct o2hb_bio_wait_ctxt *wc)
  {
 -      struct address_space *mapping = reg->hr_bdev->bd_inode->i_mapping;
 -
 -      blk_run_address_space(mapping);
        o2hb_bio_wait_dec(wc, 1);
 -
        wait_for_completion(&wc->wc_io_complete);
  }
  
@@@ -1654,8 -1658,6 +1654,6 @@@ static int o2hb_populate_slot_data(stru
        struct o2hb_disk_slot *slot;
        struct o2hb_disk_heartbeat_block *hb_block;
  
-       mlog_entry_void();
        ret = o2hb_read_slots(reg, reg->hr_blocks);
        if (ret) {
                mlog_errno(ret);
        }
  
  out:
-       mlog_exit(ret);
        return ret;
  }
  
diff --combined fs/ocfs2/dir.c
index f97b6f1c61dd47392d0052acb64d218b1d9cdd76,b0c17490bbbc283e8bd81a4e5571700dbf7c6694..9fe5b8fd658f0a3db09f1919512a0479a241ecca
@@@ -43,7 -43,6 +43,6 @@@
  #include <linux/quotaops.h>
  #include <linux/sort.h>
  
- #define MLOG_MASK_PREFIX ML_NAMEI
  #include <cluster/masklog.h>
  
  #include "ocfs2.h"
@@@ -61,6 -60,7 +60,7 @@@
  #include "super.h"
  #include "sysfile.h"
  #include "uptodate.h"
+ #include "ocfs2_trace.h"
  
  #include "buffer_head_io.h"
  
@@@ -322,21 -322,23 +322,23 @@@ static int ocfs2_check_dir_entry(struc
        const char *error_msg = NULL;
        const int rlen = le16_to_cpu(de->rec_len);
  
-       if (rlen < OCFS2_DIR_REC_LEN(1))
+       if (unlikely(rlen < OCFS2_DIR_REC_LEN(1)))
                error_msg = "rec_len is smaller than minimal";
-       else if (rlen % 4 != 0)
+       else if (unlikely(rlen % 4 != 0))
                error_msg = "rec_len % 4 != 0";
-       else if (rlen < OCFS2_DIR_REC_LEN(de->name_len))
+       else if (unlikely(rlen < OCFS2_DIR_REC_LEN(de->name_len)))
                error_msg = "rec_len is too small for name_len";
-       else if (((char *) de - bh->b_data) + rlen > dir->i_sb->s_blocksize)
+       else if (unlikely(
+                ((char *) de - bh->b_data) + rlen > dir->i_sb->s_blocksize))
                error_msg = "directory entry across blocks";
  
-       if (error_msg != NULL)
+       if (unlikely(error_msg != NULL))
                mlog(ML_ERROR, "bad entry in directory #%llu: %s - "
                     "offset=%lu, inode=%llu, rec_len=%d, name_len=%d\n",
                     (unsigned long long)OCFS2_I(dir)->ip_blkno, error_msg,
                     offset, (unsigned long long)le64_to_cpu(de->inode), rlen,
                     de->name_len);
        return error_msg == NULL ? 1 : 0;
  }
  
@@@ -354,7 -356,7 +356,7 @@@ static inline int ocfs2_match(int len
  /*
   * Returns 0 if not found, -1 on failure, and 1 on success
   */
 -static int inline ocfs2_search_dirblock(struct buffer_head *bh,
 +static inline int ocfs2_search_dirblock(struct buffer_head *bh,
                                        struct inode *dir,
                                        const char *name, int namelen,
                                        unsigned long offset,
        int de_len;
        int ret = 0;
  
-       mlog_entry_void();
        de_buf = first_de;
        dlimit = de_buf + bytes;
  
        }
  
  bail:
-       mlog_exit(ret);
+       trace_ocfs2_search_dirblock(ret);
        return ret;
  }
  
@@@ -447,8 -447,7 +447,7 @@@ static int ocfs2_validate_dir_block(str
         * 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));
  
@@@ -706,8 -705,6 +705,6 @@@ static struct buffer_head *ocfs2_find_e
        int num = 0;
        int nblocks, i, err;
  
-       mlog_entry_void();
        sb = dir->i_sb;
  
        nblocks = i_size_read(dir) >> sb->s_blocksize_bits;
@@@ -788,7 -785,7 +785,7 @@@ cleanup_and_exit
        for (; ra_ptr < ra_max; ra_ptr++)
                brelse(bh_use[ra_ptr]);
  
-       mlog_exit_ptr(ret);
+       trace_ocfs2_find_entry_el(ret);
        return ret;
  }
  
@@@ -950,11 -947,9 +947,9 @@@ static int ocfs2_dx_dir_search(const ch
                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) {
  
        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;
  
@@@ -1166,8 -1161,6 +1161,6 @@@ static int __ocfs2_delete_entry(handle_
        int i, status = -ENOENT;
        ocfs2_journal_access_func access = ocfs2_journal_access_db;
  
-       mlog_entry("(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;
  
                de = (struct ocfs2_dir_entry *)((char *)de + le16_to_cpu(de->rec_len));
        }
  bail:
-       mlog_exit(status);
        return status;
  }
  
@@@ -1348,8 -1340,8 +1340,8 @@@ static int ocfs2_delete_entry_dx(handle
                }
        }
  
-       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);
@@@ -1632,8 -1624,6 +1624,6 @@@ int __ocfs2_add_entry(handle_t *handle
        struct buffer_head *insert_bh = lookup->dl_leaf_bh;
        char *data_start = insert_bh->b_data;
  
-       mlog_entry_void();
        if (!namelen)
                return -EINVAL;
  
         * from ever getting here. */
        retval = -ENOSPC;
  bail:
+       if (retval)
+               mlog_errno(retval);
  
-       mlog_exit(retval);
        return retval;
  }
  
@@@ -2028,8 -2019,7 +2019,7 @@@ int ocfs2_readdir(struct file * filp, v
        struct inode *inode = filp->f_path.dentry->d_inode;
        int lock_level = 0;
  
-       mlog_entry("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) {
                                      dirent, filldir, NULL);
  
        ocfs2_inode_unlock(inode, lock_level);
+       if (error)
+               mlog_errno(error);
  
  bail_nolock:
-       mlog_exit(error);
  
        return error;
  }
@@@ -2069,8 -2060,8 +2060,8 @@@ int ocfs2_find_files_on_disk(const cha
  {
        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)
@@@ -2114,8 -2105,8 +2105,8 @@@ int ocfs2_check_dir_for_entry(struct in
        int ret;
        struct ocfs2_dir_lookup_result lookup = { NULL, };
  
-       mlog_entry("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)
  bail:
        ocfs2_free_dir_lookup_result(&lookup);
  
-       mlog_exit(ret);
+       if (ret)
+               mlog_errno(ret);
        return ret;
  }
  
@@@ -2324,8 -2316,6 +2316,6 @@@ static int ocfs2_fill_new_dir_el(struc
        struct buffer_head *new_bh = NULL;
        struct ocfs2_dir_entry *de;
  
-       mlog_entry_void();
        if (ocfs2_new_dir_wants_trailer(inode))
                size = ocfs2_dir_trailer_blk_off(parent->i_sb);
  
  bail:
        brelse(new_bh);
  
-       mlog_exit(status);
        return status;
  }
  
@@@ -2409,9 -2398,9 +2398,9 @@@ static int ocfs2_dx_dir_attach_index(st
                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) {
@@@ -2511,11 -2500,10 +2500,10 @@@ static int ocfs2_dx_dir_format_cluster(
                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);
        }
@@@ -2759,12 -2747,11 +2747,11 @@@ static void ocfs2_dx_dir_index_root_blo
  
                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);
@@@ -3235,7 -3222,6 +3222,6 @@@ static int ocfs2_do_extend_dir(struct s
  bail:
        if (did_quota && status < 0)
                dquot_free_space_nodirty(dir, ocfs2_clusters_to_bytes(sb, 1));
-       mlog_exit(status);
        return status;
  }
  
@@@ -3270,8 -3256,6 +3256,6 @@@ static int ocfs2_extend_dir(struct ocfs
        struct ocfs2_extent_tree et;
        struct buffer_head *dx_root_bh = lookup->dl_dx_root_bh;
  
-       mlog_entry_void();
        if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
                /*
                 * This would be a code error as an inline directory should
        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);
@@@ -3436,7 -3420,6 +3420,6 @@@ bail
  
        brelse(new_bh);
  
-       mlog_exit(status);
        return status;
  }
  
@@@ -3583,8 -3566,9 +3566,9 @@@ next
        status = 0;
  bail:
        brelse(bh);
+       if (status)
+               mlog_errno(status);
  
-       mlog_exit(status);
        return status;
  }
  
@@@ -3815,9 -3799,9 +3799,9 @@@ static int ocfs2_dx_dir_rebalance(struc
        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);
  
                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
@@@ -4355,8 -4338,8 +4338,8 @@@ int ocfs2_prepare_dir_for_insert(struc
        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;
diff --combined fs/ocfs2/ioctl.c
index 09de77ce002ab0f68e9e0783521f5eba3f6ae056,f97a213223e8faca4104c2d9f3bc5d2cfff82d29..8f13c5989eaeeecd543be983cec37176c1c54ece
@@@ -9,7 -9,6 +9,6 @@@
  #include <linux/mount.h>
  #include <linux/compat.h>
  
- #define MLOG_MASK_PREFIX ML_INODE
  #include <cluster/masklog.h>
  
  #include "ocfs2.h"
@@@ -46,6 -45,22 +45,22 @@@ static inline void __o2info_set_request
  #define o2info_set_request_error(a, b) \
                __o2info_set_request_error((struct ocfs2_info_request *)&(a), b)
  
+ static inline void __o2info_set_request_filled(struct ocfs2_info_request *req)
+ {
+       req->ir_flags |= OCFS2_INFO_FL_FILLED;
+ }
+ #define o2info_set_request_filled(a) \
+               __o2info_set_request_filled((struct ocfs2_info_request *)&(a))
+ static inline void __o2info_clear_request_filled(struct ocfs2_info_request *req)
+ {
+       req->ir_flags &= ~OCFS2_INFO_FL_FILLED;
+ }
+ #define o2info_clear_request_filled(a) \
+               __o2info_clear_request_filled((struct ocfs2_info_request *)&(a))
  static int ocfs2_get_inode_attr(struct inode *inode, unsigned *flags)
  {
        int status;
@@@ -59,7 -74,6 +74,6 @@@
        *flags = OCFS2_I(inode)->ip_attr;
        ocfs2_inode_unlock(inode, 0);
  
-       mlog_exit(status);
        return status;
  }
  
@@@ -82,7 -96,7 +96,7 @@@ static int ocfs2_set_inode_attr(struct 
        }
  
        status = -EACCES;
 -      if (!is_owner_or_cap(inode))
 +      if (!inode_owner_or_capable(inode))
                goto bail_unlock;
  
        if (!S_ISDIR(inode->i_mode))
@@@ -125,7 -139,6 +139,6 @@@ bail
  
        brelse(bh);
  
-       mlog_exit(status);
        return status;
  }
  
@@@ -139,7 -152,8 +152,8 @@@ int ocfs2_info_handle_blocksize(struct 
                goto bail;
  
        oib.ib_blocksize = inode->i_sb->s_blocksize;
-       oib.ib_req.ir_flags |= OCFS2_INFO_FL_FILLED;
+       o2info_set_request_filled(oib);
  
        if (o2info_to_user(oib, req))
                goto bail;
@@@ -163,7 -177,8 +177,8 @@@ int ocfs2_info_handle_clustersize(struc
                goto bail;
  
        oic.ic_clustersize = osb->s_clustersize;
-       oic.ic_req.ir_flags |= OCFS2_INFO_FL_FILLED;
+       o2info_set_request_filled(oic);
  
        if (o2info_to_user(oic, req))
                goto bail;
@@@ -187,7 -202,8 +202,8 @@@ int ocfs2_info_handle_maxslots(struct i
                goto bail;
  
        oim.im_max_slots = osb->max_slots;
-       oim.im_req.ir_flags |= OCFS2_INFO_FL_FILLED;
+       o2info_set_request_filled(oim);
  
        if (o2info_to_user(oim, req))
                goto bail;
@@@ -211,7 -227,8 +227,8 @@@ int ocfs2_info_handle_label(struct inod
                goto bail;
  
        memcpy(oil.il_label, osb->vol_label, OCFS2_MAX_VOL_LABEL_LEN);
-       oil.il_req.ir_flags |= OCFS2_INFO_FL_FILLED;
+       o2info_set_request_filled(oil);
  
        if (o2info_to_user(oil, req))
                goto bail;
@@@ -235,7 -252,8 +252,8 @@@ int ocfs2_info_handle_uuid(struct inod
                goto bail;
  
        memcpy(oiu.iu_uuid_str, osb->uuid_str, OCFS2_TEXT_UUID_LEN + 1);
-       oiu.iu_req.ir_flags |= OCFS2_INFO_FL_FILLED;
+       o2info_set_request_filled(oiu);
  
        if (o2info_to_user(oiu, req))
                goto bail;
@@@ -261,7 -279,8 +279,8 @@@ int ocfs2_info_handle_fs_features(struc
        oif.if_compat_features = osb->s_feature_compat;
        oif.if_incompat_features = osb->s_feature_incompat;
        oif.if_ro_compat_features = osb->s_feature_ro_compat;
-       oif.if_req.ir_flags |= OCFS2_INFO_FL_FILLED;
+       o2info_set_request_filled(oif);
  
        if (o2info_to_user(oif, req))
                goto bail;
@@@ -286,7 -305,7 +305,7 @@@ int ocfs2_info_handle_journal_size(stru
  
        oij.ij_journal_size = osb->journal->j_inode->i_size;
  
-       oij.ij_req.ir_flags |= OCFS2_INFO_FL_FILLED;
+       o2info_set_request_filled(oij);
  
        if (o2info_to_user(oij, req))
                goto bail;
@@@ -308,7 -327,7 +327,7 @@@ int ocfs2_info_handle_unknown(struct in
        if (o2info_from_user(oir, req))
                goto bail;
  
-       oir.ir_flags &= ~OCFS2_INFO_FL_FILLED;
+       o2info_clear_request_filled(oir);
  
        if (o2info_to_user(oir, req))
                goto bail;
diff --combined fs/ocfs2/namei.c
index d6c25d76b537df58a92796b4258ccb2d83c523e2,b6fa9eb2d298566b2513de5bb70a4aa773201603..28f2cc1080d8b16da36e4dee718d44f3690943c0
@@@ -42,7 -42,6 +42,6 @@@
  #include <linux/highmem.h>
  #include <linux/quotaops.h>
  
- #define MLOG_MASK_PREFIX ML_NAMEI
  #include <cluster/masklog.h>
  
  #include "ocfs2.h"
@@@ -63,6 -62,7 +62,7 @@@
  #include "uptodate.h"
  #include "xattr.h"
  #include "acl.h"
+ #include "ocfs2_trace.h"
  
  #include "buffer_head_io.h"
  
@@@ -106,17 -106,15 +106,15 @@@ static struct dentry *ocfs2_lookup(stru
        struct dentry *ret;
        struct ocfs2_inode_info *oi;
  
-       mlog_entry("(0x%p, 0x%p, '%.*s')\n", dir, dentry,
-                  dentry->d_name.len, dentry->d_name.name);
+       trace_ocfs2_lookup(dir, dentry, dentry->d_name.len,
+                          dentry->d_name.name,
+                          (unsigned long long)OCFS2_I(dir)->ip_blkno, 0);
  
        if (dentry->d_name.len > OCFS2_MAX_FILENAME_LEN) {
                ret = ERR_PTR(-ENAMETOOLONG);
                goto bail;
        }
  
-       mlog(0, "find name %.*s in directory %llu\n", dentry->d_name.len,
-            dentry->d_name.name, (unsigned long long)OCFS2_I(dir)->ip_blkno);
        status = ocfs2_inode_lock_nested(dir, NULL, 0, OI_LS_PARENT);
        if (status < 0) {
                if (status != -ENOENT)
@@@ -182,7 -180,7 +180,7 @@@ bail_unlock
  
  bail:
  
-       mlog_exit_ptr(ret);
+       trace_ocfs2_lookup_ret(ret);
  
        return ret;
  }
@@@ -235,9 -233,9 +233,9 @@@ static int ocfs2_mknod(struct inode *di
        sigset_t oldset;
        int did_block_signals = 0;
  
-       mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry, mode,
-                  (unsigned long)dev, dentry->d_name.len,
-                  dentry->d_name.name);
+       trace_ocfs2_mknod(dir, dentry, dentry->d_name.len, dentry->d_name.name,
+                         (unsigned long long)OCFS2_I(dir)->ip_blkno,
+                         (unsigned long)dev, mode);
  
        dquot_initialize(dir);
  
        }
  
        /* get security xattr */
 -      status = ocfs2_init_security_get(inode, dir, &si);
 +      status = ocfs2_init_security_get(inode, dir, &dentry->d_name, &si);
        if (status) {
                if (status == -EOPNOTSUPP)
                        si.enable = 0;
                goto leave;
        did_quota_inode = 1;
  
-       mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry,
-                  inode->i_mode, (unsigned long)dev, dentry->d_name.len,
-                  dentry->d_name.name);
        /* do the real work now. */
        status = ocfs2_mknod_locked(osb, dir, inode, dev,
                                    &new_fe_bh, parent_fe_bh, handle,
@@@ -436,9 -430,6 +430,6 @@@ leave
        if (did_block_signals)
                ocfs2_unblock_signals(&oldset);
  
-       if (status == -ENOSPC)
-               mlog(0, "Disk is full\n");
        brelse(new_fe_bh);
        brelse(parent_fe_bh);
        kfree(si.name);
                iput(inode);
        }
  
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
  
        return status;
  }
@@@ -577,7 -569,8 +569,8 @@@ leave
                }
        }
  
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
  }
  
@@@ -615,10 -608,11 +608,11 @@@ static int ocfs2_mkdir(struct inode *di
  {
        int ret;
  
-       mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", dir, dentry, mode,
-                  dentry->d_name.len, dentry->d_name.name);
+       trace_ocfs2_mkdir(dir, dentry, dentry->d_name.len, dentry->d_name.name,
+                         OCFS2_I(dir)->ip_blkno, mode);
        ret = ocfs2_mknod(dir, dentry, mode | S_IFDIR, 0);
-       mlog_exit(ret);
+       if (ret)
+               mlog_errno(ret);
  
        return ret;
  }
@@@ -630,10 -624,11 +624,11 @@@ static int ocfs2_create(struct inode *d
  {
        int ret;
  
-       mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", dir, dentry, mode,
-                  dentry->d_name.len, dentry->d_name.name);
+       trace_ocfs2_create(dir, dentry, dentry->d_name.len, dentry->d_name.name,
+                          (unsigned long long)OCFS2_I(dir)->ip_blkno, mode);
        ret = ocfs2_mknod(dir, dentry, mode | S_IFREG, 0);
-       mlog_exit(ret);
+       if (ret)
+               mlog_errno(ret);
  
        return ret;
  }
@@@ -652,9 -647,9 +647,9 @@@ static int ocfs2_link(struct dentry *ol
        struct ocfs2_dir_lookup_result lookup = { NULL, };
        sigset_t oldset;
  
-       mlog_entry("(inode=%lu, old='%.*s' new='%.*s')\n", inode->i_ino,
-                  old_dentry->d_name.len, old_dentry->d_name.name,
-                  dentry->d_name.len, dentry->d_name.name);
+       trace_ocfs2_link((unsigned long long)OCFS2_I(inode)->ip_blkno,
+                        old_dentry->d_name.len, old_dentry->d_name.name,
+                        dentry->d_name.len, dentry->d_name.name);
  
        if (S_ISDIR(inode->i_mode))
                return -EPERM;
@@@ -757,7 -752,8 +752,8 @@@ out
  
        ocfs2_free_dir_lookup_result(&lookup);
  
-       mlog_exit(err);
+       if (err)
+               mlog_errno(err);
  
        return err;
  }
@@@ -809,19 -805,17 +805,17 @@@ static int ocfs2_unlink(struct inode *d
        struct ocfs2_dir_lookup_result lookup = { NULL, };
        struct ocfs2_dir_lookup_result orphan_insert = { NULL, };
  
-       mlog_entry("(0x%p, 0x%p, '%.*s')\n", dir, dentry,
-                  dentry->d_name.len, dentry->d_name.name);
+       trace_ocfs2_unlink(dir, dentry, dentry->d_name.len,
+                          dentry->d_name.name,
+                          (unsigned long long)OCFS2_I(dir)->ip_blkno,
+                          (unsigned long long)OCFS2_I(inode)->ip_blkno);
  
        dquot_initialize(dir);
  
        BUG_ON(dentry->d_parent->d_inode != dir);
  
-       mlog(0, "ino = %llu\n", (unsigned long long)OCFS2_I(inode)->ip_blkno);
-       if (inode == osb->root_inode) {
-               mlog(0, "Cannot delete the root directory\n");
+       if (inode == osb->root_inode)
                return -EPERM;
-       }
  
        status = ocfs2_inode_lock_nested(dir, &parent_node_bh, 1,
                                         OI_LS_PARENT);
        if (OCFS2_I(inode)->ip_blkno != blkno) {
                status = -ENOENT;
  
-               mlog(0, "ip_blkno %llu != dirent blkno %llu ip_flags = %x\n",
-                    (unsigned long long)OCFS2_I(inode)->ip_blkno,
-                    (unsigned long long)blkno, OCFS2_I(inode)->ip_flags);
+               trace_ocfs2_unlink_noent(
+                               (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                               (unsigned long long)blkno,
+                               OCFS2_I(inode)->ip_flags);
                goto leave;
        }
  
@@@ -954,7 -949,8 +949,8 @@@ leave
        ocfs2_free_dir_lookup_result(&orphan_insert);
        ocfs2_free_dir_lookup_result(&lookup);
  
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
  
        return status;
  }
@@@ -975,9 -971,8 +971,8 @@@ static int ocfs2_double_lock(struct ocf
        struct buffer_head **tmpbh;
        struct inode *tmpinode;
  
-       mlog_entry("(inode1 = %llu, inode2 = %llu)\n",
-                  (unsigned long long)oi1->ip_blkno,
-                  (unsigned long long)oi2->ip_blkno);
+       trace_ocfs2_double_lock((unsigned long long)oi1->ip_blkno,
+                               (unsigned long long)oi2->ip_blkno);
  
        if (*bh1)
                *bh1 = NULL;
        if (oi1->ip_blkno != oi2->ip_blkno) {
                if (oi1->ip_blkno < oi2->ip_blkno) {
                        /* switch id1 and id2 around */
-                       mlog(0, "switching them around...\n");
                        tmpbh = bh2;
                        bh2 = bh1;
                        bh1 = tmpbh;
                        mlog_errno(status);
        }
  
+       trace_ocfs2_double_lock_end(
+                       (unsigned long long)OCFS2_I(inode1)->ip_blkno,
+                       (unsigned long long)OCFS2_I(inode2)->ip_blkno);
  bail:
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
  }
  
@@@ -1067,10 -1066,9 +1066,9 @@@ static int ocfs2_rename(struct inode *o
        /* At some point it might be nice to break this function up a
         * bit. */
  
-       mlog_entry("(0x%p, 0x%p, 0x%p, 0x%p, from='%.*s' to='%.*s')\n",
-                  old_dir, old_dentry, new_dir, new_dentry,
-                  old_dentry->d_name.len, old_dentry->d_name.name,
-                  new_dentry->d_name.len, new_dentry->d_name.name);
+       trace_ocfs2_rename(old_dir, old_dentry, new_dir, new_dentry,
+                          old_dentry->d_name.len, old_dentry->d_name.name,
+                          new_dentry->d_name.len, new_dentry->d_name.name);
  
        dquot_initialize(old_dir);
        dquot_initialize(new_dir);
                if (!new_inode) {
                        status = -EACCES;
  
-                       mlog(0, "We found an inode for name %.*s but VFS "
-                            "didn't give us one.\n", new_dentry->d_name.len,
-                            new_dentry->d_name.name);
+                       trace_ocfs2_rename_target_exists(new_dentry->d_name.len,
+                                               new_dentry->d_name.name);
                        goto bail;
                }
  
                if (OCFS2_I(new_inode)->ip_blkno != newfe_blkno) {
                        status = -EACCES;
  
-                       mlog(0, "Inode %llu and dir %llu disagree. flags = %x\n",
+                       trace_ocfs2_rename_disagree(
                             (unsigned long long)OCFS2_I(new_inode)->ip_blkno,
                             (unsigned long long)newfe_blkno,
                             OCFS2_I(new_inode)->ip_flags);
  
                newfe = (struct ocfs2_dinode *) newfe_bh->b_data;
  
-               mlog(0, "aha rename over existing... new_blkno=%llu "
-                    "newfebh=%p bhblocknr=%llu\n",
+               trace_ocfs2_rename_over_existing(
                     (unsigned long long)newfe_blkno, newfe_bh, newfe_bh ?
                     (unsigned long long)newfe_bh->b_blocknr : 0ULL);
  
@@@ -1476,7 -1472,8 +1472,8 @@@ bail
        brelse(old_dir_bh);
        brelse(new_dir_bh);
  
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
  
        return status;
  }
@@@ -1501,9 -1498,8 +1498,8 @@@ static int ocfs2_create_symlink_data(st
         * write i_size + 1 bytes. */
        blocks = (bytes_left + sb->s_blocksize - 1) >> sb->s_blocksize_bits;
  
-       mlog_entry("i_blocks = %llu, i_size = %llu, blocks = %d\n",
-                       (unsigned long long)inode->i_blocks,
-                       i_size_read(inode), blocks);
+       trace_ocfs2_create_symlink_data((unsigned long long)inode->i_blocks,
+                                       i_size_read(inode), blocks);
  
        /* Sanity check -- make sure we're going to fit. */
        if (bytes_left >
@@@ -1579,7 -1575,8 +1575,8 @@@ bail
                kfree(bhs);
        }
  
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
  }
  
@@@ -1610,8 -1607,8 +1607,8 @@@ static int ocfs2_symlink(struct inode *
        sigset_t oldset;
        int did_block_signals = 0;
  
-       mlog_entry("(0x%p, 0x%p, symname='%s' actual='%.*s')\n", dir,
-                  dentry, symname, dentry->d_name.len, dentry->d_name.name);
+       trace_ocfs2_symlink_begin(dir, dentry, symname,
+                                 dentry->d_name.len, dentry->d_name.name);
  
        dquot_initialize(dir);
  
        }
  
        /* get security xattr */
 -      status = ocfs2_init_security_get(inode, dir, &si);
 +      status = ocfs2_init_security_get(inode, dir, &dentry->d_name, &si);
        if (status) {
                if (status == -EOPNOTSUPP)
                        si.enable = 0;
                goto bail;
        did_quota_inode = 1;
  
-       mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", dir, dentry,
-                  inode->i_mode, dentry->d_name.len,
-                  dentry->d_name.name);
+       trace_ocfs2_symlink_create(dir, dentry, dentry->d_name.len,
+                                  dentry->d_name.name,
+                                  (unsigned long long)OCFS2_I(dir)->ip_blkno,
+                                  inode->i_mode);
  
        status = ocfs2_mknod_locked(osb, dir, inode,
                                    0, &new_fe_bh, parent_fe_bh, handle,
@@@ -1835,7 -1833,8 +1833,8 @@@ bail
                iput(inode);
        }
  
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
  
        return status;
  }
@@@ -1844,8 -1843,6 +1843,6 @@@ static int ocfs2_blkno_stringify(u64 bl
  {
        int status, namelen;
  
-       mlog_entry_void();
        namelen = snprintf(name, OCFS2_ORPHAN_NAMELEN + 1, "%016llx",
                           (long long)blkno);
        if (namelen <= 0) {
                goto bail;
        }
  
-       mlog(0, "built filename '%s' for orphan dir (len=%d)\n", name,
-            namelen);
+       trace_ocfs2_blkno_stringify(blkno, name, namelen);
  
        status = 0;
  bail:
-       mlog_exit(status);
+       if (status < 0)
+               mlog_errno(status);
        return status;
  }
  
@@@ -1980,7 -1977,8 +1977,8 @@@ out
                iput(orphan_dir_inode);
        }
  
-       mlog_exit(ret);
+       if (ret)
+               mlog_errno(ret);
        return ret;
  }
  
@@@ -1997,7 -1995,8 +1995,8 @@@ static int ocfs2_orphan_add(struct ocfs
        struct ocfs2_dinode *orphan_fe;
        struct ocfs2_dinode *fe = (struct ocfs2_dinode *) fe_bh->b_data;
  
-       mlog_entry("(inode->i_ino = %lu)\n", inode->i_ino);
+       trace_ocfs2_orphan_add_begin(
+                               (unsigned long long)OCFS2_I(inode)->ip_blkno);
  
        status = ocfs2_read_inode_block(orphan_dir_inode, &orphan_dir_bh);
        if (status < 0) {
  
        ocfs2_journal_dirty(handle, fe_bh);
  
-       mlog(0, "Inode %llu orphaned in slot %d\n",
-            (unsigned long long)OCFS2_I(inode)->ip_blkno, osb->slot_num);
+       trace_ocfs2_orphan_add_end((unsigned long long)OCFS2_I(inode)->ip_blkno,
+                                  osb->slot_num);
  
  leave:
        brelse(orphan_dir_bh);
  
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
  }
  
@@@ -2078,17 -2078,15 +2078,15 @@@ int ocfs2_orphan_del(struct ocfs2_supe
        int status = 0;
        struct ocfs2_dir_lookup_result lookup = { NULL, };
  
-       mlog_entry_void();
        status = ocfs2_blkno_stringify(OCFS2_I(inode)->ip_blkno, name);
        if (status < 0) {
                mlog_errno(status);
                goto leave;
        }
  
-       mlog(0, "removing '%s' from orphan dir %llu (namelen=%d)\n",
-            name, (unsigned long long)OCFS2_I(orphan_dir_inode)->ip_blkno,
-            OCFS2_ORPHAN_NAMELEN);
+       trace_ocfs2_orphan_del(
+            (unsigned long long)OCFS2_I(orphan_dir_inode)->ip_blkno,
+            name, OCFS2_ORPHAN_NAMELEN);
  
        /* find it's spot in the orphan directory */
        status = ocfs2_find_entry(name, OCFS2_ORPHAN_NAMELEN, orphan_dir_inode,
  leave:
        ocfs2_free_dir_lookup_result(&lookup);
  
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
  }
  
@@@ -2321,9 -2320,6 +2320,6 @@@ leave
                iput(orphan_dir);
        }
  
-       if (status == -ENOSPC)
-               mlog(0, "Disk is full\n");
        if ((status < 0) && inode) {
                clear_nlink(inode);
                iput(inode);
@@@ -2358,8 -2354,10 +2354,10 @@@ int ocfs2_mv_orphaned_inode_to_new(stru
        struct buffer_head *di_bh = NULL;
        struct ocfs2_dir_lookup_result lookup = { NULL, };
  
-       mlog_entry("(0x%p, 0x%p, %.*s')\n", dir, dentry,
-                  dentry->d_name.len, dentry->d_name.name);
+       trace_ocfs2_mv_orphaned_inode_to_new(dir, dentry,
+                               dentry->d_name.len, dentry->d_name.name,
+                               (unsigned long long)OCFS2_I(dir)->ip_blkno,
+                               (unsigned long long)OCFS2_I(inode)->ip_blkno);
  
        status = ocfs2_inode_lock(dir, &parent_di_bh, 1);
        if (status < 0) {
@@@ -2476,7 -2474,8 +2474,8 @@@ leave
  
        ocfs2_free_dir_lookup_result(&lookup);
  
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
  
        return status;
  }
diff --combined fs/ocfs2/ocfs2.h
index 1a97ba1ec3fc286550d6e325d144996d64a3d1ca,4e3d3c1363f3f81a9e326aaa07384e2d32ffa21e..409285854f647e2357223bc7a8d24c36b376a6bb
@@@ -147,6 -147,17 +147,17 @@@ struct ocfs2_lock_res_ops
  
  typedef void (*ocfs2_lock_callback)(int status, unsigned long data);
  
+ #ifdef CONFIG_OCFS2_FS_STATS
+ struct ocfs2_lock_stats {
+       u64             ls_total;       /* Total wait in NSEC */
+       u32             ls_gets;        /* Num acquires */
+       u32             ls_fail;        /* Num failed acquires */
+       /* Storing max wait in usecs saves 24 bytes per inode */
+       u32             ls_max;         /* Max wait in USEC */
+ };
+ #endif
  struct ocfs2_lock_res {
        void                    *l_priv;
        struct ocfs2_lock_res_ops *l_ops;
        struct list_head         l_debug_list;
  
  #ifdef CONFIG_OCFS2_FS_STATS
-       unsigned long long       l_lock_num_prmode;        /* PR acquires */
-       unsigned long long       l_lock_num_exmode;        /* EX acquires */
-       unsigned int             l_lock_num_prmode_failed; /* Failed PR gets */
-       unsigned int             l_lock_num_exmode_failed; /* Failed EX gets */
-       unsigned long long       l_lock_total_prmode;      /* Tot wait for PR */
-       unsigned long long       l_lock_total_exmode;      /* Tot wait for EX */
-       unsigned int             l_lock_max_prmode;        /* Max wait for PR */
-       unsigned int             l_lock_max_exmode;        /* Max wait for EX */
-       unsigned int             l_lock_refresh;           /* Disk refreshes */
+       struct ocfs2_lock_stats  l_lock_prmode;         /* PR mode stats */
+       u32                      l_lock_refresh;        /* Disk refreshes */
+       struct ocfs2_lock_stats  l_lock_exmode;         /* EX mode stats */
  #endif
  #ifdef CONFIG_DEBUG_LOCK_ALLOC
        struct lockdep_map       l_lockdep_map;
@@@ -831,18 -836,18 +836,18 @@@ static inline unsigned int ocfs2_cluste
  
  static inline void _ocfs2_set_bit(unsigned int bit, unsigned long *bitmap)
  {
 -      ext2_set_bit(bit, bitmap);
 +      __test_and_set_bit_le(bit, bitmap);
  }
  #define ocfs2_set_bit(bit, addr) _ocfs2_set_bit((bit), (unsigned long *)(addr))
  
  static inline void _ocfs2_clear_bit(unsigned int bit, unsigned long *bitmap)
  {
 -      ext2_clear_bit(bit, bitmap);
 +      __test_and_clear_bit_le(bit, bitmap);
  }
  #define ocfs2_clear_bit(bit, addr) _ocfs2_clear_bit((bit), (unsigned long *)(addr))
  
 -#define ocfs2_test_bit ext2_test_bit
 -#define ocfs2_find_next_zero_bit ext2_find_next_zero_bit
 -#define ocfs2_find_next_bit ext2_find_next_bit
 +#define ocfs2_test_bit test_bit_le
 +#define ocfs2_find_next_zero_bit find_next_zero_bit_le
 +#define ocfs2_find_next_bit find_next_bit_le
  #endif  /* OCFS2_H */
  
diff --combined fs/ocfs2/quota_global.c
index a73f641664818e2a6c93d30d192b3a70303fecee,64346f836c09158fc9891d99077594cbc5718bc7..279aef68025b3155f7e9efccd5b63409927deae3
@@@ -11,7 -11,6 +11,6 @@@
  #include <linux/writeback.h>
  #include <linux/workqueue.h>
  
- #define MLOG_MASK_PREFIX ML_QUOTA
  #include <cluster/masklog.h>
  
  #include "ocfs2_fs.h"
@@@ -27,6 -26,7 +26,7 @@@
  #include "super.h"
  #include "buffer_head_io.h"
  #include "quota.h"
+ #include "ocfs2_trace.h"
  
  /*
   * Locking of quotas with OCFS2 is rather complex. Here are rules that
@@@ -63,6 -63,8 +63,6 @@@
   *        write to gf
   */
  
 -static struct workqueue_struct *ocfs2_quota_wq = NULL;
 -
  static void qsync_work_fn(struct work_struct *work);
  
  static void ocfs2_global_disk2memdqb(struct dquot *dquot, void *dp)
@@@ -130,8 -132,7 +130,7 @@@ int ocfs2_validate_quota_block(struct s
        struct ocfs2_disk_dqtrailer *dqt =
                ocfs2_block_dqtrailer(sb->s_blocksize, bh->b_data);
  
-       mlog(0, "Validating quota block %llu\n",
-            (unsigned long long)bh->b_blocknr);
+       trace_ocfs2_validate_quota_block((unsigned long long)bh->b_blocknr);
  
        BUG_ON(!buffer_uptodate(bh));
  
@@@ -341,8 -342,6 +340,6 @@@ int ocfs2_global_read_info(struct super
        u64 pcount;
        int status;
  
-       mlog_entry_void();
        /* Read global header */
        gqinode = ocfs2_get_system_file_inode(OCFS2_SB(sb), ino[type],
                        OCFS2_INVALID_SLOT);
                                                OCFS2_QBLK_RESERVED_SPACE;
        oinfo->dqi_gi.dqi_qtree_depth = qtree_depth(&oinfo->dqi_gi);
        INIT_DELAYED_WORK(&oinfo->dqi_sync_work, qsync_work_fn);
 -      queue_delayed_work(ocfs2_quota_wq, &oinfo->dqi_sync_work,
 -                         msecs_to_jiffies(oinfo->dqi_syncms));
 +      schedule_delayed_work(&oinfo->dqi_sync_work,
 +                            msecs_to_jiffies(oinfo->dqi_syncms));
  
  out_err:
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
  out_unlock:
        ocfs2_unlock_global_qf(oinfo, 0);
@@@ -508,9 -508,10 +506,10 @@@ int __ocfs2_sync_dquot(struct dquot *dq
        olditime = dquot->dq_dqb.dqb_itime;
        oldbtime = dquot->dq_dqb.dqb_btime;
        ocfs2_global_disk2memdqb(dquot, &dqblk);
-       mlog(0, "Syncing global dquot %u space %lld+%lld, inodes %lld+%lld\n",
-            dquot->dq_id, dquot->dq_dqb.dqb_curspace, (long long)spacechange,
-            dquot->dq_dqb.dqb_curinodes, (long long)inodechange);
+       trace_ocfs2_sync_dquot(dquot->dq_id, dquot->dq_dqb.dqb_curspace,
+                              (long long)spacechange,
+                              dquot->dq_dqb.dqb_curinodes,
+                              (long long)inodechange);
        if (!test_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags))
                dquot->dq_dqb.dqb_curspace += spacechange;
        if (!test_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags))
@@@ -594,8 -595,8 +593,8 @@@ static int ocfs2_sync_dquot_helper(stru
        struct ocfs2_super *osb = OCFS2_SB(sb);
        int status = 0;
  
-       mlog_entry("id=%u qtype=%u type=%lu device=%s\n", dquot->dq_id,
-                  dquot->dq_type, type, sb->s_id);
+       trace_ocfs2_sync_dquot_helper(dquot->dq_id, dquot->dq_type,
+                                     type, sb->s_id);
        if (type != dquot->dq_type)
                goto out;
        status = ocfs2_lock_global_qf(oinfo, 1);
  out_ilock:
        ocfs2_unlock_global_qf(oinfo, 1);
  out:
-       mlog_exit(status);
        return status;
  }
  
@@@ -633,8 -633,8 +631,8 @@@ static void qsync_work_fn(struct work_s
        struct super_block *sb = oinfo->dqi_gqinode->i_sb;
  
        dquot_scan_active(sb, ocfs2_sync_dquot_helper, oinfo->dqi_type);
 -      queue_delayed_work(ocfs2_quota_wq, &oinfo->dqi_sync_work,
 -                         msecs_to_jiffies(oinfo->dqi_syncms));
 +      schedule_delayed_work(&oinfo->dqi_sync_work,
 +                            msecs_to_jiffies(oinfo->dqi_syncms));
  }
  
  /*
@@@ -647,7 -647,7 +645,7 @@@ static int ocfs2_write_dquot(struct dqu
        struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb);
        int status = 0;
  
-       mlog_entry("id=%u, type=%d", dquot->dq_id, dquot->dq_type);
+       trace_ocfs2_write_dquot(dquot->dq_id, dquot->dq_type);
  
        handle = ocfs2_start_trans(osb, OCFS2_QWRITE_CREDITS);
        if (IS_ERR(handle)) {
        mutex_unlock(&sb_dqopt(dquot->dq_sb)->dqio_mutex);
        ocfs2_commit_trans(osb, handle);
  out:
-       mlog_exit(status);
        return status;
  }
  
@@@ -686,7 -685,7 +683,7 @@@ static int ocfs2_release_dquot(struct d
        struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb);
        int status = 0;
  
-       mlog_entry("id=%u, type=%d", dquot->dq_id, dquot->dq_type);
+       trace_ocfs2_release_dquot(dquot->dq_id, dquot->dq_type);
  
        mutex_lock(&dquot->dq_lock);
        /* Check whether we are not racing with some other dqget() */
@@@ -722,7 -721,8 +719,8 @@@ out_ilock
        ocfs2_unlock_global_qf(oinfo, 1);
  out:
        mutex_unlock(&dquot->dq_lock);
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
  }
  
@@@ -743,7 -743,7 +741,7 @@@ static int ocfs2_acquire_dquot(struct d
        int need_alloc = ocfs2_global_qinit_alloc(sb, type);
        handle_t *handle;
  
-       mlog_entry("id=%u, type=%d", dquot->dq_id, type);
+       trace_ocfs2_acquire_dquot(dquot->dq_id, type);
        mutex_lock(&dquot->dq_lock);
        /*
         * We need an exclusive lock, because we're going to update use count
@@@ -809,7 -809,8 +807,8 @@@ out_dq
        set_bit(DQ_ACTIVE_B, &dquot->dq_flags);
  out:
        mutex_unlock(&dquot->dq_lock);
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
  }
  
@@@ -829,7 -830,7 +828,7 @@@ static int ocfs2_mark_dquot_dirty(struc
        handle_t *handle;
        struct ocfs2_super *osb = OCFS2_SB(sb);
  
-       mlog_entry("id=%u, type=%d", dquot->dq_id, type);
+       trace_ocfs2_mark_dquot_dirty(dquot->dq_id, type);
  
        /* In case user set some limits, sync dquot immediately to global
         * quota file so that information propagates quicker */
@@@ -866,7 -867,8 +865,8 @@@ out_dlock
  out_ilock:
        ocfs2_unlock_global_qf(oinfo, 1);
  out:
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
  }
  
@@@ -877,8 -879,6 +877,6 @@@ static int ocfs2_write_info(struct supe
        int status = 0;
        struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv;
  
-       mlog_entry_void();
        status = ocfs2_lock_global_qf(oinfo, 1);
        if (status < 0)
                goto out;
  out_ilock:
        ocfs2_unlock_global_qf(oinfo, 1);
  out:
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
  }
  
@@@ -921,3 -922,20 +920,3 @@@ const struct dquot_operations ocfs2_quo
        .alloc_dquot    = ocfs2_alloc_dquot,
        .destroy_dquot  = ocfs2_destroy_dquot,
  };
 -
 -int ocfs2_quota_setup(void)
 -{
 -      ocfs2_quota_wq = create_workqueue("o2quot");
 -      if (!ocfs2_quota_wq)
 -              return -ENOMEM;
 -      return 0;
 -}
 -
 -void ocfs2_quota_shutdown(void)
 -{
 -      if (ocfs2_quota_wq) {
 -              flush_workqueue(ocfs2_quota_wq);
 -              destroy_workqueue(ocfs2_quota_wq);
 -              ocfs2_quota_wq = NULL;
 -      }
 -}
diff --combined fs/ocfs2/refcounttree.c
index c384d634872a24cc673b1cd0f4e9b837cc433982,93a81f853e66e4004001552a52a9e8414de660e9..5d32749c896dc069d1353f09b75f1aadf42ac886
@@@ -16,7 -16,6 +16,6 @@@
   */
  
  #include <linux/sort.h>
- #define MLOG_MASK_PREFIX ML_REFCOUNT
  #include <cluster/masklog.h>
  #include "ocfs2.h"
  #include "inode.h"
@@@ -34,6 -33,7 +33,7 @@@
  #include "aops.h"
  #include "xattr.h"
  #include "namei.h"
+ #include "ocfs2_trace.h"
  
  #include <linux/bio.h>
  #include <linux/blkdev.h>
@@@ -84,8 -84,7 +84,7 @@@ static int ocfs2_validate_refcount_bloc
        struct ocfs2_refcount_block *rb =
                (struct ocfs2_refcount_block *)bh->b_data;
  
-       mlog(0, "Validating refcount block %llu\n",
-            (unsigned long long)bh->b_blocknr);
+       trace_ocfs2_validate_refcount_block((unsigned long long)bh->b_blocknr);
  
        BUG_ON(!buffer_uptodate(bh));
  
@@@ -545,8 -544,8 +544,8 @@@ void ocfs2_purge_refcount_trees(struct 
        while ((node = rb_last(root)) != NULL) {
                tree = rb_entry(node, struct ocfs2_refcount_tree, rf_node);
  
-               mlog(0, "Purge tree %llu\n",
-                    (unsigned long long) tree->rf_blkno);
+               trace_ocfs2_purge_refcount_trees(
+                               (unsigned long long) tree->rf_blkno);
  
                rb_erase(&tree->rf_node, root);
                ocfs2_free_refcount_tree(tree);
@@@ -575,7 -574,8 +574,8 @@@ static int ocfs2_create_refcount_tree(s
  
        BUG_ON(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL);
  
-       mlog(0, "create tree for inode %lu\n", inode->i_ino);
+       trace_ocfs2_create_refcount_tree(
+               (unsigned long long)OCFS2_I(inode)->ip_blkno);
  
        ret = ocfs2_reserve_new_metadata_blocks(osb, 1, &meta_ac);
        if (ret) {
        di->i_refcount_loc = cpu_to_le64(first_blkno);
        spin_unlock(&oi->ip_lock);
  
-       mlog(0, "created tree for inode %lu, refblock %llu\n",
-            inode->i_ino, (unsigned long long)first_blkno);
+       trace_ocfs2_create_refcount_tree_blkno((unsigned long long)first_blkno);
  
        ocfs2_journal_dirty(handle, di_bh);
  
@@@ -1256,8 -1255,9 +1255,9 @@@ static int ocfs2_change_refcount_rec(ha
                goto out;
        }
  
-       mlog(0, "change index %d, old count %u, change %d\n", index,
-            le32_to_cpu(rec->r_refcount), change);
+       trace_ocfs2_change_refcount_rec(
+               (unsigned long long)ocfs2_metadata_cache_owner(ci),
+               index, le32_to_cpu(rec->r_refcount), change);
        le32_add_cpu(&rec->r_refcount, change);
  
        if (!rec->r_refcount) {
@@@ -1353,8 -1353,8 +1353,8 @@@ static int ocfs2_expand_inline_ref_root
  
        ocfs2_journal_dirty(handle, ref_root_bh);
  
-       mlog(0, "new leaf block %llu, used %u\n", (unsigned long long)blkno,
-            le16_to_cpu(new_rb->rf_records.rl_used));
+       trace_ocfs2_expand_inline_ref_root((unsigned long long)blkno,
+               le16_to_cpu(new_rb->rf_records.rl_used));
  
        *ref_leaf_bh = new_bh;
        new_bh = NULL;
@@@ -1466,9 -1466,9 +1466,9 @@@ static int ocfs2_divide_leaf_refcount_b
                        (struct ocfs2_refcount_block *)new_bh->b_data;
        struct ocfs2_refcount_list *new_rl = &new_rb->rf_records;
  
-       mlog(0, "split old leaf refcount block %llu, count = %u, used = %u\n",
-            (unsigned long long)ref_leaf_bh->b_blocknr,
-            le32_to_cpu(rl->rl_count), le32_to_cpu(rl->rl_used));
+       trace_ocfs2_divide_leaf_refcount_block(
+               (unsigned long long)ref_leaf_bh->b_blocknr,
+               le32_to_cpu(rl->rl_count), le32_to_cpu(rl->rl_used));
  
        /*
         * XXX: Improvement later.
@@@ -1601,8 -1601,8 +1601,8 @@@ static int ocfs2_new_leaf_refcount_bloc
  
        ocfs2_init_refcount_extent_tree(&ref_et, ci, ref_root_bh);
  
-       mlog(0, "insert new leaf block %llu at %u\n",
-            (unsigned long long)new_bh->b_blocknr, new_cpos);
+       trace_ocfs2_new_leaf_refcount_block(
+                       (unsigned long long)new_bh->b_blocknr, new_cpos);
  
        /* Insert the new leaf block with the specific offset cpos. */
        ret = ocfs2_insert_extent(handle, &ref_et, new_cpos, new_bh->b_blocknr,
@@@ -1794,11 -1794,10 +1794,10 @@@ static int ocfs2_insert_refcount_rec(ha
                        (le16_to_cpu(rf_list->rl_used) - index) *
                         sizeof(struct ocfs2_refcount_rec));
  
-       mlog(0, "insert refcount record start %llu, len %u, count %u "
-            "to leaf block %llu at index %d\n",
-            (unsigned long long)le64_to_cpu(rec->r_cpos),
-            le32_to_cpu(rec->r_clusters), le32_to_cpu(rec->r_refcount),
-            (unsigned long long)ref_leaf_bh->b_blocknr, index);
+       trace_ocfs2_insert_refcount_rec(
+               (unsigned long long)ref_leaf_bh->b_blocknr, index,
+               (unsigned long long)le64_to_cpu(rec->r_cpos),
+               le32_to_cpu(rec->r_clusters), le32_to_cpu(rec->r_refcount));
  
        rf_list->rl_recs[index] = *rec;
  
@@@ -1850,10 -1849,12 +1849,12 @@@ static int ocfs2_split_refcount_rec(han
  
        BUG_ON(le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL);
  
-       mlog(0, "original r_pos %llu, cluster %u, split %llu, cluster %u\n",
-            le64_to_cpu(orig_rec->r_cpos), le32_to_cpu(orig_rec->r_clusters),
-            le64_to_cpu(split_rec->r_cpos),
-            le32_to_cpu(split_rec->r_clusters));
+       trace_ocfs2_split_refcount_rec(le64_to_cpu(orig_rec->r_cpos),
+               le32_to_cpu(orig_rec->r_clusters),
+               le32_to_cpu(orig_rec->r_refcount),
+               le64_to_cpu(split_rec->r_cpos),
+               le32_to_cpu(split_rec->r_clusters),
+               le32_to_cpu(split_rec->r_refcount));
  
        /*
         * If we just need to split the header or tail clusters,
  
        if (split_rec->r_refcount) {
                rf_list->rl_recs[index] = *split_rec;
-               mlog(0, "insert refcount record start %llu, len %u, count %u "
-                    "to leaf block %llu at index %d\n",
-                    (unsigned long long)le64_to_cpu(split_rec->r_cpos),
-                    le32_to_cpu(split_rec->r_clusters),
-                    le32_to_cpu(split_rec->r_refcount),
-                    (unsigned long long)ref_leaf_bh->b_blocknr, index);
+               trace_ocfs2_split_refcount_rec_insert(
+                       (unsigned long long)ref_leaf_bh->b_blocknr, index,
+                       (unsigned long long)le64_to_cpu(split_rec->r_cpos),
+                       le32_to_cpu(split_rec->r_clusters),
+                       le32_to_cpu(split_rec->r_refcount));
  
                if (merge)
                        ocfs2_refcount_rec_merge(rb, index);
@@@ -1997,7 -1997,7 +1997,7 @@@ static int __ocfs2_increase_refcount(ha
        struct ocfs2_refcount_rec rec;
        unsigned int set_len = 0;
  
-       mlog(0, "Tree owner %llu, add refcount start %llu, len %u\n",
+       trace_ocfs2_increase_refcount_begin(
             (unsigned long long)ocfs2_metadata_cache_owner(ci),
             (unsigned long long)cpos, len);
  
                 */
                if (rec.r_refcount && le64_to_cpu(rec.r_cpos) == cpos &&
                    set_len <= len) {
-                       mlog(0, "increase refcount rec, start %llu, len %u, "
-                            "count %u\n", (unsigned long long)cpos, set_len,
-                            le32_to_cpu(rec.r_refcount));
+                       trace_ocfs2_increase_refcount_change(
+                               (unsigned long long)cpos, set_len,
+                               le32_to_cpu(rec.r_refcount));
                        ret = ocfs2_change_refcount_rec(handle, ci,
                                                        ref_leaf_bh, index,
                                                        merge, 1);
                } else if (!rec.r_refcount) {
                        rec.r_refcount = cpu_to_le32(1);
  
-                       mlog(0, "insert refcount rec, start %llu, len %u\n",
+                       trace_ocfs2_increase_refcount_insert(
                             (unsigned long long)le64_to_cpu(rec.r_cpos),
                             set_len);
                        ret = ocfs2_insert_refcount_rec(handle, ci, ref_root_bh,
                        rec.r_clusters = cpu_to_le32(set_len);
                        le32_add_cpu(&rec.r_refcount, 1);
  
-                       mlog(0, "split refcount rec, start %llu, "
-                            "len %u, count %u\n",
+                       trace_ocfs2_increase_refcount_split(
                             (unsigned long long)le64_to_cpu(rec.r_cpos),
                             set_len, le32_to_cpu(rec.r_refcount));
                        ret = ocfs2_split_refcount_rec(handle, ci,
@@@ -2095,6 -2094,11 +2094,11 @@@ static int ocfs2_remove_refcount_extent
  
        BUG_ON(rb->rf_records.rl_used);
  
+       trace_ocfs2_remove_refcount_extent(
+               (unsigned long long)ocfs2_metadata_cache_owner(ci),
+               (unsigned long long)ref_leaf_bh->b_blocknr,
+               le32_to_cpu(rb->rf_cpos));
        ocfs2_init_refcount_extent_tree(&et, ci, ref_root_bh);
        ret = ocfs2_remove_extent(handle, &et, le32_to_cpu(rb->rf_cpos),
                                  1, meta_ac, dealloc);
        if (!rb->rf_list.l_next_free_rec) {
                BUG_ON(rb->rf_clusters);
  
-               mlog(0, "reset refcount tree root %llu to be a record block.\n",
+               trace_ocfs2_restore_refcount_block(
                     (unsigned long long)ref_root_bh->b_blocknr);
  
                rb->rf_flags = 0;
@@@ -2184,6 -2188,10 +2188,10 @@@ static int ocfs2_decrease_refcount_rec(
        BUG_ON(cpos + len >
               le64_to_cpu(rec->r_cpos) + le32_to_cpu(rec->r_clusters));
  
+       trace_ocfs2_decrease_refcount_rec(
+               (unsigned long long)ocfs2_metadata_cache_owner(ci),
+               (unsigned long long)cpos, len);
        if (cpos == le64_to_cpu(rec->r_cpos) &&
            len == le32_to_cpu(rec->r_clusters))
                ret = ocfs2_change_refcount_rec(handle, ci,
  
                le32_add_cpu(&split.r_refcount, -1);
  
-               mlog(0, "split refcount rec, start %llu, "
-                    "len %u, count %u, original start %llu, len %u\n",
-                    (unsigned long long)le64_to_cpu(split.r_cpos),
-                    len, le32_to_cpu(split.r_refcount),
-                    (unsigned long long)le64_to_cpu(rec->r_cpos),
-                    le32_to_cpu(rec->r_clusters));
                ret = ocfs2_split_refcount_rec(handle, ci,
                                               ref_root_bh, ref_leaf_bh,
                                               &split, index, 1,
@@@ -2239,10 -2241,9 +2241,9 @@@ static int __ocfs2_decrease_refcount(ha
        struct super_block *sb = ocfs2_metadata_cache_get_super(ci);
        struct buffer_head *ref_leaf_bh = NULL;
  
-       mlog(0, "Tree owner %llu, decrease refcount start %llu, "
-            "len %u, delete %u\n",
-            (unsigned long long)ocfs2_metadata_cache_owner(ci),
-            (unsigned long long)cpos, len, delete);
+       trace_ocfs2_decrease_refcount(
+               (unsigned long long)ocfs2_metadata_cache_owner(ci),
+               (unsigned long long)cpos, len, delete);
  
        while (len) {
                ret = ocfs2_get_refcount_rec(ci, ref_root_bh,
@@@ -2352,8 -2353,8 +2353,8 @@@ static int ocfs2_mark_extent_refcounted
  {
        int ret;
  
-       mlog(0, "Inode %lu refcount tree cpos %u, len %u, phys cluster %u\n",
-            inode->i_ino, cpos, len, phys);
+       trace_ocfs2_mark_extent_refcounted(OCFS2_I(inode)->ip_blkno,
+                                          cpos, len, phys);
  
        if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) {
                ocfs2_error(inode->i_sb, "Inode %lu want to use refcount "
@@@ -2392,8 -2393,6 +2393,6 @@@ static int ocfs2_calc_refcount_meta_cre
        struct buffer_head *ref_leaf_bh = NULL, *prev_bh = NULL;
        u32 len;
  
-       mlog(0, "start_cpos %llu, clusters %u\n",
-            (unsigned long long)start_cpos, clusters);
        while (clusters) {
                ret = ocfs2_get_refcount_rec(ci, ref_root_bh,
                                             cpos, clusters, &rec,
  
                rb = (struct ocfs2_refcount_block *)ref_leaf_bh->b_data;
  
-               mlog(0, "recs_add %d,cpos %llu, clusters %u, rec->r_cpos %llu,"
-                    "rec->r_clusters %u, rec->r_refcount %u, index %d\n",
-                    recs_add, (unsigned long long)cpos, clusters,
-                    (unsigned long long)le64_to_cpu(rec.r_cpos),
-                    le32_to_cpu(rec.r_clusters),
-                    le32_to_cpu(rec.r_refcount), index);
+               trace_ocfs2_calc_refcount_meta_credits_iterate(
+                               recs_add, (unsigned long long)cpos, clusters,
+                               (unsigned long long)le64_to_cpu(rec.r_cpos),
+                               le32_to_cpu(rec.r_clusters),
+                               le32_to_cpu(rec.r_refcount), index);
  
                len = min((u64)cpos + clusters, le64_to_cpu(rec.r_cpos) +
                          le32_to_cpu(rec.r_clusters)) - cpos;
        if (!ref_blocks)
                goto out;
  
-       mlog(0, "we need ref_blocks %d\n", ref_blocks);
        *meta_add += ref_blocks;
        *credits += ref_blocks;
  
        }
  
  out:
+       trace_ocfs2_calc_refcount_meta_credits(
+               (unsigned long long)start_cpos, clusters,
+               *meta_add, *credits);
        brelse(ref_leaf_bh);
        brelse(prev_bh);
        return ret;
@@@ -2578,8 -2579,7 +2579,7 @@@ int ocfs2_prepare_refcount_change_for_d
                goto out;
        }
  
-       mlog(0, "reserve new metadata %d blocks, credits = %d\n",
-            *ref_blocks, *credits);
+       trace_ocfs2_prepare_refcount_change_for_del(*ref_blocks, *credits);
  
  out:
        brelse(ref_root_bh);
@@@ -2886,8 -2886,7 +2886,7 @@@ static int ocfs2_lock_refcount_allocato
                goto out;
        }
  
-       mlog(0, "reserve new metadata %d, clusters %u, credits = %d\n",
-            meta_add, num_clusters, *credits);
+       trace_ocfs2_lock_refcount_allocators(meta_add, *credits);
        ret = ocfs2_reserve_new_metadata_blocks(OCFS2_SB(sb), meta_add,
                                                meta_ac);
        if (ret) {
@@@ -2937,8 -2936,8 +2936,8 @@@ static int ocfs2_duplicate_clusters_by_
        loff_t offset, end, map_end;
        struct address_space *mapping = context->inode->i_mapping;
  
-       mlog(0, "old_cluster %u, new %u, len %u at offset %u\n", old_cluster,
-            new_cluster, new_len, cpos);
+       trace_ocfs2_duplicate_clusters_by_page(cpos, old_cluster,
+                                              new_cluster, new_len);
  
        readahead_pages =
                (ocfs2_cow_contig_clusters(sb) <<
@@@ -3031,8 -3030,8 +3030,8 @@@ static int ocfs2_duplicate_clusters_by_
        struct buffer_head *old_bh = NULL;
        struct buffer_head *new_bh = NULL;
  
-       mlog(0, "old_cluster %u, new %u, len %u\n", old_cluster,
-            new_cluster, new_len);
+       trace_ocfs2_duplicate_clusters_by_page(cpos, old_cluster,
+                                              new_cluster, new_len);
  
        for (i = 0; i < blocks; i++, old_block++, new_block++) {
                new_bh = sb_getblk(osb->sb, new_block);
@@@ -3085,8 -3084,8 +3084,8 @@@ static int ocfs2_clear_ext_refcount(han
        struct super_block *sb = ocfs2_metadata_cache_get_super(et->et_ci);
        u64 ino = ocfs2_metadata_cache_owner(et->et_ci);
  
-       mlog(0, "inode %llu cpos %u, len %u, p_cluster %u, ext_flags %u\n",
-            (unsigned long long)ino, cpos, len, p_cluster, ext_flags);
+       trace_ocfs2_clear_ext_refcount((unsigned long long)ino,
+                                      cpos, len, p_cluster, ext_flags);
  
        memset(&replace_rec, 0, sizeof(replace_rec));
        replace_rec.e_cpos = cpu_to_le32(cpos);
@@@ -3141,8 -3140,8 +3140,8 @@@ static int ocfs2_replace_clusters(handl
        struct ocfs2_caching_info *ci = context->data_et.et_ci;
        u64 ino = ocfs2_metadata_cache_owner(ci);
  
-       mlog(0, "inode %llu, cpos %u, old %u, new %u, len %u, ext_flags %u\n",
-            (unsigned long long)ino, cpos, old, new, len, ext_flags);
+       trace_ocfs2_replace_clusters((unsigned long long)ino,
+                                    cpos, old, new, len, ext_flags);
  
        /*If the old clusters is unwritten, no need to duplicate. */
        if (!(ext_flags & OCFS2_EXT_UNWRITTEN)) {
@@@ -3236,8 -3235,8 +3235,8 @@@ static int ocfs2_make_clusters_writable
        struct ocfs2_caching_info *ref_ci = &context->ref_tree->rf_ci;
        struct ocfs2_refcount_rec rec;
  
-       mlog(0, "cpos %u, p_cluster %u, num_clusters %u, e_flags %u\n",
-            cpos, p_cluster, num_clusters, e_flags);
+       trace_ocfs2_make_clusters_writable(cpos, p_cluster,
+                                          num_clusters, e_flags);
  
        ret = ocfs2_lock_refcount_allocators(sb, p_cluster, num_clusters,
                                             &context->data_et,
@@@ -3475,9 -3474,9 +3474,9 @@@ static int ocfs2_refcount_cow_hunk(stru
                goto out;
        }
  
-       mlog(0, "CoW inode %lu, cpos %u, write_len %u, cow_start %u, "
-            "cow_len %u\n", inode->i_ino,
-            cpos, write_len, cow_start, cow_len);
+       trace_ocfs2_refcount_cow_hunk(OCFS2_I(inode)->ip_blkno,
+                                     cpos, write_len, max_cpos,
+                                     cow_start, cow_len);
  
        BUG_ON(cow_len == 0);
  
@@@ -3756,8 -3755,7 +3755,7 @@@ int ocfs2_add_refcount_flag(struct inod
                goto out;
        }
  
-       mlog(0, "reserve new metadata %d, credits = %d\n",
-            ref_blocks, credits);
+       trace_ocfs2_add_refcount_flag(ref_blocks, credits);
  
        if (ref_blocks) {
                ret = ocfs2_reserve_new_metadata_blocks(OCFS2_SB(inode->i_sb),
@@@ -4328,8 -4326,7 +4326,8 @@@ static int ocfs2_reflink(struct dentry 
  
        /* If the security isn't preserved, we need to re-initialize them. */
        if (!preserve) {
 -              error = ocfs2_init_security_and_acl(dir, new_orphan_inode);
 +              error = ocfs2_init_security_and_acl(dir, new_orphan_inode,
 +                                                  &new_dentry->d_name);
                if (error)
                        mlog_errno(error);
        }
diff --combined fs/ocfs2/super.c
index 236ed1bdca2c5aa39e3140f490f5ba644610ec05,0e4083987d2bf8c0b3daed879041a0e4df1af9dd..69fa11b35aa4ccd821729a0460d68d7b1ee72d83
@@@ -42,7 -42,9 +42,9 @@@
  #include <linux/seq_file.h>
  #include <linux/quotaops.h>
  
- #define MLOG_MASK_PREFIX ML_SUPER
+ #define CREATE_TRACE_POINTS
+ #include "ocfs2_trace.h"
  #include <cluster/masklog.h>
  
  #include "ocfs2.h"
@@@ -441,8 -443,6 +443,6 @@@ static int ocfs2_init_global_system_ino
        int status = 0;
        int i;
  
-       mlog_entry_void();
        new = ocfs2_iget(osb, osb->root_blkno, OCFS2_FI_FLAG_SYSFILE, 0);
        if (IS_ERR(new)) {
                status = PTR_ERR(new);
        }
  
  bail:
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
  }
  
@@@ -488,8 -489,6 +489,6 @@@ static int ocfs2_init_local_system_inod
        int status = 0;
        int i;
  
-       mlog_entry_void();
        for (i = OCFS2_LAST_GLOBAL_SYSTEM_INODE + 1;
             i < NUM_SYSTEM_INODES;
             i++) {
        }
  
  bail:
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
  }
  
@@@ -517,8 -517,6 +517,6 @@@ static void ocfs2_release_system_inodes
        int i;
        struct inode *inode;
  
-       mlog_entry_void();
        for (i = 0; i < NUM_GLOBAL_SYSTEM_INODES; i++) {
                inode = osb->global_system_inodes[i];
                if (inode) {
        }
  
        if (!osb->local_system_inodes)
-               goto out;
+               return;
  
        for (i = 0; i < NUM_LOCAL_SYSTEM_INODES * osb->max_slots; i++) {
                if (osb->local_system_inodes[i]) {
  
        kfree(osb->local_system_inodes);
        osb->local_system_inodes = NULL;
- out:
-       mlog_exit(0);
  }
  
  /* We're allocating fs objects, use GFP_NOFS */
@@@ -684,12 -679,9 +679,9 @@@ static int ocfs2_remount(struct super_b
                }
  
                if (*flags & MS_RDONLY) {
-                       mlog(0, "Going to ro mode.\n");
                        sb->s_flags |= MS_RDONLY;
                        osb->osb_flags |= OCFS2_OSB_SOFT_RO;
                } else {
-                       mlog(0, "Making ro filesystem writeable.\n");
                        if (osb->osb_flags & OCFS2_OSB_ERROR_FS) {
                                mlog(ML_ERROR, "Cannot remount RDWR "
                                     "filesystem due to previous errors.\n");
                        sb->s_flags &= ~MS_RDONLY;
                        osb->osb_flags &= ~OCFS2_OSB_SOFT_RO;
                }
+               trace_ocfs2_remount(sb->s_flags, osb->osb_flags, *flags);
  unlock_osb:
                spin_unlock(&osb->osb_lock);
                /* Enable quota accounting after remounting RW */
@@@ -1032,7 -1025,7 +1025,7 @@@ static int ocfs2_fill_super(struct supe
        char nodestr[8];
        struct ocfs2_blockcheck_stats stats;
  
-       mlog_entry("%p, %p, %i", sb, data, silent);
+       trace_ocfs2_fill_super(sb, data, silent);
  
        if (!ocfs2_parse_options(sb, data, &parsed_options, 0)) {
                status = -EINVAL;
                        mlog_errno(status);
                        atomic_set(&osb->vol_state, VOLUME_DISABLED);
                        wake_up(&osb->osb_mount_event);
-                       mlog_exit(status);
                        return status;
                }
        }
        /* Start this when the mount is almost sure of being successful */
        ocfs2_orphan_scan_start(osb);
  
-       mlog_exit(status);
        return status;
  
  read_super_error:
                ocfs2_dismount_volume(sb, 1);
        }
  
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
  }
  
@@@ -1320,8 -1312,7 +1312,7 @@@ static int ocfs2_parse_options(struct s
        char *p;
        u32 tmp;
  
-       mlog_entry("remount: %d, options: \"%s\"\n", is_remount,
-                  options ? options : "(none)");
+       trace_ocfs2_parse_options(is_remount, options ? options : "(none)");
  
        mopt->commit_interval = 0;
        mopt->mount_opt = OCFS2_MOUNT_NOINTR;
        status = 1;
  
  bail:
-       mlog_exit(status);
        return status;
  }
  
@@@ -1629,8 -1619,6 +1619,6 @@@ static int __init ocfs2_init(void
  {
        int status;
  
-       mlog_entry_void();
        ocfs2_print_version();
  
        status = init_ocfs2_uptodate_cache();
                mlog(ML_ERROR, "Unable to create ocfs2 debugfs root.\n");
        }
  
 -      status = ocfs2_quota_setup();
 -      if (status)
 -              goto leave;
 -
        ocfs2_set_locking_protocol();
  
        status = register_quota_format(&ocfs2_quota_format);
  leave:
        if (status < 0) {
 -              ocfs2_quota_shutdown();
                ocfs2_free_mem_caches();
                exit_ocfs2_uptodate_cache();
+               mlog_errno(status);
        }
  
-       mlog_exit(status);
        if (status >= 0) {
                return register_filesystem(&ocfs2_fs_type);
        } else
  
  static void __exit ocfs2_exit(void)
  {
-       mlog_entry_void();
 -      ocfs2_quota_shutdown();
--
        if (ocfs2_wq) {
                flush_workqueue(ocfs2_wq);
                destroy_workqueue(ocfs2_wq);
        unregister_filesystem(&ocfs2_fs_type);
  
        exit_ocfs2_uptodate_cache();
-       mlog_exit_void();
  }
  
  static void ocfs2_put_super(struct super_block *sb)
  {
-       mlog_entry("(0x%p)\n", sb);
+       trace_ocfs2_put_super(sb);
  
        ocfs2_sync_blockdev(sb);
        ocfs2_dismount_volume(sb, 0);
-       mlog_exit_void();
  }
  
  static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf)
        struct buffer_head *bh = NULL;
        struct inode *inode = NULL;
  
-       mlog_entry("(%p, %p)\n", dentry->d_sb, buf);
+       trace_ocfs2_statfs(dentry->d_sb, buf);
  
        osb = OCFS2_SB(dentry->d_sb);
  
@@@ -1762,7 -1750,8 +1743,8 @@@ bail
        if (inode)
                iput(inode);
  
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
  
        return status;
  }
@@@ -1882,8 -1871,6 +1864,6 @@@ static int ocfs2_mount_volume(struct su
        int unlock_super = 0;
        struct ocfs2_super *osb = OCFS2_SB(sb);
  
-       mlog_entry_void();
        if (ocfs2_is_hard_readonly(osb))
                goto leave;
  
@@@ -1928,7 -1915,6 +1908,6 @@@ leave
        if (unlock_super)
                ocfs2_super_unlock(osb, 1);
  
-       mlog_exit(status);
        return status;
  }
  
@@@ -1938,7 -1924,7 +1917,7 @@@ static void ocfs2_dismount_volume(struc
        struct ocfs2_super *osb = NULL;
        char nodestr[8];
  
-       mlog_entry("(0x%p)\n", sb);
+       trace_ocfs2_dismount_volume(sb);
  
        BUG_ON(!sb);
        osb = OCFS2_SB(sb);
@@@ -2090,8 -2076,6 +2069,6 @@@ static int ocfs2_initialize_super(struc
        struct ocfs2_super *osb;
        u64 total_blocks;
  
-       mlog_entry_void();
        osb = kzalloc(sizeof(struct ocfs2_super), GFP_KERNEL);
        if (!osb) {
                status = -ENOMEM;
                status = -EINVAL;
                goto bail;
        }
-       mlog(0, "max_slots for this device: %u\n", osb->max_slots);
  
        ocfs2_orphan_scan_init(osb);
  
        osb->s_clustersize_bits =
                le32_to_cpu(di->id2.i_super.s_clustersize_bits);
        osb->s_clustersize = 1 << osb->s_clustersize_bits;
-       mlog(0, "clusterbits=%d\n", osb->s_clustersize_bits);
  
        if (osb->s_clustersize < OCFS2_MIN_CLUSTERSIZE ||
            osb->s_clustersize > OCFS2_MAX_CLUSTERSIZE) {
                le64_to_cpu(di->id2.i_super.s_first_cluster_group);
        osb->fs_generation = le32_to_cpu(di->i_fs_generation);
        osb->uuid_hash = le32_to_cpu(di->id2.i_super.s_uuid_hash);
-       mlog(0, "vol_label: %s\n", osb->vol_label);
-       mlog(0, "uuid: %s\n", osb->uuid_str);
-       mlog(0, "root_blkno=%llu, system_dir_blkno=%llu\n",
-            (unsigned long long)osb->root_blkno,
-            (unsigned long long)osb->system_dir_blkno);
+       trace_ocfs2_initialize_super(osb->vol_label, osb->uuid_str,
+                                    (unsigned long long)osb->root_blkno,
+                                    (unsigned long long)osb->system_dir_blkno,
+                                    osb->s_clustersize_bits);
  
        osb->osb_dlm_debug = ocfs2_new_dlm_debug();
        if (!osb->osb_dlm_debug) {
        }
  
  bail:
-       mlog_exit(status);
        return status;
  }
  
@@@ -2396,8 -2376,6 +2369,6 @@@ static int ocfs2_verify_volume(struct o
  {
        int status = -EAGAIN;
  
-       mlog_entry_void();
        if (memcmp(di->i_signature, OCFS2_SUPER_BLOCK_SIGNATURE,
                   strlen(OCFS2_SUPER_BLOCK_SIGNATURE)) == 0) {
                /* We have to do a raw check of the feature here */
        }
  
  out:
-       mlog_exit(status);
+       if (status && status != -EAGAIN)
+               mlog_errno(status);
        return status;
  }
  
@@@ -2465,8 -2444,6 +2437,6 @@@ static int ocfs2_check_volume(struct oc
                                                  * recover
                                                  * ourselves. */
  
-       mlog_entry_void();
        /* Init our journal object. */
        status = ocfs2_journal_init(osb->journal, &dirty);
        if (status < 0) {
                 * ourselves as mounted. */
        }
  
-       mlog(0, "Journal loaded.\n");
        status = ocfs2_load_local_alloc(osb);
        if (status < 0) {
                mlog_errno(status);
@@@ -2549,7 -2524,8 +2517,8 @@@ finally
        if (local_alloc)
                kfree(local_alloc);
  
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
  }
  
   */
  static void ocfs2_delete_osb(struct ocfs2_super *osb)
  {
-       mlog_entry_void();
        /* This function assumes that the caller has the main osb resource */
  
        ocfs2_free_slot_info(osb);
        kfree(osb->uuid_str);
        ocfs2_put_dlm_debug(osb->osb_dlm_debug);
        memset(osb, 0, sizeof(struct ocfs2_super));
-       mlog_exit_void();
  }
  
  /* Put OCFS2 into a readonly state, or (if the user specifies it),
diff --combined fs/ocfs2/xattr.c
index 6bb602486c6bdf92a635855d120d8c724b34aef5,52e3dadd36428dda66efc42ef5510ea1754f7abf..57a215dc2d9b73039fe376a49fdc5bc01ea44359
@@@ -37,7 -37,6 +37,6 @@@
  #include <linux/string.h>
  #include <linux/security.h>
  
- #define MLOG_MASK_PREFIX ML_XATTR
  #include <cluster/masklog.h>
  
  #include "ocfs2.h"
@@@ -57,6 -56,7 +56,7 @@@
  #include "xattr.h"
  #include "refcounttree.h"
  #include "acl.h"
+ #include "ocfs2_trace.h"
  
  struct ocfs2_xattr_def_value_root {
        struct ocfs2_xattr_value_root   xv;
@@@ -474,8 -474,7 +474,7 @@@ static int ocfs2_validate_xattr_block(s
        struct ocfs2_xattr_block *xb =
                (struct ocfs2_xattr_block *)bh->b_data;
  
-       mlog(0, "Validating xattr block %llu\n",
-            (unsigned long long)bh->b_blocknr);
+       trace_ocfs2_validate_xattr_block((unsigned long long)bh->b_blocknr);
  
        BUG_ON(!buffer_uptodate(bh));
  
@@@ -715,11 -714,11 +714,11 @@@ static int ocfs2_xattr_extend_allocatio
        u32 prev_clusters, logical_start = le32_to_cpu(vb->vb_xv->xr_clusters);
        struct ocfs2_extent_tree et;
  
-       mlog(0, "(clusters_to_add for xattr= %u)\n", clusters_to_add);
        ocfs2_init_xattr_value_extent_tree(&et, INODE_CACHE(inode), vb);
  
        while (clusters_to_add) {
+               trace_ocfs2_xattr_extend_allocation(clusters_to_add);
                status = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh,
                                       OCFS2_JOURNAL_ACCESS_WRITE);
                if (status < 0) {
                         */
                        BUG_ON(why == RESTART_META);
  
-                       mlog(0, "restarting xattr value extension for %u"
-                            " clusters,.\n", clusters_to_add);
                        credits = ocfs2_calc_extend_credits(inode->i_sb,
                                                            &vb->vb_xv->xr_list,
                                                            clusters_to_add);
@@@ -3246,8 -3243,8 +3243,8 @@@ static int ocfs2_init_xattr_set_ctxt(st
        }
  
        meta_add += extra_meta;
-       mlog(0, "Set xattr %s, reserve meta blocks = %d, clusters = %d, "
-            "credits = %d\n", xi->xi_name, meta_add, clusters_add, *credits);
+       trace_ocfs2_init_xattr_set_ctxt(xi->xi_name, meta_add,
+                                       clusters_add, *credits);
  
        if (meta_add) {
                ret = ocfs2_reserve_new_metadata_blocks(osb, meta_add,
@@@ -3887,8 -3884,10 +3884,10 @@@ static int ocfs2_xattr_bucket_find(stru
  
        if (found) {
                xs->here = &xs->header->xh_entries[index];
-               mlog(0, "find xattr %s in bucket %llu, entry = %u\n", name,
-                    (unsigned long long)bucket_blkno(xs->bucket), index);
+               trace_ocfs2_xattr_bucket_find(OCFS2_I(inode)->ip_blkno,
+                       name, name_index, name_hash,
+                       (unsigned long long)bucket_blkno(xs->bucket),
+                       index);
        } else
                ret = -ENODATA;
  
@@@ -3915,8 -3914,10 +3914,10 @@@ static int ocfs2_xattr_index_block_find
        if (le16_to_cpu(el->l_next_free_rec) == 0)
                return -ENODATA;
  
-       mlog(0, "find xattr %s, hash = %u, index = %d in xattr tree\n",
-            name, name_hash, name_index);
+       trace_ocfs2_xattr_index_block_find(OCFS2_I(inode)->ip_blkno,
+                                       name, name_index, name_hash,
+                                       (unsigned long long)root_bh->b_blocknr,
+                                       -1);
  
        ret = ocfs2_xattr_get_rec(inode, name_hash, &p_blkno, &first_hash,
                                  &num_clusters, el);
  
        BUG_ON(p_blkno == 0 || num_clusters == 0 || first_hash > name_hash);
  
-       mlog(0, "find xattr extent rec %u clusters from %llu, the first hash "
-            "in the rec is %u\n", num_clusters, (unsigned long long)p_blkno,
-            first_hash);
+       trace_ocfs2_xattr_index_block_find_rec(OCFS2_I(inode)->ip_blkno,
+                                       name, name_index, first_hash,
+                                       (unsigned long long)p_blkno,
+                                       num_clusters);
  
        ret = ocfs2_xattr_bucket_find(inode, name_index, name, name_hash,
                                      p_blkno, first_hash, num_clusters, xs);
@@@ -3955,8 -3957,9 +3957,9 @@@ static int ocfs2_iterate_xattr_buckets(
                return -ENOMEM;
        }
  
-       mlog(0, "iterating xattr buckets in %u clusters starting from %llu\n",
-            clusters, (unsigned long long)blkno);
+       trace_ocfs2_iterate_xattr_buckets(
+               (unsigned long long)OCFS2_I(inode)->ip_blkno,
+               (unsigned long long)blkno, clusters);
  
        for (i = 0; i < num_buckets; i++, blkno += bucket->bu_blocks) {
                ret = ocfs2_read_xattr_bucket(bucket, blkno);
                if (i == 0)
                        num_buckets = le16_to_cpu(bucket_xh(bucket)->xh_num_buckets);
  
-               mlog(0, "iterating xattr bucket %llu, first hash %u\n",
-                    (unsigned long long)blkno,
+               trace_ocfs2_iterate_xattr_bucket((unsigned long long)blkno,
                     le32_to_cpu(bucket_xh(bucket)->xh_entries[0].xe_name_hash));
                if (func) {
                        ret = func(inode, bucket, para);
@@@ -4173,9 -4175,9 +4175,9 @@@ static void ocfs2_cp_xattr_block_to_buc
        char *src = xb_bh->b_data;
        char *target = bucket_block(bucket, blks - 1);
  
-       mlog(0, "cp xattr from block %llu to bucket %llu\n",
-            (unsigned long long)xb_bh->b_blocknr,
-            (unsigned long long)bucket_blkno(bucket));
+       trace_ocfs2_cp_xattr_block_to_bucket_begin(
+                               (unsigned long long)xb_bh->b_blocknr,
+                               (unsigned long long)bucket_blkno(bucket));
  
        for (i = 0; i < blks; i++)
                memset(bucket_block(bucket, i), 0, blocksize);
        for (i = 0; i < count; i++)
                le16_add_cpu(&xh->xh_entries[i].xe_name_offset, off_change);
  
-       mlog(0, "copy entry: start = %u, size = %u, offset_change = %u\n",
-            offset, size, off_change);
+       trace_ocfs2_cp_xattr_block_to_bucket_end(offset, size, off_change);
  
        sort(target + offset, count, sizeof(struct ocfs2_xattr_entry),
             cmp_xe, swap_xe);
@@@ -4261,8 -4262,8 +4262,8 @@@ static int ocfs2_xattr_create_index_blo
        struct ocfs2_xattr_tree_root *xr;
        u16 xb_flags = le16_to_cpu(xb->xb_flags);
  
-       mlog(0, "create xattr index block for %llu\n",
-            (unsigned long long)xb_bh->b_blocknr);
+       trace_ocfs2_xattr_create_index_block_begin(
+                               (unsigned long long)xb_bh->b_blocknr);
  
        BUG_ON(xb_flags & OCFS2_XATTR_INDEXED);
        BUG_ON(!xs->bucket);
         */
        blkno = ocfs2_clusters_to_blocks(inode->i_sb, bit_off);
  
-       mlog(0, "allocate 1 cluster from %llu to xattr block\n",
-            (unsigned long long)blkno);
+       trace_ocfs2_xattr_create_index_block((unsigned long long)blkno);
  
        ret = ocfs2_init_xattr_bucket(xs->bucket, blkno);
        if (ret) {
@@@ -4400,8 -4400,7 +4400,7 @@@ static int ocfs2_defrag_xattr_bucket(st
        entries = (char *)xh->xh_entries;
        xh_free_start = le16_to_cpu(xh->xh_free_start);
  
-       mlog(0, "adjust xattr bucket in %llu, count = %u, "
-            "xh_free_start = %u, xh_name_value_len = %u.\n",
+       trace_ocfs2_defrag_xattr_bucket(
             (unsigned long long)blkno, le16_to_cpu(xh->xh_count),
             xh_free_start, le16_to_cpu(xh->xh_name_value_len));
  
@@@ -4503,8 -4502,9 +4502,9 @@@ static int ocfs2_mv_xattr_bucket_cross_
        BUG_ON(le16_to_cpu(bucket_xh(first)->xh_num_buckets) < num_buckets);
        BUG_ON(OCFS2_XATTR_BUCKET_SIZE == OCFS2_SB(sb)->s_clustersize);
  
-       mlog(0, "move half of xattrs in cluster %llu to %llu\n",
-            (unsigned long long)last_cluster_blkno, (unsigned long long)new_blkno);
+       trace_ocfs2_mv_xattr_bucket_cross_cluster(
+                               (unsigned long long)last_cluster_blkno,
+                               (unsigned long long)new_blkno);
  
        ret = ocfs2_mv_xattr_buckets(inode, handle, bucket_blkno(first),
                                     last_cluster_blkno, new_blkno,
@@@ -4614,8 -4614,8 +4614,8 @@@ static int ocfs2_divide_xattr_bucket(st
        struct ocfs2_xattr_entry *xe;
        int blocksize = inode->i_sb->s_blocksize;
  
-       mlog(0, "move some of xattrs from bucket %llu to %llu\n",
-            (unsigned long long)blk, (unsigned long long)new_blk);
+       trace_ocfs2_divide_xattr_bucket_begin((unsigned long long)blk,
+                                             (unsigned long long)new_blk);
  
        s_bucket = ocfs2_xattr_bucket_new(inode);
        t_bucket = ocfs2_xattr_bucket_new(inode);
         */
        xe = &xh->xh_entries[start];
        len = sizeof(struct ocfs2_xattr_entry) * (count - start);
-       mlog(0, "mv xattr entry len %d from %d to %d\n", len,
-            (int)((char *)xe - (char *)xh),
-            (int)((char *)xh->xh_entries - (char *)xh));
+       trace_ocfs2_divide_xattr_bucket_move(len,
+                       (int)((char *)xe - (char *)xh),
+                       (int)((char *)xh->xh_entries - (char *)xh));
        memmove((char *)xh->xh_entries, (char *)xe, len);
        xe = &xh->xh_entries[count - start];
        len = sizeof(struct ocfs2_xattr_entry) * start;
@@@ -4788,9 -4788,9 +4788,9 @@@ static int ocfs2_cp_xattr_bucket(struc
  
        BUG_ON(s_blkno == t_blkno);
  
-       mlog(0, "cp bucket %llu to %llu, target is %d\n",
-            (unsigned long long)s_blkno, (unsigned long long)t_blkno,
-            t_is_new);
+       trace_ocfs2_cp_xattr_bucket((unsigned long long)s_blkno,
+                                   (unsigned long long)t_blkno,
+                                   t_is_new);
  
        s_bucket = ocfs2_xattr_bucket_new(inode);
        t_bucket = ocfs2_xattr_bucket_new(inode);
@@@ -4862,8 -4862,8 +4862,8 @@@ static int ocfs2_mv_xattr_buckets(struc
        int num_buckets = ocfs2_xattr_buckets_per_cluster(osb);
        struct ocfs2_xattr_bucket *old_first, *new_first;
  
-       mlog(0, "mv xattrs from cluster %llu to %llu\n",
-            (unsigned long long)last_blk, (unsigned long long)to_blk);
+       trace_ocfs2_mv_xattr_buckets((unsigned long long)last_blk,
+                                    (unsigned long long)to_blk);
  
        BUG_ON(start_bucket >= num_buckets);
        if (start_bucket) {
@@@ -5013,9 -5013,9 +5013,9 @@@ static int ocfs2_adjust_xattr_cross_clu
  {
        int ret;
  
-       mlog(0, "adjust xattrs from cluster %llu len %u to %llu\n",
-            (unsigned long long)bucket_blkno(first), prev_clusters,
-            (unsigned long long)new_blk);
+       trace_ocfs2_adjust_xattr_cross_cluster(
+                       (unsigned long long)bucket_blkno(first),
+                       (unsigned long long)new_blk, prev_clusters);
  
        if (ocfs2_xattr_buckets_per_cluster(OCFS2_SB(inode->i_sb)) > 1) {
                ret = ocfs2_mv_xattr_bucket_cross_cluster(inode,
@@@ -5088,10 -5088,10 +5088,10 @@@ static int ocfs2_add_new_xattr_cluster(
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
        struct ocfs2_extent_tree et;
  
-       mlog(0, "Add new xattr cluster for %llu, previous xattr hash = %u, "
-            "previous xattr blkno = %llu\n",
-            (unsigned long long)OCFS2_I(inode)->ip_blkno,
-            prev_cpos, (unsigned long long)bucket_blkno(first));
+       trace_ocfs2_add_new_xattr_cluster_begin(
+               (unsigned long long)OCFS2_I(inode)->ip_blkno,
+               (unsigned long long)bucket_blkno(first),
+               prev_cpos, prev_clusters);
  
        ocfs2_init_xattr_tree_extent_tree(&et, INODE_CACHE(inode), root_bh);
  
        BUG_ON(num_bits > clusters_to_add);
  
        block = ocfs2_clusters_to_blocks(osb->sb, bit_off);
-       mlog(0, "Allocating %u clusters at block %u for xattr in inode %llu\n",
-            num_bits, bit_off, (unsigned long long)OCFS2_I(inode)->ip_blkno);
+       trace_ocfs2_add_new_xattr_cluster((unsigned long long)block, num_bits);
  
        if (bucket_blkno(first) + (prev_clusters * bpc) == block &&
            (prev_clusters + num_bits) << osb->s_clustersize_bits <=
                 */
                v_start = prev_cpos + prev_clusters;
                *num_clusters = prev_clusters + num_bits;
-               mlog(0, "Add contiguous %u clusters to previous extent rec.\n",
-                    num_bits);
        } else {
                ret = ocfs2_adjust_xattr_cross_cluster(inode,
                                                       handle,
                }
        }
  
-       mlog(0, "Insert %u clusters at block %llu for xattr at %u\n",
-            num_bits, (unsigned long long)block, v_start);
+       trace_ocfs2_add_new_xattr_cluster_insert((unsigned long long)block,
+                                                v_start, num_bits);
        ret = ocfs2_insert_extent(handle, &et, v_start, block,
                                  num_bits, 0, ctxt->meta_ac);
        if (ret < 0) {
@@@ -5183,9 -5180,9 +5180,9 @@@ static int ocfs2_extend_xattr_bucket(st
        u64 end_blk;
        u16 new_bucket = le16_to_cpu(bucket_xh(first)->xh_num_buckets);
  
-       mlog(0, "extend xattr bucket in %llu, xattr extend rec starting "
-            "from %llu, len = %u\n", (unsigned long long)target_blk,
-            (unsigned long long)bucket_blkno(first), num_clusters);
+       trace_ocfs2_extend_xattr_bucket((unsigned long long)target_blk,
+                                       (unsigned long long)bucket_blkno(first),
+                                       num_clusters, new_bucket);
  
        /* The extent must have room for an additional bucket */
        BUG_ON(new_bucket >=
@@@ -5265,8 -5262,8 +5262,8 @@@ static int ocfs2_add_new_xattr_bucket(s
        /* The bucket at the front of the extent */
        struct ocfs2_xattr_bucket *first;
  
-       mlog(0, "Add new xattr bucket starting from %llu\n",
-            (unsigned long long)bucket_blkno(target));
+       trace_ocfs2_add_new_xattr_bucket(
+                               (unsigned long long)bucket_blkno(target));
  
        /* The first bucket of the original extent */
        first = ocfs2_xattr_bucket_new(inode);
@@@ -5382,8 -5379,8 +5379,8 @@@ static int ocfs2_xattr_bucket_value_tru
         * modified something.  We have to assume they did, and dirty
         * the whole bucket.  This leaves us in a consistent state.
         */
-       mlog(0, "truncate %u in xattr bucket %llu to %d bytes.\n",
-            xe_off, (unsigned long long)bucket_blkno(bucket), len);
+       trace_ocfs2_xattr_bucket_value_truncate(
+                       (unsigned long long)bucket_blkno(bucket), xe_off, len);
        ret = ocfs2_xattr_value_truncate(inode, &vb, len, ctxt);
        if (ret) {
                mlog_errno(ret);
@@@ -5433,8 -5430,9 +5430,9 @@@ static int ocfs2_rm_xattr_cluster(struc
  
        ocfs2_init_dealloc_ctxt(&dealloc);
  
-       mlog(0, "rm xattr extent rec at %u len = %u, start from %llu\n",
-            cpos, len, (unsigned long long)blkno);
+       trace_ocfs2_rm_xattr_cluster(
+                       (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                       (unsigned long long)blkno, cpos, len);
  
        ocfs2_remove_xattr_clusters_from_cache(INODE_CACHE(inode), blkno,
                                               len);
@@@ -5538,7 -5536,7 +5536,7 @@@ static int ocfs2_xattr_set_entry_bucket
        int ret;
        struct ocfs2_xa_loc loc;
  
-       mlog_entry("Set xattr %s in xattr bucket\n", xi->xi_name);
+       trace_ocfs2_xattr_set_entry_bucket(xi->xi_name);
  
        ocfs2_init_xattr_bucket_xa_loc(&loc, xs->bucket,
                                       xs->not_found ? NULL : xs->here);
  
  
  out:
-       mlog_exit(ret);
        return ret;
  }
  
@@@ -5581,7 -5578,7 +5578,7 @@@ static int ocfs2_xattr_set_entry_index_
  {
        int ret;
  
-       mlog_entry("Set xattr %s in xattr index block\n", xi->xi_name);
+       trace_ocfs2_xattr_set_entry_index_block(xi->xi_name);
  
        ret = ocfs2_xattr_set_entry_bucket(inode, xi, xs, ctxt);
        if (!ret)
                mlog_errno(ret);
  
  out:
-       mlog_exit(ret);
        return ret;
  }
  
@@@ -6041,9 -6037,9 +6037,9 @@@ static int ocfs2_xattr_bucket_value_ref
        if (ocfs2_meta_ecc(OCFS2_SB(inode->i_sb)))
                p = &refcount;
  
-       mlog(0, "refcount bucket %llu, count = %u\n",
-            (unsigned long long)bucket_blkno(bucket),
-            le16_to_cpu(xh->xh_count));
+       trace_ocfs2_xattr_bucket_value_refcount(
+                               (unsigned long long)bucket_blkno(bucket),
+                               le16_to_cpu(xh->xh_count));
        for (i = 0; i < le16_to_cpu(xh->xh_count); i++) {
                xe = &xh->xh_entries[i];
  
@@@ -6339,8 -6335,8 +6335,8 @@@ static int ocfs2_reflink_xattr_header(h
        u32 clusters, cpos, p_cluster, num_clusters;
        unsigned int ext_flags = 0;
  
-       mlog(0, "reflink xattr in container %llu, count = %u\n",
-            (unsigned long long)old_bh->b_blocknr, le16_to_cpu(xh->xh_count));
+       trace_ocfs2_reflink_xattr_header((unsigned long long)old_bh->b_blocknr,
+                                        le16_to_cpu(xh->xh_count));
  
        last = &new_xh->xh_entries[le16_to_cpu(new_xh->xh_count)];
        for (i = 0, j = 0; i < le16_to_cpu(xh->xh_count); i++, j++) {
@@@ -6540,8 -6536,8 +6536,8 @@@ static int ocfs2_create_empty_xattr_blo
                goto out;
        }
  
-       mlog(0, "create new xattr block for inode %llu, index = %d\n",
-            (unsigned long long)fe_bh->b_blocknr, indexed);
+       trace_ocfs2_create_empty_xattr_block(
+                               (unsigned long long)fe_bh->b_blocknr, indexed);
        ret = ocfs2_create_xattr_block(inode, fe_bh, &ctxt, indexed,
                                       ret_bh);
        if (ret)
@@@ -6952,8 -6948,8 +6948,8 @@@ static int ocfs2_reflink_xattr_buckets(
                if (ret)
                        mlog_errno(ret);
  
-               mlog(0, "insert new xattr extent rec start %llu len %u to %u\n",
-                    (unsigned long long)new_blkno, num_clusters, reflink_cpos);
+               trace_ocfs2_reflink_xattr_buckets((unsigned long long)new_blkno,
+                                                 num_clusters, reflink_cpos);
  
                len -= num_clusters;
                blkno += ocfs2_clusters_to_blocks(inode->i_sb, num_clusters);
@@@ -6982,8 -6978,7 +6978,7 @@@ static int ocfs2_reflink_xattr_rec(stru
        struct ocfs2_alloc_context *data_ac = NULL;
        struct ocfs2_extent_tree et;
  
-       mlog(0, "reflink xattr buckets %llu len %u\n",
-            (unsigned long long)blkno, len);
+       trace_ocfs2_reflink_xattr_rec((unsigned long long)blkno, len);
  
        ocfs2_init_xattr_tree_extent_tree(&et,
                                          INODE_CACHE(args->reflink->new_inode),
@@@ -7185,8 -7180,7 +7180,8 @@@ out
   * must not hold any lock expect i_mutex.
   */
  int ocfs2_init_security_and_acl(struct inode *dir,
 -                              struct inode *inode)
 +                              struct inode *inode,
 +                              const struct qstr *qstr)
  {
        int ret = 0;
        struct buffer_head *dir_bh = NULL;
                .enable = 1,
        };
  
 -      ret = ocfs2_init_security_get(inode, dir, &si);
 +      ret = ocfs2_init_security_get(inode, dir, qstr, &si);
        if (!ret) {
                ret = ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_SECURITY,
                                      si.name, si.value, si.value_len,
@@@ -7262,14 -7256,13 +7257,14 @@@ static int ocfs2_xattr_security_set(str
  
  int ocfs2_init_security_get(struct inode *inode,
                            struct inode *dir,
 +                          const struct qstr *qstr,
                            struct ocfs2_security_xattr_info *si)
  {
        /* check whether ocfs2 support feature xattr */
        if (!ocfs2_supports_xattr(OCFS2_SB(dir->i_sb)))
                return -EOPNOTSUPP;
 -      return security_inode_init_security(inode, dir, &si->name, &si->value,
 -                                          &si->value_len);
 +      return security_inode_init_security(inode, dir, qstr, &si->name,
 +                                          &si->value, &si->value_len);
  }
  
  int ocfs2_init_security_set(handle_t *handle,