Commit f7e944b4 authored by Yu Kuai's avatar Yu Kuai
Browse files

block: support to recored bio allocation task

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/release-management/issues/IB4E8P


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: default avatarYu Kuai <yukuai3@huawei.com>
parent 6e6012df
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -39,6 +39,9 @@ config BLOCK_LEGACY_AUTOLOAD
config BLK_BIO_ALLOC_TIME
	bool

config BLK_BIO_ALLOC_TASK
	bool

config BLK_RQ_ALLOC_TIME
	bool

+11 −0
Original line number Diff line number Diff line
@@ -223,6 +223,13 @@ void bio_uninit(struct bio *bio)
		bio_integrity_free(bio);

	bio_crypt_free_ctx(bio);

#ifdef CONFIG_BLK_BIO_ALLOC_TASK
	if (bio->pid) {
		put_pid(bio->pid);
		bio->pid = NULL;
	}
#endif
}
EXPORT_SYMBOL(bio_uninit);

@@ -286,6 +293,10 @@ void bio_init(struct bio *bio, struct block_device *bdev, 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 = get_pid(task_pid(current));
#endif
}
EXPORT_SYMBOL(bio_init);

+4 −0
Original line number Diff line number Diff line
@@ -302,7 +302,11 @@ struct bio {
#else
	KABI_RESERVE(4)
#endif
#ifdef CONFIG_BLK_BIO_ALLOC_TASK
	KABI_USE(5, struct pid *pid)
#else
	KABI_RESERVE(5)
#endif
	KABI_RESERVE(6)
	KABI_RESERVE(7)
	KABI_RESERVE(8)