@@ -22,49 +22,19 @@ typedef struct {
22
22
// Map of thread id to info about an in-progress IO
23
23
BPF_HASH (io_info_map , u32 , io_info_t );
24
24
25
- #ifndef OPTARG
26
- #define POOL "domain0"
27
- #else
28
- #define POOL (OPTARG)
29
- #endif
30
25
#define ZFS_READ_SYNC_LENGTH 14
31
26
#define ZFS_READ_ASYNC_LENGTH 15
32
27
#define ZFS_WRITE_SYNC_LENGTH 15
33
28
#define ZFS_WRITE_ASYNC_LENGTH 16
34
29
35
- // TODO factor this out into a helper so that it isn't duplicated
36
- static inline bool
37
- equal_to_pool (char * str )
38
- {
39
- char comparand [sizeof (POOL )];
40
- bpf_probe_read (& comparand , sizeof (comparand ), str );
41
- char compare [] = POOL ;
42
- for (int i = 0 ; i < sizeof (comparand ); ++ i )
43
- if (compare [i ] != comparand [i ])
44
- return (false);
45
- return (true);
46
- }
47
-
48
30
static inline int
49
31
zfs_read_write_entry (io_info_t * info , struct znode * zn , zfs_uio_t * uio , int flags )
50
32
{
51
- // Essentially ITOZSB, but written explicitly so that BCC can insert
52
- // the necessary calls to bpf_probe_read.
53
- zfsvfs_t * zfsvfs = zn -> z_inode .i_sb -> s_fs_info ;
54
-
55
- objset_t * z_os = zfsvfs -> z_os ;
56
- spa_t * spa = z_os -> os_spa ;
57
-
58
- if (!equal_to_pool (spa -> spa_name ))
59
- return (0 );
60
-
61
33
info -> start_time = bpf_ktime_get_ns ();
62
34
info -> bytes = uio -> uio_resid ;
63
- info -> is_sync =
64
- z_os -> os_sync == ZFS_SYNC_ALWAYS || (flags & (O_SYNC | O_DSYNC ));
35
+ info -> is_sync = (flags & (O_SYNC | O_DSYNC ));
65
36
66
37
u32 tid = bpf_get_current_pid_tgid ();
67
- io_info_t * infop = io_info_map .lookup (& tid );
68
38
io_info_map .update (& tid , info );
69
39
70
40
return (0 );
@@ -91,7 +61,7 @@ zfs_write_entry(struct pt_regs *ctx, struct znode *zn, zfs_uio_t *uio, int flags
91
61
// @@ kretprobe|zfs_read|zfs_read_write_exit
92
62
// @@ kretprobe|zfs_write|zfs_read_write_exit
93
63
int
94
- zfs_read_write_exit (struct pt_regs * ctx , struct znode * zn , zfs_uio_t * uio )
64
+ zfs_read_write_exit (struct pt_regs * ctx )
95
65
{
96
66
u32 tid = bpf_get_current_pid_tgid ();
97
67
io_info_t * info = io_info_map .lookup (& tid );
@@ -110,11 +80,7 @@ zfs_read_write_exit(struct pt_regs *ctx, struct znode *zn, zfs_uio_t *uio)
110
80
__builtin_memcpy (name , "zfs_write async" , ZFS_WRITE_ASYNC_LENGTH );
111
81
}
112
82
} else {
113
- if (info -> is_sync ) {
114
- __builtin_memcpy (name , "zfs_read sync" , ZFS_READ_SYNC_LENGTH );
115
- } else {
116
- __builtin_memcpy (name , "zfs_read async" , ZFS_READ_ASYNC_LENGTH );
117
- }
83
+ __builtin_memcpy (name , "zfs_read" , ZFS_READ_SYNC_LENGTH );
118
84
}
119
85
120
86
char axis = 0 ;
0 commit comments