]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dtrace: improve io provider coverage
authorNicolas Droux <nicolas.droux@oracle.com>
Thu, 25 May 2017 21:22:32 +0000 (15:22 -0600)
committerNicolas Droux <nicolas.droux@oracle.com>
Sat, 27 May 2017 04:38:04 +0000 (22:38 -0600)
The DTrace io provider coverage is extended to include IO performed
through the Generic Block Layer (bio). It also adds io provider probes
to XFS.

Orabug: 25816537

Signed-off-by: Nicolas Droux <nicolas.droux@oracle.com>
Acked-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Shan Hai <shan.hai@oracle.com>
block/bio.c
block/blk-core.c
fs/buffer.c
fs/xfs/xfs_buf.c
include/linux/blk_types.h
include/linux/sdt.h

index cbce3e2208f4cb9b6cd83aaf1b699e437e9b004a..49a313b9807ec87bd6c6de08147de1f4c931ea97 100644 (file)
@@ -906,7 +906,11 @@ int submit_bio_wait(int rw, struct bio *bio)
        bio->bi_private = &ret;
        bio->bi_end_io = submit_bio_wait_endio;
        submit_bio(rw, bio);
+       DTRACE_IO(wait__start, struct bio * : (bufinfo_t *, devinfo_t *), bio,
+                 struct file * : fileinfo_t *, NULL);
        wait_for_completion(&ret.event);
+       DTRACE_IO(wait__done, struct bio * : (bufinfo_t *, devinfo_t *), bio,
+                 struct file * : fileinfo_t *, NULL);
 
        return ret.error;
 }
@@ -1784,6 +1788,10 @@ void bio_endio(struct bio *bio, int error)
                        bio_put(bio);
                        bio = parent;
                } else {
+                       DTRACE_IO(done, struct bio * :
+                                 (bufinfo_t *, devinfo_t *), bio,
+                                 struct file * : fileinfo_t *, NULL);
+
                        if (bio->bi_end_io)
                                bio->bi_end_io(bio, error);
                        bio = NULL;
index 1d1a050d28536cd5350e0b675db4408a85387f4e..538656a61b7b0049ebef160c4effb9d2ac577c61 100644 (file)
@@ -1699,9 +1699,6 @@ static inline void blk_partition_remap(struct bio *bio)
        if (bio_sectors(bio) && bdev != bdev->bd_contains) {
                struct hd_struct *p = bdev->bd_part;
 
-#ifdef CONFIG_DTRACE
-               bio->bi_bdev_orig = bdev;
-#endif
                bio->bi_iter.bi_sector += p->start_sect;
                bio->bi_bdev = bdev->bd_contains;
 
@@ -1874,9 +1871,13 @@ generic_make_request_checks(struct bio *bio)
                return false;   /* throttled, will be resubmitted later */
 
        trace_block_bio_queue(q, bio);
+       DTRACE_IO(start, struct bio * : (bufinfo_t *, devinfo_t *), bio,
+                 struct file * : fileinfo_t *, NULL);
        return true;
 
 end_io:
+       DTRACE_IO(start, struct bio * : (bufinfo_t *, devinfo_t *), bio,
+                 struct file * : fileinfo_t *, NULL);
        bio_endio(bio, err);
        return false;
 }
index 552bff810a1600481b83962d9a4aab37b8b25b40..c7a5602d01eed200912d3a90ca4ac6780209cb6f 100644 (file)
@@ -116,9 +116,7 @@ EXPORT_SYMBOL(buffer_check_dirty_writeback);
  */
 void __wait_on_buffer(struct buffer_head * bh)
 {
-       DTRACE_IO(wait__start, struct buffer_head * : (bufinfo_t *, devinfo_t *, fileinfo_t *), bh);
        wait_on_bit_io(&bh->b_state, BH_Lock, TASK_UNINTERRUPTIBLE);
-       DTRACE_IO(wait__done, struct buffer_head * : (bufinfo_t *, devinfo_t *, fileinfo_t *), bh);
 }
 EXPORT_SYMBOL(__wait_on_buffer);
 
@@ -2947,7 +2945,6 @@ static void end_bio_bh_io_sync(struct bio *bio, int err)
        if (unlikely (test_bit(BIO_QUIET,&bio->bi_flags)))
                set_bit(BH_Quiet, &bh->b_state);
 
-       DTRACE_IO(done, struct buffer_head * : (bufinfo_t *, devinfo_t *, fileinfo_t *), bh, int, bio->bi_rw);
        bh->b_end_io(bh, test_bit(BIO_UPTODATE, &bio->bi_flags));
        bio_put(bio);
 }
