Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions bpf/estat/nfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/

struct bpf_wq {
__u64 __opaque[2];
} __attribute__((aligned(8)));

#include <uapi/linux/ptrace.h>
#include <linux/bpf_common.h>
#include <uapi/linux/bpf.h>
Expand Down
6 changes: 0 additions & 6 deletions bpf/estat/zvol.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ typedef struct {
zvol_state_t *zv;
} zvol_data_t;

typedef struct zv_request {
zvol_state_t *zv;
struct bio *bio;
} zv_request_t;


BPF_HASH(zvol_base_data, u32, zvol_data_t);

static inline bool equal_to_pool(char *str)
Expand Down
2 changes: 2 additions & 0 deletions bpf/standalone/arc_prefetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ class ArcLatencyIndex(BCCMapIndex):
"-I/usr/src/zfs-" + KVER + "/include/",
"-I/usr/src/zfs-" + KVER + "/include/spl/",
"-I/usr/src/zfs-" + KVER + "/include/linux",
"-D__KERNEL__",
"-D_KERNEL",
"-DNCOUNT_INDEX=" + str(len(ArcCountIndex)),
"-DNAVERAGE_INDEX=" + str(len(ArcLatencyIndex))] \
+ ArcCountIndex.getCDefinitions() \
Expand Down
4 changes: 2 additions & 2 deletions bpf/standalone/txg.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ def read_zfs_dirty_max_data():
""" Use the drgn program object to read the
zfs_dirty_data_max kernel variable.
"""
global proj
variable = prog['zfs_dirty_data_max']
return int(variable.value_())

Expand Down Expand Up @@ -349,7 +348,8 @@ def print_event(cpu, data, size):
"-I/usr/src/zfs-" + KVER + "/include/",
"-I/usr/src/zfs-" + KVER + "/include/spl",
"-I/usr/src/zfs-" + KVER + "/include/",
"-I/usr/src/zfs-" + KVER + "/include/linux"])
"-I/usr/src/zfs-" + KVER + "/include/linux",
"-D__KERNEL__", "-D_KERNEL"])

b.attach_kprobe(event="spa_sync", fn_name="spa_sync_entry")
b.attach_kretprobe(event="spa_sync", fn_name="spa_sync_return")
Expand Down
41 changes: 8 additions & 33 deletions bpf/standalone/zil.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
description='Collect zil latency statistics.',
usage='estat zil [options]')
parser.add_argument('-c', '--coll', type=int, action='store',
dest='collection_sec',
dest='collection_sec', default=60,
help='The collection interval in seconds')
parser.add_argument('-p', '--pool', type=str, action='store',
dest='pool',
Expand Down Expand Up @@ -286,18 +286,6 @@
return 0;
}

int zil_commit_waiter_skip_entry(struct pt_regs *cts)
{
u32 tid = bpf_get_current_pid_tgid();
zil_tid_info_t *info = zil_info_map.lookup(&tid);
if (info == NULL) {
return 0;
}

count_call("waiter skip");
return 0;
}

int zil_commit_writer_stall_entry(struct pt_regs *cts)
{
u32 tid = bpf_get_current_pid_tgid();
Expand All @@ -319,7 +307,8 @@
"-include",
"/usr/src/zfs-" + KVER + "/include/spl/sys/types.h",
"-I/usr/src/zfs-" + KVER + "/include/",
"-I/usr/src/zfs-" + KVER + "/include/spl"])
"-I/usr/src/zfs-" + KVER + "/include/spl",
"-D__KERNEL__", "-D_KERNEL"])

b.attach_kprobe(event="zfs_write", fn_name="zfs_write_entry")
b.attach_kretprobe(event="zfs_write", fn_name="zfs_write_return")
Expand All @@ -337,8 +326,6 @@
fn_name="zil_commit_waiter_return")
b.attach_kretprobe(event="zio_alloc_zil",
fn_name="zio_alloc_zil_return")
b.attach_kprobe(event="zil_commit_waiter_skip",
fn_name="zil_commit_waiter_skip_entry")
b.attach_kprobe(event="zil_commit_writer_stall",
fn_name="zil_commit_writer_stall_entry")

Expand All @@ -354,25 +341,13 @@
BCCHelper.COUNT_AGGREGATION, "count")
call_count_helper.add_key_type("name")

if (not args.collection_sec):
print(" Tracing enabled... Hit Ctrl-C to end.")

