Skip to content

Commit 0803de7

Browse files
jankaraaxboe
authored andcommitted
blktrace: Show requests without sector
Currently, blktrace will not show requests that don't have any data as rq->__sector is initialized to -1 which is out of device range and thus discarded by act_log_check(). This is most notably the case for cache flush requests sent to the device. Fix the problem by making blk_rq_trace_sector() return 0 for requests without initialized sector. Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 43636c8 commit 0803de7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

include/linux/blktrace_api.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@ extern void blk_fill_rwbs(char *rwbs, unsigned int op, int bytes);
116116

117117
static inline sector_t blk_rq_trace_sector(struct request *rq)
118118
{
119-
return blk_rq_is_passthrough(rq) ? 0 : blk_rq_pos(rq);
119+
/*
120+
* Tracing should ignore starting sector for passthrough requests and
121+
* requests where starting sector didn't get set.
122+
*/
123+
if (blk_rq_is_passthrough(rq) || blk_rq_pos(rq) == (sector_t)-1)
124+
return 0;
125+
return blk_rq_pos(rq);
120126
}
121127

122128
static inline unsigned int blk_rq_trace_nr_sectors(struct request *rq)

0 commit comments

Comments
 (0)