Skip to content

Commit

Permalink
blktrace: Show requests without sector
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
jankara authored and axboe committed Feb 7, 2019
1 parent 43636c8 commit 0803de7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/linux/blktrace_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,13 @@ extern void blk_fill_rwbs(char *rwbs, unsigned int op, int bytes);

static inline sector_t blk_rq_trace_sector(struct request *rq)
{
return blk_rq_is_passthrough(rq) ? 0 : blk_rq_pos(rq);
/*
* Tracing should ignore starting sector for passthrough requests and
* requests where starting sector didn't get set.
*/
if (blk_rq_is_passthrough(rq) || blk_rq_pos(rq) == (sector_t)-1)
return 0;
return blk_rq_pos(rq);
}

static inline unsigned int blk_rq_trace_nr_sectors(struct request *rq)
Expand Down

0 comments on commit 0803de7

Please sign in to comment.