blktrace: use inline function for blk_trace_remove() while blktrace is disabled
authorYu Kuai <yukuai3@huawei.com>
Sat, 10 Jun 2023 02:20:01 +0000 (10:20 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 15 Jun 2023 02:24:03 +0000 (20:24 -0600)
If config is disabled, call blk_trace_remove() directly will trigger
build warning, hence use inline function instead, prepare to fix
blktrace debugfs entries leakage.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20230610022003.2557284-2-yukuai1@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/blktrace_api.h

index cfbda11..122c62e 100644 (file)
@@ -85,10 +85,14 @@ extern int blk_trace_remove(struct request_queue *q);
 # define blk_add_driver_data(rq, data, len)            do {} while (0)
 # define blk_trace_setup(q, name, dev, bdev, arg)      (-ENOTTY)
 # define blk_trace_startstop(q, start)                 (-ENOTTY)
-# define blk_trace_remove(q)                           (-ENOTTY)
 # define blk_add_trace_msg(q, fmt, ...)                        do { } while (0)
 # define blk_add_cgroup_trace_msg(q, cg, fmt, ...)     do { } while (0)
 # define blk_trace_note_message_enabled(q)             (false)
+
+static inline int blk_trace_remove(struct request_queue *q)
+{
+       return -ENOTTY;
+}
 #endif /* CONFIG_BLK_DEV_IO_TRACE */
 
 #ifdef CONFIG_COMPAT