diff options
Diffstat (limited to 'block/blktrace.c')
-rw-r--r-- | block/blktrace.c | 38 |
1 files changed, 8 insertions, 30 deletions
diff --git a/block/blktrace.c b/block/blktrace.c index 7495a84353e4..9e0212c90b29 100644 --- a/block/blktrace.c +++ b/block/blktrace.c | |||
@@ -111,31 +111,9 @@ static int act_log_check(struct blk_trace *bt, u32 what, sector_t sector, | |||
111 | */ | 111 | */ |
112 | static u32 ddir_act[2] __read_mostly = { BLK_TC_ACT(BLK_TC_READ), BLK_TC_ACT(BLK_TC_WRITE) }; | 112 | static u32 ddir_act[2] __read_mostly = { BLK_TC_ACT(BLK_TC_READ), BLK_TC_ACT(BLK_TC_WRITE) }; |
113 | 113 | ||
114 | /* | 114 | /* The ilog2() calls fall out because they're constant */ |
115 | * Bio action bits of interest | 115 | #define MASK_TC_BIT(rw, __name) ( (rw & (1 << BIO_RW_ ## __name)) << \ |
116 | */ | 116 | (ilog2(BLK_TC_ ## __name) + BLK_TC_SHIFT - BIO_RW_ ## __name) ) |
117 | static 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 | }; | ||
124 | |||
125 | /* | ||
126 | * More could be added as needed, taking care to increment the decrementer | ||
127 | * to get correct indexing | ||
128 | */ | ||
129 | #define trace_barrier_bit(rw) \ | ||
130 | (((rw) & (1 << BIO_RW_BARRIER)) >> (BIO_RW_BARRIER - 0)) | ||
131 | #define trace_sync_bit(rw) \ | ||
132 | (((rw) & (1 << BIO_RW_SYNC)) >> (BIO_RW_SYNC - 1)) | ||
133 | #define trace_ahead_bit(rw) \ | ||
134 | (((rw) & (1 << BIO_RW_AHEAD)) << (2 - BIO_RW_AHEAD)) | ||
135 | #define trace_meta_bit(rw) \ | ||
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)) | ||
139 | 117 | ||
140 | /* | 118 | /* |
141 | * The worker for the various blk_add_trace*() types. Fills out a | 119 | * The worker for the various blk_add_trace*() types. Fills out a |
@@ -155,11 +133,11 @@ void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes, | |||
155 | return; | 133 | return; |
156 | 134 | ||
157 | what |= ddir_act[rw & WRITE]; | 135 | what |= ddir_act[rw & WRITE]; |
158 | what |= bio_act[trace_barrier_bit(rw)]; | 136 | what |= MASK_TC_BIT(rw, BARRIER); |
159 | what |= bio_act[trace_sync_bit(rw)]; | 137 | what |= MASK_TC_BIT(rw, SYNC); |
160 | what |= bio_act[trace_ahead_bit(rw)]; | 138 | what |= MASK_TC_BIT(rw, AHEAD); |
161 | what |= bio_act[trace_meta_bit(rw)]; | 139 | what |= MASK_TC_BIT(rw, META); |
162 | what |= bio_act[trace_discard_bit(rw)]; | 140 | what |= MASK_TC_BIT(rw, DISCARD); |
163 | 141 | ||
164 | pid = tsk->pid; | 142 | pid = tsk->pid; |
165 | if (unlikely(act_log_check(bt, what, sector, pid))) | 143 | if (unlikely(act_log_check(bt, what, sector, pid))) |