X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=instrumentation%2Fevents%2Flttng-module%2Fblock.h;h=6782cbbef08c53a37a33534ed2a393c0d2067400;hb=1bc491fcc45224300df6ac10a1c5745aa299b6ab;hp=3c75e4f49863b8fb106ea91c32f1711dc67fcdde;hpb=f62b389ebaba6abc93afb2cf9fbdf2fe0b632077;p=lttng-modules.git diff --git a/instrumentation/events/lttng-module/block.h b/instrumentation/events/lttng-module/block.h index 3c75e4f4..6782cbbe 100644 --- a/instrumentation/events/lttng-module/block.h +++ b/instrumentation/events/lttng-module/block.h @@ -8,6 +8,9 @@ #include #include #include +#include + +#define RWBS_LEN 8 #ifndef _TRACE_BLOCK_DEF_ #define _TRACE_BLOCK_DEF_ @@ -19,23 +22,45 @@ enum { RWBS_FLAG_DISCARD = (1 << 1), RWBS_FLAG_READ = (1 << 2), RWBS_FLAG_RAHEAD = (1 << 3), - RWBS_FLAG_SYNC = (1 << 4), - RWBS_FLAG_META = (1 << 5), - RWBS_FLAG_SECURE = (1 << 6), + RWBS_FLAG_BARRIER = (1 << 4), + RWBS_FLAG_SYNC = (1 << 5), + RWBS_FLAG_META = (1 << 6), + RWBS_FLAG_SECURE = (1 << 7), + RWBS_FLAG_FLUSH = (1 << 8), + RWBS_FLAG_FUA = (1 << 9), }; #endif /* _TRACE_BLOCK_DEF_ */ #define __print_rwbs_flags(rwbs) \ __print_flags(rwbs, "", \ + { RWBS_FLAG_FLUSH, "F" }, \ { RWBS_FLAG_WRITE, "W" }, \ { RWBS_FLAG_DISCARD, "D" }, \ { RWBS_FLAG_READ, "R" }, \ + { RWBS_FLAG_FUA, "F" }, \ { RWBS_FLAG_RAHEAD, "A" }, \ + { RWBS_FLAG_BARRIER, "B" }, \ { RWBS_FLAG_SYNC, "S" }, \ { RWBS_FLAG_META, "M" }, \ { RWBS_FLAG_SECURE, "E" }) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) + +#define blk_fill_rwbs(rwbs, rw, bytes) \ + tp_assign(rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ + ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \ + ( (bytes) ? RWBS_FLAG_READ : \ + ( 0 )))) \ + | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \ + | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \ + | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ + | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \ + | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \ + | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0)) + +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + #define blk_fill_rwbs(rwbs, rw, bytes) \ tp_assign(rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \ @@ -46,6 +71,33 @@ enum { | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0)) +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) + +#define blk_fill_rwbs(rwbs, rw, bytes) \ + tp_assign(rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ + ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \ + ( (bytes) ? RWBS_FLAG_READ : \ + ( 0 )))) \ + | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \ + | ((rw) & REQ_HARDBARRIER ? RWBS_FLAG_BARRIER : 0) \ + | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \ + | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ + | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0)) + +#else + +#define blk_fill_rwbs(rwbs, rw, bytes) \ + tp_assign(rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ + ( (rw) & (1 << BIO_RW_DISCARD) ? RWBS_FLAG_DISCARD : \ + ( (bytes) ? RWBS_FLAG_READ : \ + ( 0 )))) \ + | ((rw) & (1 << BIO_RW_AHEAD) ? RWBS_FLAG_RAHEAD : 0) \ + | ((rw) & (1 << BIO_RW_SYNCIO) ? RWBS_FLAG_SYNC : 0) \ + | ((rw) & (1 << BIO_RW_META) ? RWBS_FLAG_META : 0) \ + | ((rw) & (1 << BIO_RW_BARRIER) ? RWBS_FLAG_BARRIER : 0)) + +#endif + DECLARE_EVENT_CLASS(block_rq_with_error, TP_PROTO(struct request_queue *q, struct request *rq), @@ -58,7 +110,9 @@ DECLARE_EVENT_CLASS(block_rq_with_error, __field( unsigned int, nr_sector ) __field( int, errors ) __field( unsigned int, rwbs ) - __dynamic_array( char, cmd, blk_cmd_buf_len(rq) ) + __dynamic_array_hex( unsigned char, cmd, + (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? + rq->cmd_len : 0) ), TP_fast_assign( @@ -69,7 +123,8 @@ DECLARE_EVENT_CLASS(block_rq_with_error, 0 : blk_rq_sectors(rq)) tp_assign(errors, rq->errors) blk_fill_rwbs(rwbs, rq->cmd_flags, blk_rq_bytes(rq)) - tp_memcpy_dyn(cmd, rq->cmd, blk_cmd_buf_len(rq)) + tp_memcpy_dyn(cmd, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? + rq->cmd : NULL); ), TP_printk("%d,%d %s (%s) %llu + %u [%d]", @@ -144,8 +199,10 @@ DECLARE_EVENT_CLASS(block_rq, __field( unsigned int, nr_sector ) __field( unsigned int, bytes ) __field( unsigned int, rwbs ) - __array( char, comm, TASK_COMM_LEN ) - __dynamic_array( char, cmd, blk_cmd_buf_len(rq) ) + __array_text( char, comm, TASK_COMM_LEN ) + __dynamic_array_hex( unsigned char, cmd, + (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? + rq->cmd_len : 0) ), TP_fast_assign( @@ -157,7 +214,8 @@ DECLARE_EVENT_CLASS(block_rq, tp_assign(bytes, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? blk_rq_bytes(rq) : 0) blk_fill_rwbs(rwbs, rq->cmd_flags, blk_rq_bytes(rq)) - tp_memcpy_dyn(cmd, rq->cmd, blk_cmd_buf_len(rq)) + tp_memcpy_dyn(cmd, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? + rq->cmd : NULL); tp_memcpy(comm, current->comm, TASK_COMM_LEN) ), @@ -225,7 +283,7 @@ TRACE_EVENT(block_bio_bounce, __field( sector_t, sector ) __field( unsigned int, nr_sector ) __field( unsigned int, rwbs ) - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) ), TP_fast_assign( @@ -255,9 +313,15 @@ TRACE_EVENT(block_bio_bounce, */ TRACE_EVENT(block_bio_complete, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) TP_PROTO(struct request_queue *q, struct bio *bio, int error), TP_ARGS(q, bio, error), +#else + TP_PROTO(struct request_queue *q, struct bio *bio), + + TP_ARGS(q, bio), +#endif TP_STRUCT__entry( __field( dev_t, dev ) @@ -271,7 +335,11 @@ TRACE_EVENT(block_bio_complete, tp_assign(dev, bio->bi_bdev->bd_dev) tp_assign(sector, bio->bi_sector) tp_assign(nr_sector, bio->bi_size >> 9) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) tp_assign(error, error) +#else + tp_assign(error, 0) +#endif blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) ), @@ -293,7 +361,7 @@ DECLARE_EVENT_CLASS(block_bio, __field( sector_t, sector ) __field( unsigned int, nr_sector ) __field( unsigned int, rwbs ) - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) ), TP_fast_assign( @@ -321,9 +389,15 @@ DECLARE_EVENT_CLASS(block_bio, */ DEFINE_EVENT(block_bio, block_bio_backmerge, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) + TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), + + TP_ARGS(q, rq, bio) +#else TP_PROTO(struct request_queue *q, struct bio *bio), TP_ARGS(q, bio) +#endif ) /** @@ -336,9 +410,15 @@ DEFINE_EVENT(block_bio, block_bio_backmerge, */ DEFINE_EVENT(block_bio, block_bio_frontmerge, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) + TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), + + TP_ARGS(q, rq, bio) +#else TP_PROTO(struct request_queue *q, struct bio *bio), TP_ARGS(q, bio) +#endif ) /** @@ -366,7 +446,7 @@ DECLARE_EVENT_CLASS(block_get_rq, __field( sector_t, sector ) __field( unsigned int, nr_sector ) __field( unsigned int, rwbs ) - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) ), TP_fast_assign( @@ -434,7 +514,7 @@ TRACE_EVENT(block_plug, TP_ARGS(q), TP_STRUCT__entry( - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) ), TP_fast_assign( @@ -446,23 +526,49 @@ TRACE_EVENT(block_plug, DECLARE_EVENT_CLASS(block_unplug, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), TP_ARGS(q, depth, explicit), +#else + TP_PROTO(struct request_queue *q), + + TP_ARGS(q), +#endif TP_STRUCT__entry( __field( int, nr_rq ) - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) ), TP_fast_assign( +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) tp_assign(nr_rq, depth) +#else + tp_assign(nr_rq, q->rq.count[READ] + q->rq.count[WRITE]) +#endif tp_memcpy(comm, current->comm, TASK_COMM_LEN) ), TP_printk("[%s] %d", __entry->comm, __entry->nr_rq) ) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) +/** + * block_unplug_timer - timed release of operations requests in queue to device driver + * @q: request queue to unplug + * + * Unplug the request queue @q because a timer expired and allow block + * operation requests to be sent to the device driver. + */ +DEFINE_EVENT(block_unplug, block_unplug_timer, + + TP_PROTO(struct request_queue *q), + + TP_ARGS(q) +) +#endif + /** * block_unplug - release of operations requests in request queue * @q: request queue to unplug @@ -472,11 +578,21 @@ DECLARE_EVENT_CLASS(block_unplug, * Unplug request queue @q because device driver is scheduled to work * on elements in the request queue. */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) DEFINE_EVENT(block_unplug, block_unplug, +#else +DEFINE_EVENT(block_unplug, block_unplug_io, +#endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), TP_ARGS(q, depth, explicit) +#else + TP_PROTO(struct request_queue *q), + + TP_ARGS(q) +#endif ) /** @@ -502,7 +618,7 @@ TRACE_EVENT(block_split, __field( sector_t, sector ) __field( sector_t, new_sector ) __field( unsigned int, rwbs ) - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) ), TP_fast_assign( @@ -531,7 +647,11 @@ TRACE_EVENT(block_split, * An operation for a logical device has been mapped to the * raw block device. */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) TRACE_EVENT(block_bio_remap, +#else +TRACE_EVENT(block_remap, +#endif TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev, sector_t from), @@ -565,6 +685,7 @@ TRACE_EVENT(block_bio_remap, (unsigned long long)__entry->old_sector) ) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) /** * block_rq_remap - map request for a block operation request * @q: queue holding the operation @@ -609,6 +730,7 @@ TRACE_EVENT(block_rq_remap, MAJOR(__entry->old_dev), MINOR(__entry->old_dev), (unsigned long long)__entry->old_sector) ) +#endif #undef __print_rwbs_flags #undef blk_fill_rwbs @@ -616,5 +738,5 @@ TRACE_EVENT(block_rq_remap, #endif /* _TRACE_BLOCK_H */ /* This part must be outside protection */ -#include "define_trace.h" +#include "../../../probes/define_trace.h"