probe blk_mq_start_request
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
This commit is contained in:
parent
1fe8fcd630
commit
0af6ff3b01
18
blk_kprobe.c
18
blk_kprobe.c
|
|
@ -4,6 +4,7 @@
|
|||
#include <linux/bio.h>
|
||||
#include <linux/bvec.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/blk-mq.h>
|
||||
|
||||
static int submit_bio_pre(struct kprobe *p, struct pt_regs *regs) {
|
||||
struct bio *bio = (struct bio *)regs->di;
|
||||
|
|
@ -16,9 +17,6 @@ static int submit_bio_pre(struct kprobe *p, struct pt_regs *regs) {
|
|||
iter.bi_idx, iter.bi_sector, iter.bi_size, iter.bi_bvec_done, (unsigned long)bvec.bv_page, bvec.bv_len, bvec.bv_offset);
|
||||
}
|
||||
|
||||
if (bio->bi_vcnt != 1)
|
||||
dump_stack();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -27,8 +25,22 @@ static struct kprobe submit_bio_kp = {
|
|||
.pre_handler = submit_bio_pre,
|
||||
};
|
||||
|
||||
static int blk_mq_start_request_pre(struct kprobe *p, struct pt_regs *regs) {
|
||||
struct request *rq = (struct request *)regs->di;
|
||||
|
||||
printk(KERN_INFO "tag is %d, internal_tag is %d, sector is %lld, bytes is %d, nr_phys_segments is %d\n", rq->tag, rq->internal_tag, blk_rq_pos(rq), blk_rq_bytes(rq), rq->nr_phys_segments);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct kprobe blk_mq_start_request_kp = {
|
||||
.symbol_name = "blk_mq_start_request",
|
||||
.pre_handler = blk_mq_start_request_pre,
|
||||
};
|
||||
|
||||
static struct kprobe *kprobes[] = {
|
||||
&submit_bio_kp,
|
||||
&blk_mq_start_request_kp,
|
||||
};
|
||||
|
||||
static int __init kprobe_init(void) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue