Skip to content

fix the issue of incorrect device id in diskerrors.#103

Open
answer9030 wants to merge 1 commit intomchehab:masterfrom
answer9030:master
Open

fix the issue of incorrect device id in diskerrors.#103
answer9030 wants to merge 1 commit intomchehab:masterfrom
answer9030:master

Conversation

@answer9030
Copy link
Copy Markdown

@answer9030 answer9030 commented Jun 13, 2023

The device ID of a block event is organized in kernel space, and the device ID obtained by user space processes is also organized in kernel space. Therefore, it needs to be parsed in kernel mode.
Kernel Space Definition:

TRACE_EVENT(block_rq_complete,

	TP_PROTO(struct request *rq, int error, unsigned int nr_bytes),

	TP_ARGS(rq, error, nr_bytes),

	TP_STRUCT__entry(
		__field(  dev_t,	dev			)
		__field(  sector_t,	sector			)
		__field(  unsigned int,	nr_sector		)
		__field(  int,		error			)
		__array(  char,		rwbs,	RWBS_LEN	)
		__dynamic_array( char,	cmd,	1		)
	),

	TP_fast_assign(
		__entry->dev	   = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
		__entry->sector    = blk_rq_pos(rq);
		__entry->nr_sector = nr_bytes >> 9;
		__entry->error     = error;

		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, nr_bytes);
		__get_str(cmd)[0] = '\0';
	),

	TP_printk("%d,%d %s (%s) %llu + %u [%d]",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->rwbs, __get_str(cmd),
		  (unsigned long long)__entry->sector,
		  __entry->nr_sector, __entry->error)
);

@mchehab
Copy link
Copy Markdown
Owner

mchehab commented Oct 23, 2023

The changes you're proposing seem incomplete, as you just defined two new macros but the logic is not using it. Did you forget to push some other changes?

Also, please add your Signed-off-by to the patch (see https://wiki.linuxfoundation.org/dco) and provide a clear description to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants