hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IAGRKP CVE: NA
--------------------------------
A new config BLK_BIO_ALLOC_TASK is added to control the behaviour, and the task_struct will be used later for blk-io-hierarchy to dump thread info to user.
Signed-off-by: Yu Kuai yukuai3@huawei.com --- block/Kconfig | 3 +++ block/bio.c | 10 ++++++++++ include/linux/blk_types.h | 4 ++++ 3 files changed, 17 insertions(+)
diff --git a/block/Kconfig b/block/Kconfig index de3574766ef5..9b512a000af7 100644 --- a/block/Kconfig +++ b/block/Kconfig @@ -29,6 +29,9 @@ if BLOCK config BLK_BIO_ALLOC_TIME bool
+config BLK_BIO_ALLOC_TASK + bool + config LBDAF bool "Support for large (2TB+) block devices and files" depends on !64BIT diff --git a/block/bio.c b/block/bio.c index 200d17093a8e..b32dc89bb704 100644 --- a/block/bio.c +++ b/block/bio.c @@ -245,6 +245,12 @@ struct bio_vec *bvec_alloc(gfp_t gfp_mask, int nr, unsigned long *idx, void bio_uninit(struct bio *bio) { bio_disassociate_task(bio); +#ifdef CONFIG_BLK_BIO_ALLOC_TASK + if (bio->pid) { + put_pid(bio->pid); + bio->pid = NULL; + } +#endif } EXPORT_SYMBOL(bio_uninit);
@@ -289,6 +295,10 @@ void bio_init(struct bio *bio, struct bio_vec *table, #ifdef CONFIG_BLK_BIO_ALLOC_TIME bio->bi_alloc_time_ns = blk_time_get_ns(); #endif + +#ifdef CONFIG_BLK_BIO_ALLOC_TASK + bio->pid = find_get_pid(current->pid); +#endif } EXPORT_SYMBOL(bio_init);
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index efafee166996..416cf84a0624 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -208,7 +208,11 @@ struct bio { #else KABI_RESERVE(1) #endif +#if defined(CONFIG_BLK_BIO_ALLOC_TASK) && !defined(__GENKSYMS__) + struct pid *pid; +#else KABI_RESERVE(2) +#endif KABI_RESERVE(3)
/*