Skip to content

Commit 4aa1ef6

Browse files
brad-lewisSebastien Roy
authored andcommitted
Fix ZPL Collectors after ZFS changes to sync flags and include files (#21)
1 parent e86fb2e commit 4aa1ef6

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

bpf/estat/zpl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ zfs_read_write_entry(io_info_t *info, struct inode *ip, uio_t *uio, int flags)
5757
info->start_time = bpf_ktime_get_ns();
5858
info->bytes = uio->uio_resid;
5959
info->is_sync =
60-
z_os->os_sync == ZFS_SYNC_ALWAYS || (flags & (FSYNC | FDSYNC));
60+
z_os->os_sync == ZFS_SYNC_ALWAYS || (flags & (O_SYNC | O_DSYNC));
6161

6262
u32 tid = bpf_get_current_pid_tgid();
6363
io_info_t *infop = io_info_map.lookup(&tid);

bpf/stbtrace/zpl.st

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,12 @@ int zfs_write_done(struct pt_regs *ctx)
172172

173173
"""
174174
KVER = os.popen('uname -r').read().rstrip()
175-
b = BPF(text=bpf_text,
176-
cflags=["-I/usr/src/zfs-" + KVER + "/include/spl"])
175+
b = BPF(text=bpf_text, cflags=["-include",
176+
"/usr/src/zfs-" + KVER + "/zfs_config.h",
177+
"-include",
178+
"/usr/src/zfs-" + KVER + "/include/spl/sys/types.h",
179+
"-I/usr/src/zfs-" + KVER + "/include/",
180+
"-I/usr/src/zfs-" + KVER + "/include/spl/"])
177181

178182
b.attach_kprobe(event="zfs_read", fn_name="zfs_read_start")
179183
b.attach_kprobe(event="zfs_write", fn_name="zfs_write_start")

cmd/estat.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,8 @@ class Args:
383383
KVER = os.popen('uname -r').read().rstrip()
384384
cflags = ["-include",
385385
"/usr/src/zfs-" + KVER + "/zfs_config.h",
386+
"-include",
387+
"/usr/src/zfs-" + KVER + "/include/spl/sys/types.h",
386388
"-I/usr/src/zfs-" + KVER + "/include/",
387389
"-I/usr/src/zfs-" + KVER + "/include/spl"]
388390
if script_arg:

0 commit comments

Comments
 (0)