ANDROID: dm: Add a vendor hook to update bio after clone

add a vendor hook to update bio after __bio_clone_fast()

Bug: 261942040
Change-Id: I5ff6f6df632bc9690ea588bc1cadbed670b78e5c
Signed-off-by: lijiaming <lijiaming3@xiaomi.com>
This commit is contained in:
lijiaming
2022-12-09 17:47:32 +08:00
committed by Todd Kjos
parent be6c9a9b11
commit cac282fc1a
3 changed files with 25 additions and 3 deletions

View File

@@ -106,7 +106,7 @@
#include <trace/hooks/signal.h>
#include <trace/hooks/cfg80211.h>
#include <trace/hooks/bl_hib.h>
#include <trace/hooks/dm.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
* associated with them) to allow external modules to probe them.
@@ -409,6 +409,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_encrypt_page);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_init_aes_encrypt);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_skip_swap_map_write);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_post_image_save);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dm_update_clone_bio);
/*
* For type visibility

View File

@@ -30,7 +30,7 @@
#include <linux/part_stat.h>
#include <linux/blk-crypto.h>
#include <linux/keyslot-manager.h>
#include <trace/hooks/dm.h>
#define DM_MSG_PREFIX "core"
/*
@@ -1292,7 +1292,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio,
int r;
__bio_clone_fast(clone, bio);
trace_android_vh_dm_update_clone_bio(clone, bio);
r = bio_crypt_clone(clone, bio, GFP_NOIO);
if (r < 0)
return r;

21
include/trace/hooks/dm.h Normal file
View File

@@ -0,0 +1,21 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM dm
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_DM_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_DM_H
#include <trace/hooks/vendor_hooks.h>
#include <linux/blk_types.h>
struct bio;
DECLARE_HOOK(android_vh_dm_update_clone_bio,
TP_PROTO(struct bio *clone, struct bio *bio),
TP_ARGS(clone, bio));
#endif /* _TRACE_HOOK_DM_H */
/* This part must be outside protection */
#include <trace/define_trace.h>