# Collect data for a collection interval if specified
if (args.collection_sec):
sleep(args.collection_sec)
try:
print("%-16s\n" % strftime("%D - %H:%M:%S %Z"))
latency_helper.printall()
call_count_helper.printall()
exit(0)
except Exception as e:
print(str(e))
exit(0)

# Collect data until keyborad interrupt with output for each second
#
# Collect data until keyboard interrupt
#
print(" Tracing enabled... Hit Ctrl-C to end.")
while True:
try:
sleep(60)
sleep(args.collection_sec)
except KeyboardInterrupt:
print("%-16s\n" % strftime("%D - %H:%M:%S %Z"))
latency_helper.printall()
Expand Down
1 change: 1 addition & 0 deletions bpf/stbtrace/iscsi.st
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ bpf_text += """
#include <linux/bpf_common.h>
#include <uapi/linux/bpf.h>

struct iscsi_conn;
#include "target/iscsi/iscsi_target_core.h"


Expand Down
52 changes: 24 additions & 28 deletions bpf/stbtrace/nfs.st
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ from bcchelper import BCCHelper # noqa: E402
bpf_text = '#include "' + base_dir + 'lib/bcc_helper.h' + '"\n'
bpf_text += """

struct bpf_wq {
__u64 __opaque[2];
} __attribute__((aligned(8)));

#include <uapi/linux/ptrace.h>
#include <linux/bpf_common.h>
#include <uapi/linux/bpf.h>
Expand All @@ -41,42 +37,42 @@ struct bpf_wq {
#define bool int

typedef struct {
u32 cl_boot;
u32 cl_id;
u32 cl_boot;
u32 cl_id;
} clientid_t;

typedef struct {
clientid_t so_clid;
u32 so_id;
clientid_t so_clid;
u32 so_id;
} stateid_opaque_t;

typedef struct {
u32 si_generation;
stateid_opaque_t si_opaque;
u32 si_generation;
stateid_opaque_t si_opaque;
} stateid_t;

struct nfsd4_read {
stateid_t rd_stateid; /* request */
u64 rd_offset; /* request */
u32 rd_length; /* request */
int rd_vlen;
struct nfsd_file *rd_nf;

struct svc_rqst *rd_rqstp; /* response */
struct svc_fh *rd_fhp; /* response */
u32 rd_eof; /* response */
stateid_t rd_stateid; /* request */
u64 rd_offset; /* request */
u32 rd_length; /* request */
int rd_vlen;
struct nfsd_file *rd_nf;

struct svc_rqst *rd_rqstp; /* response */
struct svc_fh *rd_fhp; /* response */
u32 rd_eof; /* response */
};

struct nfsd4_write {
stateid_t wr_stateid; /* request */
u64 wr_offset; /* request */
u32 wr_stable_how; /* request */
u32 wr_buflen; /* request */
struct xdr_buf wr_payload; /* request */

u32 wr_bytes_written; /* response */
u32 wr_how_written; /* response */
nfs4_verifier wr_verifier; /* response */
stateid_t wr_stateid; /* request */
u64 wr_offset; /* request */
u32 wr_stable_how; /* request */
u32 wr_buflen; /* request */
struct xdr_buf wr_payload; /* request */

u32 wr_bytes_written; /* response */
u32 wr_how_written; /* response */
nfs4_verifier wr_verifier; /* response */
};

// Definitions for this script
Expand Down
10 changes: 7 additions & 3 deletions cmd/estat.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ def die(*args, **kwargs):
estat zil [POOL]
Provides a breakdown of time spent doing ZIL-related activities, in
particular the time spent allocating a block and time spent waiting for
the write I/O to complete. If POOL is not specified, defaults to tracing
the pool 'domain0'.
the write I/O to complete.
-h show txg help message and exit
-c INTERVAL set the collection interval in seconds
-p POOL set the pool to monitor (default: domain0)
"""


Expand Down Expand Up @@ -406,7 +408,9 @@ class Args:
"-include",
"/usr/src/zfs-" + KVER + "/include/spl/sys/types.h",
"-I/usr/src/zfs-" + KVER + "/include/",
"-I/usr/src/zfs-" + KVER + "/include/spl"]
"-I/usr/src/zfs-" + KVER + "/include/spl",
"-D__KERNEL__",
"-D_KERNEL"]
if script_arg:
cflags.append("-DOPTARG=\"" + script_arg + "\"")

Expand Down