[PATCH 07/13] blk: use standalone macro to control bio.bi_iocost_cost

From: Wang Jianchao
Date: Mon Jan 10 2022 - 04:14:21 EST


From: Wang Jianchao <wangjianchao@xxxxxxxxxxxx>

This is a preparation to make iocost modular

Signed-off-by: Wang Jianchao <wangjianchao@xxxxxxxxxxxx>
---
block/Kconfig | 4 ++++
block/bio.c | 2 +-
include/linux/blk_types.h | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/block/Kconfig b/block/Kconfig
index 50cc1b56852c..e1b1bff5c1e9 100644
--- a/block/Kconfig
+++ b/block/Kconfig
@@ -26,6 +26,9 @@ menuconfig BLOCK

if BLOCK

+config BLK_BIO_IOCOST
+ bool
+
config BLK_RQ_ALLOC_TIME
bool

@@ -134,6 +137,7 @@ config BLK_CGROUP_IOCOST
bool "Enable support for cost model based cgroup IO controller"
depends on BLK_CGROUP
select BLK_RQ_ALLOC_TIME
+ select BLK_BIO_IOCOST
help
Enabling this option enables the .weight interface for cost
model based proportional IO control. The IO controller
diff --git a/block/bio.c b/block/bio.c
index 15ab0d6d1c06..a9e2347b0021 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -268,7 +268,7 @@ void bio_init(struct bio *bio, struct bio_vec *table,
#ifdef CONFIG_BLK_CGROUP
bio->bi_blkg = NULL;
bio->bi_issue.value = 0;
-#ifdef CONFIG_BLK_CGROUP_IOCOST
+#ifdef CONFIG_BLK_BIO_IOCOST
bio->bi_iocost_cost = 0;
#endif
#endif
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index fe065c394fff..495ffc29bab0 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -261,7 +261,7 @@ struct bio {
*/
struct blkcg_gq *bi_blkg;
struct bio_issue bi_issue;
-#ifdef CONFIG_BLK_CGROUP_IOCOST
+#ifdef CONFIG_BLK_BIO_IOCOST
u64 bi_iocost_cost;
#endif
#endif
--
2.17.1