f2fs: show actual device info in tracepoints
authorJaegeuk Kim <jaegeuk@kernel.org>
Wed, 15 Feb 2017 19:14:06 +0000 (11:14 -0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 23 Feb 2017 19:23:24 +0000 (11:23 -0800)
This patch shows actual device information in the tracepoints.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/segment.c
include/trace/events/f2fs.h

index 0b42b0cdd674ff746166c0b5ddc969f596916965..68db07f857f899c25023e6e6dfa21b55ce03dc52 100644 (file)
@@ -426,11 +426,11 @@ static int submit_flush_wait(struct f2fs_sb_info *sbi)
        int ret = __submit_flush_wait(sbi->sb->s_bdev);
        int i;
 
-       trace_f2fs_issue_flush(sbi->sb, test_opt(sbi, NOBARRIER),
-                                       test_opt(sbi, FLUSH_MERGE));
-
        if (sbi->s_ndevs && !ret) {
                for (i = 1; i < sbi->s_ndevs; i++) {
+                       trace_f2fs_issue_flush(FDEV(i).bdev,
+                                       test_opt(sbi, NOBARRIER),
+                                       test_opt(sbi, FLUSH_MERGE));
                        ret = __submit_flush_wait(FDEV(i).bdev);
                        if (ret)
                                break;
@@ -758,7 +758,7 @@ static int __f2fs_issue_discard_async(struct f2fs_sb_info *sbi,
        block_t lblkstart = blkstart;
        int err;
 
-       trace_f2fs_issue_discard(sbi->sb, blkstart, blklen);
+       trace_f2fs_issue_discard(bdev, blkstart, blklen);
 
        if (sbi->s_ndevs) {
                int devi = f2fs_target_device_index(sbi, blkstart);
@@ -815,7 +815,7 @@ static int __f2fs_issue_discard_zone(struct f2fs_sb_info *sbi,
                return __f2fs_issue_discard_async(sbi, bdev, blkstart, blklen);
        case BLK_ZONE_TYPE_SEQWRITE_REQ:
        case BLK_ZONE_TYPE_SEQWRITE_PREF:
-               trace_f2fs_issue_reset_zone(sbi->sb, blkstart);
+               trace_f2fs_issue_reset_zone(bdev, blkstart);
                return blkdev_reset_zones(bdev, sector,
                                          nr_sects, GFP_NOFS);
        default:
index 82236792b50cb6f356224f21cdb4ed56d71cb077..153572e256d68301d24f659dc6b9c05481cbfd6b 100644 (file)
@@ -6,8 +6,8 @@
 
 #include <linux/tracepoint.h>
 
-#define show_dev(entry)                MAJOR(entry->dev), MINOR(entry->dev)
-#define show_dev_ino(entry)    show_dev(entry), (unsigned long)entry->ino
+#define show_dev(dev)          MAJOR(dev), MINOR(dev)
+#define show_dev_ino(entry)    show_dev(entry->dev), (unsigned long)entry->ino
 
 TRACE_DEFINE_ENUM(NODE);
 TRACE_DEFINE_ENUM(DATA);
@@ -245,7 +245,7 @@ TRACE_EVENT(f2fs_sync_fs,
        ),
 
        TP_printk("dev = (%d,%d), superblock is %s, wait = %d",
-               show_dev(__entry),
+               show_dev(__entry->dev),
                __entry->dirty ? "dirty" : "not dirty",
                __entry->wait)
 );
@@ -544,7 +544,7 @@ TRACE_EVENT(f2fs_background_gc,
        ),
 
        TP_printk("dev = (%d,%d), wait_ms = %ld, prefree = %u, free = %u",
-               show_dev(__entry),
+               show_dev(__entry->dev),
                __entry->wait_ms,
                __entry->prefree,
                __entry->free)
@@ -586,7 +586,7 @@ TRACE_EVENT(f2fs_get_victim,
 
        TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), victim = %u "
                "ofs_unit = %u, pre_victim_secno = %d, prefree = %u, free = %u",
-               show_dev(__entry),
+               show_dev(__entry->dev),
                show_data_type(__entry->type),
                show_gc_type(__entry->gc_type),
                show_alloc_mode(__entry->alloc_mode),
@@ -723,7 +723,7 @@ TRACE_EVENT(f2fs_reserve_new_blocks,
        ),
 
        TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u, count = %llu",
-               show_dev(__entry),
+               show_dev(__entry->dev),
                (unsigned int)__entry->nid,
                __entry->ofs_in_node,
                (unsigned long long)__entry->count)
@@ -793,6 +793,7 @@ DECLARE_EVENT_CLASS(f2fs__bio,
 
        TP_STRUCT__entry(
                __field(dev_t,  dev)
+               __field(dev_t,  target)
                __field(int,    op)
                __field(int,    op_flags)
                __field(int,    type)
@@ -802,6 +803,7 @@ DECLARE_EVENT_CLASS(f2fs__bio,
 
        TP_fast_assign(
                __entry->dev            = sb->s_dev;
+               __entry->target         = bio->bi_bdev->bd_dev;
                __entry->op             = bio_op(bio);
                __entry->op_flags       = bio->bi_opf;
                __entry->type           = type;
@@ -809,8 +811,9 @@ DECLARE_EVENT_CLASS(f2fs__bio,
                __entry->size           = bio->bi_iter.bi_size;
        ),
 
-       TP_printk("dev = (%d,%d), rw = %s%s, %s, sector = %lld, size = %u",
-               show_dev(__entry),
+       TP_printk("dev = (%d,%d)/(%d,%d), rw = %s%s, %s, sector = %lld, size = %u",
+               show_dev(__entry->target),
+               show_dev(__entry->dev),
                show_bio_type(__entry->op, __entry->op_flags),
                show_block_type(__entry->type),
                (unsigned long long)__entry->sector,
@@ -1107,16 +1110,16 @@ TRACE_EVENT(f2fs_write_checkpoint,
        ),
 
        TP_printk("dev = (%d,%d), checkpoint for %s, state = %s",
-               show_dev(__entry),
+               show_dev(__entry->dev),
                show_cpreason(__entry->reason),
                __entry->msg)
 );
 
 TRACE_EVENT(f2fs_issue_discard,
 
-       TP_PROTO(struct super_block *sb, block_t blkstart, block_t blklen),
+       TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
 
-       TP_ARGS(sb, blkstart, blklen),
+       TP_ARGS(dev, blkstart, blklen),
 
        TP_STRUCT__entry(
                __field(dev_t,  dev)
@@ -1125,22 +1128,22 @@ TRACE_EVENT(f2fs_issue_discard,
        ),
 
        TP_fast_assign(
-               __entry->dev    = sb->s_dev;
+               __entry->dev    = dev->bd_dev;
                __entry->blkstart = blkstart;
                __entry->blklen = blklen;
        ),
 
        TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx",
-               show_dev(__entry),
+               show_dev(__entry->dev),
                (unsigned long long)__entry->blkstart,
                (unsigned long long)__entry->blklen)
 );
 
 TRACE_EVENT(f2fs_issue_reset_zone,
 
-       TP_PROTO(struct super_block *sb, block_t blkstart),
+       TP_PROTO(struct block_device *dev, block_t blkstart),
 
-       TP_ARGS(sb, blkstart),
+       TP_ARGS(dev, blkstart),
 
        TP_STRUCT__entry(
                __field(dev_t,  dev)
@@ -1148,21 +1151,21 @@ TRACE_EVENT(f2fs_issue_reset_zone,
        ),
 
        TP_fast_assign(
-               __entry->dev    = sb->s_dev;
+               __entry->dev    = dev->bd_dev;
                __entry->blkstart = blkstart;
        ),
 
        TP_printk("dev = (%d,%d), reset zone at block = 0x%llx",
-               show_dev(__entry),
+               show_dev(__entry->dev),
                (unsigned long long)__entry->blkstart)
 );
 
 TRACE_EVENT(f2fs_issue_flush,
 
-       TP_PROTO(struct super_block *sb, unsigned int nobarrier,
+       TP_PROTO(struct block_device *dev, unsigned int nobarrier,
                                        unsigned int flush_merge),
 
-       TP_ARGS(sb, nobarrier, flush_merge),
+       TP_ARGS(dev, nobarrier, flush_merge),
 
        TP_STRUCT__entry(
                __field(dev_t,  dev)
@@ -1171,13 +1174,13 @@ TRACE_EVENT(f2fs_issue_flush,
        ),
 
        TP_fast_assign(
-               __entry->dev    = sb->s_dev;
+               __entry->dev    = dev->bd_dev;
                __entry->nobarrier = nobarrier;
                __entry->flush_merge = flush_merge;
        ),
 
        TP_printk("dev = (%d,%d), %s %s",
-               show_dev(__entry),
+               show_dev(__entry->dev),
                __entry->nobarrier ? "skip (nobarrier)" : "issue",
                __entry->flush_merge ? " with flush_merge" : "")
 );
@@ -1292,7 +1295,7 @@ TRACE_EVENT(f2fs_shrink_extent_tree,
        ),
 
        TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u",
-               show_dev(__entry),
+               show_dev(__entry->dev),
                __entry->node_cnt,
                __entry->tree_cnt)
 );
@@ -1339,7 +1342,7 @@ DECLARE_EVENT_CLASS(f2fs_sync_dirty_inodes,
        ),
 
        TP_printk("dev = (%d,%d), %s, dirty count = %lld",
-               show_dev(__entry),
+               show_dev(__entry->dev),
                show_file_type(__entry->type),
                __entry->count)
 );