From: Liu Bo <bo.li.liu@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: Chris Mason <clm@fb.com>, Jan Kara <jack@suse.cz>,
David Sterba <dsterba@suse.cz>
Subject: [PATCH 6/6] Btrfs: add tracepoint for btrfs_get_blocks_dax_fault
Date: Wed, 7 Dec 2016 13:45:10 -0800 [thread overview]
Message-ID: <1481147110-20048-7-git-send-email-bo.li.liu@oracle.com> (raw)
In-Reply-To: <1481147110-20048-1-git-send-email-bo.li.liu@oracle.com>
These TPs can help us monitor iomap content for dax reads and writes.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
fs/btrfs/inode.c | 9 ++++
include/trace/events/btrfs.h | 106 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 115 insertions(+)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 9851422..b5bee38 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8067,6 +8067,8 @@ btrfs_get_blocks_dax_fault(struct inode *inode, u64 start, u64 len,
struct extent_map *em;
int ret = 0;
+ trace_btrfs_get_blocks_dax_entry(inode, start, len, create);
+
if (!create && start >= i_size_read(inode)) {
return 0;
}
@@ -8190,12 +8192,19 @@ btrfs_get_blocks_dax_fault(struct inode *inode, u64 start, u64 len,
map_block:
ret = btrfs_em_to_iomap(root->fs_info, start, len, em, create, iomap);
+ if (!ret) {
+ if (create)
+ trace_btrfs_iomap_alloc(inode, start, len, iomap);
+ else
+ trace_btrfs_iomap_found(inode, start, len, iomap);
+ }
out:
free_extent_map(em);
ASSERT(lockstart < lockend);
unlock_extent_cached(&BTRFS_I(inode)->io_tree, lockstart, lockend, &cached_state, GFP_NOFS);
+ trace_btrfs_get_blocks_dax_exit(inode, start, len, create);
return ret;
}
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 0e04208..f7eb44f 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -7,6 +7,7 @@
#include <linux/writeback.h>
#include <linux/tracepoint.h>
#include <trace/events/mmflags.h>
+#include <linux/iomap.h>
struct btrfs_root;
struct btrfs_fs_info;
@@ -1471,6 +1472,111 @@ TRACE_EVENT(qgroup_update_counters,
__entry->cur_new_count)
);
+DECLARE_EVENT_CLASS(btrfs_iomap_class,
+
+ TP_PROTO(struct inode *inode, u64 offset, u64 len, struct iomap *iomap),
+
+ TP_ARGS(inode, offset, len, iomap),
+
+ TP_STRUCT__entry_btrfs(
+ __field( u64, ino )
+ __field( u64, isize )
+ __field( u64, disk_isize )
+ __field( u64, root_objectid )
+ __field( u64, offset )
+ __field( u64, len )
+ __field( u64, startoff )
+ __field( u64, blockstart )
+ __field( u64, blocklen )
+ __field( int, type )
+ ),
+
+ TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
+ __entry->ino = btrfs_ino(inode);
+ __entry->isize = i_size_read(inode);
+ __entry->disk_isize = BTRFS_I(inode)->disk_i_size;
+ __entry->root_objectid =
+ BTRFS_I(inode)->root->root_key.objectid;
+ __entry->offset = offset;
+ __entry->len = len;
+ __entry->startoff = iomap ? iomap->offset : 0;
+ __entry->blockstart = iomap ? (iomap->blkno << 9) : 0;
+ __entry->blocklen = iomap ? iomap->length : 0;
+ __entry->type = iomap ? iomap->type : 0;
+ ),
+
+ TP_printk_btrfs("root 0x%llx(%s) ino 0x%llx size 0x%llx "
+ "disk_isize 0x%llx offset 0x%llx len 0x%llx "
+ "startoff 0x%llx blockstart %llu blocklen 0x%llx "
+ " type %d",
+ show_root_type(__entry->root_objectid),
+ __entry->ino,
+ __entry->isize,
+ __entry->disk_isize,
+ __entry->offset,
+ __entry->len,
+ __entry->startoff,
+ __entry->blockstart,
+ __entry->blocklen,
+ __entry->type)
+);
+
+#define DEFINE_IOMAP_EVENT(name) \
+DEFINE_EVENT(btrfs_iomap_class, name, \
+ TP_PROTO(struct inode *inode, u64 offset, u64 len, \
+ struct iomap *iomap), \
+ TP_ARGS(inode, offset, len, iomap));
+
+DEFINE_IOMAP_EVENT(btrfs_iomap_alloc)
+DEFINE_IOMAP_EVENT(btrfs_iomap_found)
+
+DECLARE_EVENT_CLASS(btrfs_get_blocks_dax,
+
+ TP_PROTO(struct inode *inode, u64 offset, u64 len, int create),
+
+ TP_ARGS(inode, offset, len, create),
+
+ TP_STRUCT__entry_btrfs(
+ __field( u64, root_objectid )
+ __field( u64, ino )
+ __field( u64, isize )
+ __field( u64, disk_isize )
+ __field( u64, offset )
+ __field( u64, len )
+ __field( int, create )
+ ),
+
+ TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
+ __entry->root_objectid = BTRFS_I(inode)->root->objectid;
+ __entry->ino = btrfs_ino(inode);
+ __entry->isize = i_size_read(inode);
+ __entry->disk_isize = BTRFS_I(inode)->disk_i_size;
+ __entry->offset = offset;
+ __entry->len = len;
+ __entry->create = create;
+ ),
+
+ TP_printk_btrfs("root 0x%llx(%s) ino 0x%llx isize 0x%llx "
+ "disk_isize 0x%llx offset 0x%llx len 0x%llx create %d",
+ show_root_type(__entry->root_objectid),
+ __entry->ino,
+ __entry->isize,
+ __entry->disk_isize,
+ __entry->offset,
+ __entry->len,
+ __entry->create
+ )
+);
+
+#define DEFINE_GETBLOCKS_DAX_EVENT(name) \
+DEFINE_EVENT(btrfs_get_blocks_dax, name, \
+ TP_PROTO(struct inode *inode, u64 offset, u64 len, \
+ int create), \
+ TP_ARGS(inode, offset, len, create));
+
+DEFINE_GETBLOCKS_DAX_EVENT(btrfs_get_blocks_dax_entry)
+DEFINE_GETBLOCKS_DAX_EVENT(btrfs_get_blocks_dax_exit)
+
#endif /* _TRACE_BTRFS_H */
/* This part must be outside protection */
--
2.5.5
prev parent reply other threads:[~2016-12-07 21:37 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-07 21:45 [PATCH 0/6] btrfs dax IO Liu Bo
2016-12-07 21:45 ` [PATCH 1/6] Btrfs: add mount option for dax Liu Bo
2016-12-08 2:44 ` kbuild test robot
2016-12-09 4:47 ` Dave Chinner
2016-12-09 18:41 ` Liu Bo
2016-12-09 21:58 ` Dave Chinner
2016-12-07 21:45 ` [PATCH 2/6] Btrfs: set single device limit for dax usecase Liu Bo
2016-12-08 13:35 ` David Sterba
2016-12-08 15:19 ` Liu Bo
2016-12-07 21:45 ` [PATCH 3/6] Btrfs: refactor btrfs_file_write_iter Liu Bo
2016-12-08 0:44 ` kbuild test robot
2016-12-07 21:45 ` [PATCH 4/6] Btrfs: add DAX support for nocow btrfs Liu Bo
2016-12-07 22:15 ` Chris Mason
2016-12-07 22:51 ` Liu Bo
2016-12-08 10:47 ` Jan Kara
2016-12-08 16:45 ` Liu Bo
2016-12-09 12:31 ` Jan Kara
2016-12-09 18:38 ` Liu Bo
2016-12-08 1:16 ` kbuild test robot
2016-12-08 2:19 ` Janos Toth F.
2016-12-08 2:30 ` kbuild test robot
2016-12-09 5:13 ` Dave Chinner
2016-12-09 14:23 ` Chris Mason
2016-12-07 21:45 ` [PATCH 5/6] Btrfs: add mmap_sem to avoid race between page faults and truncate/hole_punch Liu Bo
2016-12-07 21:45 ` Liu Bo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1481147110-20048-7-git-send-email-bo.li.liu@oracle.com \
--to=bo.li.liu@oracle.com \
--cc=clm@fb.com \
--cc=dsterba@suse.cz \
--cc=jack@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).