fuse: add fuse_request_sent tracepoint
Subsystems (2)
PATCH v3 1/1 fuse: add fuse_request_sent tracepoint
This new tracepoint complements fuse_request_send (enqueue) and fuse_request_end (completion). It fires after the request has been successfully copied to the daemon's buffer, just before the daemon can start to process it.
fuse_request_sent does not fire if the copy of the request fails. It also does not fire for NOTIFY_REPLY, which fires the _end tracepoint at the end of copy.
This is needed for tools tracking the in-flight state of user initiated fuse requests.
---
Miklos,
Reminder, this is base on Linus master, not on fuse for-next, because it is a candidate for backport to 6.18 and if you apply it at base of for-next, then the new tracepoint needs to be adjusted in commit "fuse: change req->fm to req->chan".
Thanks,
Amir.
Changes from v2 [2]:
- Reword commit message (Joanne)
Changes from v1 [1]:
- Rename tracepoint s/_recv/_sent
- Fire in ioruing
- Fire consistently along with setting FR_SENT, which...
- Avoids firing when request is not sent sue to failure
[1] https://lore.kernel.org/fuse-devel/[email protected]/
[2] https://lore.kernel.org/fuse-devel/[email protected]/
fs/fuse/dev.c | 1 + fs/fuse/dev_uring.c | 6 ++++-- fs/fuse/fuse_trace.h | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-)
fs/fuse/dev.c +1 -0
@@ -1525,6 +1525,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file,list_move_tail (&req->list, &fpq->processing[hash]);__fuse_get_request (req);set_bit (FR_SENT , &req->flags); +trace_fuse_request_sent (req);spin_unlock (&fpq->lock);/* matches barrier in request_wait_answer() */ smp_mb__after_atomic ();
fs/fuse/dev_uring.c +4 -2
@@ -702,10 +702,12 @@ static int fuse_uring_prepare_send(struct fuse_ring_ent *ent,int err; err =fuse_uring_copy_to_ring (ent, req); -if (!err) +if (!err) {set_bit (FR_SENT , &req->flags); -else +trace_fuse_request_sent (req); + }else {fuse_uring_req_end (ent, req, err); + }return err; }
fs/fuse/fuse_trace.h +22 -0
@@ -101,6 +101,28 @@ TRACE_EVENT(fuse_request_send, __print_symbolic(__entry->opcode, OPCODES), __entry->len) ); +TRACE_EVENT (fuse_request_sent, + TP_PROTO(const struct fuse_req *req), + +TP_ARGS (req), + +TP_STRUCT__entry ( + __field(dev_t, connection) + __field(uint64_t, unique) + __field(enum fuse_opcode, opcode) + ), + +TP_fast_assign ( + __entry->connection = req->fm->fc->dev; + __entry->unique = req->in.h.unique; + __entry->opcode = req->in.h.opcode; + ), + +TP_printk ("connection %u req %llu opcode %u (%s)" , + __entry->connection, __entry->unique, __entry->opcode, +__print_symbolic (__entry->opcode,OPCODES )) +); + TRACE_EVENT(fuse_request_end, TP_PROTO(const struct fuse_req *req),
Signature · 1 line
2.54.0