@@ -3045,8 +3042,6 @@ int _submit_bh(int rw, struct buffer_head *bh, unsigned long bio_flags)
                rw |= REQ_PRIO;
 
        bio_get(bio);
-       DTRACE_IO(start, struct buffer_head * : (bufinfo_t *, devinfo_t *,
-                                                fileinfo_t *), bh, int, rw);
        submit_bio(rw, bio);
 
        if (bio_flagged(bio, BIO_EOPNOTSUPP))
index b422a2a797a74ed9238ccc7d391c124ecddc1664..bb92da29b2c3e2e3c3504691774e188b5e2a06f6 100644 (file)
@@ -57,6 +57,18 @@ static kmem_zone_t *xfs_buf_zone;
 #define xb_to_gfp(flags) \
        ((((flags) & XBF_READ_AHEAD) ? __GFP_NORETRY : GFP_NOFS) | __GFP_NOWARN)
 
+#define        DTRACE_IO_XFS_WAIT(name, bp)                                    \
+       if (DTRACE_IO_ENABLED(name)) {                                  \
+               struct bio bio = {                                      \
+                       .bi_iter.bi_sector = (bp)->b_bn,                \
+                       .bi_iter.bi_size = (bp)->b_length,              \
+                       .bi_rw = ((bp)->b_flags & XBF_WRITE) != 0,      \
+                       .bi_bdev = (bp)->b_target->bt_bdev,             \
+               };                                                      \
+               DTRACE_IO(name, struct bio * : (bufinfo_t *,            \
+                         devinfo_t *), &bio,                           \
+                         struct file * : fileinfo_t *, NULL);          \
+       }
 
 static inline int
 xfs_buf_is_vmapped(
@@ -1407,7 +1419,9 @@ xfs_buf_submit_wait(
 
        /* wait for completion before gathering the error from the buffer */
        trace_xfs_buf_iowait(bp, _RET_IP_);
+       DTRACE_IO_XFS_WAIT(wait__start, bp);
        wait_for_completion(&bp->b_iowait);
+       DTRACE_IO_XFS_WAIT(wait__done, bp);
        trace_xfs_buf_iowait_done(bp, _RET_IP_);
        error = bp->b_error;
 
index 4b5f5e73553a9ec2cefc6da6b4e139fac8597cef..6d19dbaf9a78897efb6ed74705f9c00a016df6b0 100644 (file)
@@ -47,7 +47,7 @@ struct bio {
        struct bio              *bi_next;       /* request queue link */
        struct block_device     *bi_bdev;       /* bdev (possibly remapped) */
 #ifdef CONFIG_DTRACE
-       struct block_device     *bi_bdev_orig;  /* bdev before remapping */
+       struct block_device     *bi_bdev_orig;  /* for kABI compatibility */
 #endif
        unsigned long           bi_flags;       /* status, command, etc */
        unsigned long           bi_rw;          /* bottom bits READ/WRITE,
index d585ed612874ec40f2187c932ccbac8f92e9db17..68a31cecd5f276afa9a672d9f4649febe8260283 100644 (file)
@@ -101,6 +101,9 @@ typedef struct sdt_probedesc {
 #define        DTRACE_IO(name, ...)                                            \
        DTRACE_PROBE(__io_##name, ## __VA_ARGS__);
 
+#define        DTRACE_IO_ENABLED(name)                                         \
+       DTRACE_PROBE_ENABLED(__io_##name)
+
 #define        DTRACE_ISCSI(name, ...)                                         \
        DTRACE_PROBE(__iscsi_##name, ## __VA_ARGS__);