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> (cherry picked from commit 582f04e19ad7b41df993c669805e48a01bcd9c5b) (cherry picked from commit e030e88a4c2e220366f3db1af33d72d9638f93b5) (cherry picked from commit e925a5fdce15f914ec2386b03bf64242792acce0) (cherry picked from commit 9265a0e6952305932aa2b5caf2183387859dcfce) (cherry picked from commit 41794de36673c11faca8c57625dfa50b76edde20) (cherry picked from commit 5e830976b50a9f0a2c927b02f921f0d6ae796183) (cherry picked from commit b5344876556e4a62cac7905bf11ca7ccf8d16d6d)
This commit is contained in:
parent
1297c45dcc
commit
9abe5bf065
1 changed files with 13 additions and 14 deletions
|
@ -25,7 +25,7 @@
|
|||
#define BFQ_DEFAULT_GRP_IOPRIO 0
|
||||
#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
|
||||
|
@ -1059,26 +1059,27 @@ void bfq_add_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq);
|
|||
/* --------------- end of interface of B-WF2Q+ ---------------- */
|
||||
|
||||
/* 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)
|
||||
snprintf(str, len, "%d", pid);
|
||||
char type = bfq_bfqq_sync(bfqq) ? 'S' : 'A';
|
||||
|
||||
if (bfqq->pid != -1)
|
||||
snprintf(str, len, "bfq%d%c", bfqq->pid, type);
|
||||
else
|
||||
snprintf(str, len, "SHARED-");
|
||||
snprintf(str, len, "bfqSHARED-%c", type);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BFQ_GROUP_IOSCHED
|
||||
struct bfq_group *bfqq_group(struct bfq_queue *bfqq);
|
||||
|
||||
#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))) \
|
||||
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, \
|
||||
bfqg_to_blkg(bfqq_group(bfqq))->blkcg, \
|
||||
"bfq%s%c " fmt, pid_str, \
|
||||
bfq_bfqq_sync((bfqq)) ? 'S' : 'A', ##args); \
|
||||
"%s " fmt, pid_str, ##args); \
|
||||
} while (0)
|
||||
|
||||
#define bfq_log_bfqg(bfqd, bfqg, fmt, args...) do { \
|
||||
|
@ -1089,13 +1090,11 @@ struct bfq_group *bfqq_group(struct bfq_queue *bfqq);
|
|||
#else /* CONFIG_BFQ_GROUP_IOSCHED */
|
||||
|
||||
#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))) \
|
||||
break; \
|
||||
bfq_pid_to_str((bfqq)->pid, pid_str, MAX_PID_STR_LENGTH); \
|
||||
blk_add_trace_msg((bfqd)->queue, "bfq%s%c " fmt, pid_str, \
|
||||
bfq_bfqq_sync((bfqq)) ? 'S' : 'A', \
|
||||
##args); \
|
||||
bfq_bfqq_name((bfqq), pid_str, MAX_BFQQ_NAME_LENGTH); \
|
||||
blk_add_trace_msg((bfqd)->queue, "%s " fmt, pid_str, ##args); \
|
||||
} while (0)
|
||||
#define bfq_log_bfqg(bfqd, bfqg, fmt, args...) do {} while (0)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue