Re: [PATCHv2 4/4] nvme: add disk name to tracepoints

From: Christoph Hellwig
Date: Fri Jun 29 2018 - 04:00:08 EST


> +const char *nvme_trace_disk_name(struct trace_seq *p, char *name)
> +{
> + const char *ret = trace_seq_buffer_ptr(p);
> +
> + if (name[0] != 0)
> + trace_seq_printf(p, "disk=%-.*s, ", DISK_NAME_LEN, name);

if (*name)
trace_seq_printf(p, "disk=%-.*s, ", DISK_NAME_LEN, name);

?

> + req->rq_disk ?
> + memcpy(__entry->disk, req->rq_disk->disk_name, DISK_NAME_LEN) :
> + memset(__entry->disk, 0, DISK_NAME_LEN);

Make this a helper please.