Skip to content

Commit 501f4c9

Browse files
committed
Debug request tracing
Signed-off-by: Michal Mielewczyk <[email protected]>
1 parent 1ab882a commit 501f4c9

File tree

14 files changed

+74
-2
lines changed

14 files changed

+74
-2
lines changed

src/engine/cache_engine.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ enum ocf_io_if_type {
4141
OCF_IO_FAST_IF,
4242
OCF_IO_FLUSH_IF,
4343
OCF_IO_DISCARD_IF,
44+
OCF_IO_REFRESH_IF,
45+
OCF_IO_INVALIDATE_IF,
46+
OCF_IO_RD_IF,
4447
OCF_IO_PRIV_MAX_IF,
4548
};
4649

@@ -108,6 +111,18 @@ static const struct ocf_io_if IO_IFS[OCF_IO_PRIV_MAX_IF] = {
108111
},
109112
.name = "Discard",
110113
},
114+
[OCF_IO_REFRESH_IF] = {
115+
.cbs = { },
116+
.name = "Refresh",
117+
},
118+
[OCF_IO_INVALIDATE_IF] = {
119+
.cbs = { },
120+
.name = "Invalidate",
121+
},
122+
[OCF_IO_RD_IF] = {
123+
.cbs = { },
124+
.name = "Read generic",
125+
},
111126
};
112127

113128
static const struct ocf_io_if *cache_mode_io_if_map[ocf_req_cache_mode_max] = {
@@ -118,8 +133,29 @@ static const struct ocf_io_if *cache_mode_io_if_map[ocf_req_cache_mode_max] = {
118133
[ocf_req_cache_mode_wo] = &IO_IFS[OCF_IO_WO_IF],
119134
[ocf_req_cache_mode_pt] = &IO_IFS[OCF_IO_PT_IF],
120135
[ocf_req_cache_mode_fast] = &IO_IFS[OCF_IO_FAST_IF],
136+
[ocf_req_refresh] = &IO_IFS[OCF_IO_REFRESH_IF],
137+
[ocf_req_cache_mode_discard] = &IO_IFS[OCF_IO_DISCARD_IF],
138+
[ocf_req_cache_mode_invalidate] = &IO_IFS[OCF_IO_INVALIDATE_IF],
139+
[ocf_req_cache_mode_rd] = &IO_IFS[OCF_IO_RD_IF],
121140
};
122141

142+
void ocf_debug_request_trace(struct ocf_request *req,
143+
ocf_req_cache_mode_t engine, uint8_t info)
144+
{
145+
uint8_t tmp = (uint8_t)engine;
146+
147+
ENV_BUG_ON(info > 0xf);
148+
ENV_BUG_ON(engine > 0xf);
149+
150+
ENV_WARN_ON(req->engine_trace & 0xff00000000000000);
151+
152+
req->engine_trace <<= 4;
153+
req->engine_trace |= engine;
154+
155+
req->engine_trace <<= 4;
156+
req->engine_trace |= tmp;
157+
}
158+
123159
const char *ocf_get_io_iface_name(ocf_req_cache_mode_t cache_mode)
124160
{
125161
if (cache_mode == ocf_req_cache_mode_max)

src/engine/cache_engine.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,7 @@ void ocf_engine_hndl_flush_req(struct ocf_request *req);
4747

4848
void ocf_engine_hndl_discard_req(struct ocf_request *req);
4949

50+
void ocf_debug_request_trace(struct ocf_request *req,
51+
ocf_req_cache_mode_t engine, uint8_t info);
52+
5053
#endif

src/engine/engine_common.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,8 @@ static int _ocf_engine_refresh(struct ocf_request *req)
599599
{
600600
int result;
601601

602+
ocf_debug_request_trace(req, ocf_req_refresh, 0);
603+
602604
/* Check under metadata RD lock */
603605
ocf_hb_req_prot_lock_rd(req);
604606

src/engine/engine_discard.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ int ocf_engine_discard(struct ocf_request *req)
211211
/* Get OCF request - increase reference counter */
212212
ocf_req_get(req);
213213

214+
ocf_debug_request_trace(req, ocf_req_cache_mode_discard, 0);
215+
214216
_ocf_discard_step(req);
215217

216218
/* Put OCF request - decrease reference counter */

src/engine/engine_fast.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ int ocf_read_fast(struct ocf_request *req)
9999
/* Get OCF request - increase reference counter */
100100
ocf_req_get(req);
101101

102+
ocf_debug_request_trace(req, ocf_req_cache_mode_fast, 0);
103+
102104
/* Set resume handler */
103105
req->engine_handler = _ocf_read_fast_do;
104106

@@ -165,6 +167,8 @@ int ocf_write_fast(struct ocf_request *req)
165167
/* Get OCF request - increase reference counter */
166168
ocf_req_get(req);
167169

170+
ocf_debug_request_trace(req, ocf_req_cache_mode_fast, 1);
171+
168172
/* Set resume handler */
169173
req->engine_handler = ocf_write_wb_do;
170174

src/engine/engine_inv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ static int _ocf_invalidate_do(struct ocf_request *req)
4040
ocf_purge_map_info(req);
4141
ocf_hb_req_prot_unlock_wr(req);
4242

43+
ocf_debug_request_trace(req, ocf_req_cache_mode_invalidate, 0);
44+
4345
if (ocf_volume_is_atomic(&cache->device->volume) &&
4446
req->info.flush_metadata) {
4547
/* Metadata flush IO */

src/engine/engine_pt.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ int ocf_read_pt_do(struct ocf_request *req)
4747
/* Get OCF request - increase reference counter */
4848
ocf_req_get(req);
4949

50+
ocf_debug_request_trace(req, ocf_req_cache_mode_pt, 0);
51+
5052
if (req->info.dirty_any) {
5153
ocf_hb_req_prot_lock_rd(req);
5254
/* Need to clean, start it */
@@ -97,10 +99,11 @@ int ocf_read_pt(struct ocf_request *req)
9799

98100
OCF_DEBUG_TRACE(req->cache);
99101

100-
101102
/* Get OCF request - increase reference counter */
102103
ocf_req_get(req);
103104

105+
ocf_debug_request_trace(req, ocf_req_cache_mode_pt, 1);
106+
104107
/* Set resume handler */
105108
req->engine_handler = ocf_read_pt_do;
106109

src/engine/engine_rd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ int ocf_read_generic(struct ocf_request *req)
183183
int lock = OCF_LOCK_NOT_ACQUIRED;
184184
struct ocf_cache *cache = req->cache;
185185

186+
ocf_debug_request_trace(req, ocf_req_cache_mode_rd, 0);
187+
186188

187189
if (env_atomic_read(&cache->pending_read_misses_list_blocked)) {
188190
/* There are conditions to bypass IO */

src/engine/engine_wa.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ int ocf_write_wa(struct ocf_request *req)
2323
/* Get OCF request - increase reference counter */
2424
ocf_req_get(req);
2525

26+
ocf_debug_request_trace(req, ocf_req_cache_mode_wa, 0);
27+
2628
ocf_req_hash(req);
2729

2830
ocf_hb_req_prot_lock_rd(req); /*- Metadata RD access -----------------------*/

src/engine/engine_wb.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ int ocf_write_wb_do(struct ocf_request *req)
127127
/* Get OCF request - increase reference counter */
128128
ocf_req_get(req);
129129

130+
ocf_debug_request_trace(req, ocf_req_cache_mode_wb, 0);
130131
/* Submit IO */
131132
_ocf_write_wb_submit(req);
132133

@@ -149,10 +150,11 @@ int ocf_write_wb(struct ocf_request *req)
149150
{
150151
int lock = OCF_LOCK_NOT_ACQUIRED;
151152

152-
153153
/* Not sure if we need this. */
154154
ocf_req_get(req);
155155

156+
ocf_debug_request_trace(req, ocf_req_cache_mode_wb, 1);
157+
156158
/* Set resume handler */
157159
req->engine_handler = ocf_write_wb_do;
158160
req->engine_cbs = &_wb_engine_callbacks;

0 commit comments

Comments
 (0)