hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/release-management/issues/IB4E8P CVE: NA
--------------------------------
A new config BLK_BIO_ALLOC_TIME is added to control the behaviour, and the time will be used later for blk-io-hierarchy.
Signed-off-by: Yu Kuai yukuai3@huawei.com --- block/Kconfig | 3 +++ block/bio.c | 4 ++++ include/linux/blk_types.h | 4 ++++ 3 files changed, 11 insertions(+)
diff --git a/block/Kconfig b/block/Kconfig index 8fd2a8cb539e..371f4f9ab298 100644 --- a/block/Kconfig +++ b/block/Kconfig @@ -36,6 +36,9 @@ config BLOCK_LEGACY_AUTOLOAD created on demand, but scripts that manually create device nodes and then call losetup might rely on this behavior.
+config BLK_BIO_ALLOC_TIME + bool + config BLK_RQ_ALLOC_TIME bool
diff --git a/block/bio.c b/block/bio.c index bf6bec43b27e..060c91e50936 100644 --- a/block/bio.c +++ b/block/bio.c @@ -282,6 +282,10 @@ void bio_init(struct bio *bio, struct block_device *bdev, struct bio_vec *table, bio->bi_max_vecs = max_vecs; bio->bi_io_vec = table; bio->bi_pool = NULL; + +#ifdef CONFIG_BLK_BIO_ALLOC_TIME + bio->bi_alloc_time_ns = blk_time_get_ns(); +#endif } EXPORT_SYMBOL(bio_init);
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 858bb4b71474..1d86790dd07c 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -297,7 +297,11 @@ struct bio { #endif KABI_RESERVE(2) KABI_RESERVE(3) +#ifdef CONFIG_BLK_BIO_ALLOC_TIME + KABI_USE(4, u64 bi_alloc_time_ns) +#else KABI_RESERVE(4) +#endif KABI_RESERVE(5) KABI_RESERVE(6) KABI_RESERVE(7)