* [PATCH] blktrace: Show requests without sector
@ 2019-02-06 12:04 Jan Kara
2019-02-06 12:37 ` Johannes Thumshirn
2019-02-06 19:49 ` Jens Axboe
0 siblings, 2 replies; 4+ messages in thread
From: Jan Kara @ 2019-02-06 12:04 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block, Jan Kara
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.
Signed-off-by: Jan Kara <jack@suse.cz>
---
include/linux/blktrace_api.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 8804753805ac..353fd8c70760 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -116,7 +116,8 @@ 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);
+ return (blk_rq_is_passthrough(rq) || blk_rq_pos(rq) == (sector_t)-1) ?
+ 0 : blk_rq_pos(rq);
}
static inline unsigned int blk_rq_trace_nr_sectors(struct request *rq)
--
2.16.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] blktrace: Show requests without sector
2019-02-06 12:04 [PATCH] blktrace: Show requests without sector Jan Kara
@ 2019-02-06 12:37 ` Johannes Thumshirn
2019-02-06 19:49 ` Jens Axboe
1 sibling, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2019-02-06 12:37 UTC (permalink / raw)
To: Jan Kara; +Cc: Jens Axboe, linux-block
Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
--
Johannes Thumshirn SUSE Labs Filesystems
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] blktrace: Show requests without sector
2019-02-06 12:04 [PATCH] blktrace: Show requests without sector Jan Kara
2019-02-06 12:37 ` Johannes Thumshirn
@ 2019-02-06 19:49 ` Jens Axboe
2019-02-07 10:54 ` Jan Kara
1 sibling, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2019-02-06 19:49 UTC (permalink / raw)
To: Jan Kara; +Cc: linux-block
On 2/6/19 5:04 AM, Jan Kara wrote:
> 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.
Concept is fine, but man, that's not very readable. How about:
if (blk_rq_passthrough(rq) || blk_rq_pos(rq) == (sector_t) -1)
return 0;
return blk_rq_pos(rq);
instead? Preferably with a comment on why blk_rq_pos() will be -1.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] blktrace: Show requests without sector
2019-02-06 19:49 ` Jens Axboe
@ 2019-02-07 10:54 ` Jan Kara
0 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2019-02-07 10:54 UTC (permalink / raw)
To: Jens Axboe; +Cc: Jan Kara, linux-block
On Wed 06-02-19 12:49:46, Jens Axboe wrote:
> On 2/6/19 5:04 AM, Jan Kara wrote:
> > 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.
>
> Concept is fine, but man, that's not very readable. How about:
>
> if (blk_rq_passthrough(rq) || blk_rq_pos(rq) == (sector_t) -1)
> return 0;
>
> return blk_rq_pos(rq);
>
> instead? Preferably with a comment on why blk_rq_pos() will be -1.
Good points. Will send v2 shortly. Thanks!
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-02-07 10:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-06 12:04 [PATCH] blktrace: Show requests without sector Jan Kara
2019-02-06 12:37 ` Johannes Thumshirn
2019-02-06 19:49 ` Jens Axboe
2019-02-07 10:54 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).