bfq: Provide helper to generate bfqq name
Instead of having helper formating bfqq pid, provide a helper to generate full bfqq name as used in the traces. It saves some code duplication and will save more in the coming tracepoints. Acked-by: Paolo Valente <paolo.valente@linaro.org> Signed-off-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20211125133645.27483-6-jack@suse.cz Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
1f18b7005b
commit
582f04e19a
|
@ -25,7 +25,7 @@
|
||||||
#define BFQ_DEFAULT_GRP_IOPRIO 0
|
#define BFQ_DEFAULT_GRP_IOPRIO 0
|
||||||
#define BFQ_DEFAULT_GRP_CLASS IOPRIO_CLASS_BE
|
#define BFQ_DEFAULT_GRP_CLASS IOPRIO_CLASS_BE
|
||||||
|
|
||||||
#define MAX_PID_STR_LENGTH 12
|
#define MAX_BFQQ_NAME_LENGTH 16
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Soft real-time applications are extremely more latency sensitive
|
* Soft real-time applications are extremely more latency sensitive
|
||||||
|
@ -1083,26 +1083,27 @@ void bfq_add_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq);
|
||||||
/* --------------- end of interface of B-WF2Q+ ---------------- */
|
/* --------------- end of interface of B-WF2Q+ ---------------- */
|
||||||
|
|
||||||
/* Logging facilities. */
|
/* Logging facilities. */
|
||||||
static inline void bfq_pid_to_str(int pid, char *str, int len)
|
static inline void bfq_bfqq_name(struct bfq_queue *bfqq, char *str, int len)
|
||||||
{
|
{
|
||||||
if (pid != -1)
|
char type = bfq_bfqq_sync(bfqq) ? 'S' : 'A';
|
||||||
snprintf(str, len, "%d", pid);
|
|
||||||
|
if (bfqq->pid != -1)
|
||||||
|
snprintf(str, len, "bfq%d%c", bfqq->pid, type);
|
||||||
else
|
else
|
||||||
snprintf(str, len, "SHARED-");
|
snprintf(str, len, "bfqSHARED-%c", type);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_BFQ_GROUP_IOSCHED
|
#ifdef CONFIG_BFQ_GROUP_IOSCHED
|
||||||
struct bfq_group *bfqq_group(struct bfq_queue *bfqq);
|
struct bfq_group *bfqq_group(struct bfq_queue *bfqq);
|
||||||
|
|
||||||
#define bfq_log_bfqq(bfqd, bfqq, fmt, args...) do { \
|
#define bfq_log_bfqq(bfqd, bfqq, fmt, args...) do { \
|
||||||
char pid_str[MAX_PID_STR_LENGTH]; \
|
char pid_str[MAX_BFQQ_NAME_LENGTH]; \
|
||||||
if (likely(!blk_trace_note_message_enabled((bfqd)->queue))) \
|
if (likely(!blk_trace_note_message_enabled((bfqd)->queue))) \
|
||||||
break; \
|
break; \
|
||||||
bfq_pid_to_str((bfqq)->pid, pid_str, MAX_PID_STR_LENGTH); \
|
bfq_bfqq_name((bfqq), pid_str, MAX_BFQQ_NAME_LENGTH); \
|
||||||
blk_add_cgroup_trace_msg((bfqd)->queue, \
|
blk_add_cgroup_trace_msg((bfqd)->queue, \
|
||||||
bfqg_to_blkg(bfqq_group(bfqq))->blkcg, \
|
bfqg_to_blkg(bfqq_group(bfqq))->blkcg, \
|
||||||
"bfq%s%c " fmt, pid_str, \
|
"%s " fmt, pid_str, ##args); \
|
||||||
bfq_bfqq_sync((bfqq)) ? 'S' : 'A', ##args); \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define bfq_log_bfqg(bfqd, bfqg, fmt, args...) do { \
|
#define bfq_log_bfqg(bfqd, bfqg, fmt, args...) do { \
|
||||||
|
@ -1113,13 +1114,11 @@ struct bfq_group *bfqq_group(struct bfq_queue *bfqq);
|
||||||
#else /* CONFIG_BFQ_GROUP_IOSCHED */
|
#else /* CONFIG_BFQ_GROUP_IOSCHED */
|
||||||
|
|
||||||
#define bfq_log_bfqq(bfqd, bfqq, fmt, args...) do { \
|
#define bfq_log_bfqq(bfqd, bfqq, fmt, args...) do { \
|
||||||
char pid_str[MAX_PID_STR_LENGTH]; \
|
char pid_str[MAX_BFQQ_NAME_LENGTH]; \
|
||||||
if (likely(!blk_trace_note_message_enabled((bfqd)->queue))) \
|
if (likely(!blk_trace_note_message_enabled((bfqd)->queue))) \
|
||||||
break; \
|
break; \
|
||||||
bfq_pid_to_str((bfqq)->pid, pid_str, MAX_PID_STR_LENGTH); \
|
bfq_bfqq_name((bfqq), pid_str, MAX_BFQQ_NAME_LENGTH); \
|
||||||
blk_add_trace_msg((bfqd)->queue, "bfq%s%c " fmt, pid_str, \
|
blk_add_trace_msg((bfqd)->queue, "%s " fmt, pid_str, ##args); \
|
||||||
bfq_bfqq_sync((bfqq)) ? 'S' : 'A', \
|
|
||||||
##args); \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
#define bfq_log_bfqg(bfqd, bfqg, fmt, args...) do {} while (0)
|
#define bfq_log_bfqg(bfqd, bfqg, fmt, args...) do {} while (0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue