aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blktrace.c11
-rw-r--r--include/linux/blktrace_api.h4
2 files changed, 14 insertions, 1 deletions
diff --git a/block/blktrace.c b/block/blktrace.c
index eb9651ccb241..7495a84353e4 100644
--- a/block/blktrace.c
+++ b/block/blktrace.c
@@ -114,7 +114,13 @@ static u32 ddir_act[2] __read_mostly = { BLK_TC_ACT(BLK_TC_READ), BLK_TC_ACT(BLK
114/* 114/*
115 * Bio action bits of interest 115 * Bio action bits of interest
116 */ 116 */
117static u32 bio_act[9] __read_mostly = { 0, BLK_TC_ACT(BLK_TC_BARRIER), BLK_TC_ACT(BLK_TC_SYNC), 0, BLK_TC_ACT(BLK_TC_AHEAD), 0, 0, 0, BLK_TC_ACT(BLK_TC_META) }; 117static u32 bio_act[17] __read_mostly = {
118 [1] = BLK_TC_ACT(BLK_TC_BARRIER),
119 [2] = BLK_TC_ACT(BLK_TC_SYNC),
120 [4] = BLK_TC_ACT(BLK_TC_AHEAD),
121 [8] = BLK_TC_ACT(BLK_TC_META),
122 [16] = BLK_TC_ACT(BLK_TC_DISCARD)
123};
118 124
119/* 125/*
120 * More could be added as needed, taking care to increment the decrementer 126 * More could be added as needed, taking care to increment the decrementer
@@ -128,6 +134,8 @@ static u32 bio_act[9] __read_mostly = { 0, BLK_TC_ACT(BLK_TC_BARRIER), BLK_TC_AC
128 (((rw) & (1 << BIO_RW_AHEAD)) << (2 - BIO_RW_AHEAD)) 134 (((rw) & (1 << BIO_RW_AHEAD)) << (2 - BIO_RW_AHEAD))
129#define trace_meta_bit(rw) \ 135#define trace_meta_bit(rw) \
130 (((rw) & (1 << BIO_RW_META)) >> (BIO_RW_META - 3)) 136 (((rw) & (1 << BIO_RW_META)) >> (BIO_RW_META - 3))
137#define trace_discard_bit(rw) \
138 (((rw) & (1 << BIO_RW_DISCARD)) >> (BIO_RW_DISCARD - 4))
131 139
132/* 140/*
133 * The worker for the various blk_add_trace*() types. Fills out a 141 * The worker for the various blk_add_trace*() types. Fills out a
@@ -151,6 +159,7 @@ void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
151 what |= bio_act[trace_sync_bit(rw)]; 159 what |= bio_act[trace_sync_bit(rw)];
152 what |= bio_act[trace_ahead_bit(rw)]; 160 what |= bio_act[trace_ahead_bit(rw)];
153 what |= bio_act[trace_meta_bit(rw)]; 161 what |= bio_act[trace_meta_bit(rw)];
162 what |= bio_act[trace_discard_bit(rw)];
154 163
155 pid = tsk->pid; 164 pid = tsk->pid;
156 if (unlikely(act_log_check(bt, what, sector, pid))) 165 if (unlikely(act_log_check(bt, what, sector, pid)))
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index d084b8d227a5..27da2cc682ee 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -21,6 +21,7 @@ enum blktrace_cat {
21 BLK_TC_NOTIFY = 1 << 10, /* special message */ 21 BLK_TC_NOTIFY = 1 << 10, /* special message */
22 BLK_TC_AHEAD = 1 << 11, /* readahead */ 22 BLK_TC_AHEAD = 1 << 11, /* readahead */
23 BLK_TC_META = 1 << 12, /* metadata */ 23 BLK_TC_META = 1 << 12, /* metadata */
24 BLK_TC_DISCARD = 1 << 13, /* discard requests */
24 25
25 BLK_TC_END = 1 << 15, /* only 16-bits, reminder */ 26 BLK_TC_END = 1 << 15, /* only 16-bits, reminder */
26}; 27};
@@ -195,6 +196,9 @@ static inline void blk_add_trace_rq(struct request_queue *q, struct request *rq,
195 if (likely(!bt)) 196 if (likely(!bt))
196 return; 197 return;
197 198
199 if (blk_discard_rq(rq))
200 rw |= (1 << BIO_RW_DISCARD);
201
198 if (blk_pc_request(rq)) { 202 if (blk_pc_request(rq)) {
199 what |= BLK_TC_ACT(BLK_TC_PC); 203 what |= BLK_TC_ACT(BLK_TC_PC);
200 __blk_add_trace(bt, 0, rq->data_len, rw, what, rq->errors, sizeof(rq->cmd), rq->cmd); 204 __blk_add_trace(bt, 0, rq->data_len, rw, what, rq->errors, sizeof(rq->cmd), rq->cmd);