]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
cifs: Make the write_{enter,done,err} tracepoints display netfs info
authorDavid Howells <dhowells@redhat.com>
Wed, 18 Sep 2024 19:24:24 +0000 (20:24 +0100)
committerSteve French <stfrench@microsoft.com>
Wed, 25 Sep 2024 02:51:48 +0000 (21:51 -0500)
Make the write RPC tracepoints use the same trace macro complexes as the
read tracepoints and display the netfs request and subrequest IDs where
available (see commit 519be989717c "cifs: Add a tracepoint to track credits
involved in R/W requests").

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <stfrench@microsoft.com>
cc: Paulo Alcantara (Red Hat) <pc@manguebit.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: linux-cifs@vger.kernel.org
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/smb2pdu.c
fs/smb/client/trace.h

index 2cb1bf65a172a5f097ddfb560de51702ce62a0db..bb225758448a6ae8daf79f819ed92f8d212ca4d8 100644 (file)
@@ -4866,7 +4866,9 @@ smb2_writev_callback(struct mid_q_entry *mid)
 #endif
        if (result) {
                cifs_stats_fail_inc(tcon, SMB2_WRITE_HE);
-               trace_smb3_write_err(wdata->xid,
+               trace_smb3_write_err(wdata->rreq->debug_id,
+                                    wdata->subreq.debug_index,
+                                    wdata->xid,
                                     wdata->req->cfile->fid.persistent_fid,
                                     tcon->tid, tcon->ses->Suid, wdata->subreq.start,
                                     wdata->subreq.len, wdata->result);
@@ -4874,7 +4876,9 @@ smb2_writev_callback(struct mid_q_entry *mid)
                        pr_warn_once("Out of space writing to %s\n",
                                     tcon->tree_name);
        } else
-               trace_smb3_write_done(0 /* no xid */,
+               trace_smb3_write_done(wdata->rreq->debug_id,
+                                     wdata->subreq.debug_index,
+                                     wdata->xid,
                                      wdata->req->cfile->fid.persistent_fid,
                                      tcon->tid, tcon->ses->Suid,
                                      wdata->subreq.start, wdata->subreq.len);
@@ -4952,7 +4956,9 @@ smb2_async_writev(struct cifs_io_subrequest *wdata)
                                offsetof(struct smb2_write_req, Buffer));
        req->RemainingBytes = 0;
 
-       trace_smb3_write_enter(wdata->xid,
+       trace_smb3_write_enter(wdata->rreq->debug_id,
+                              wdata->subreq.debug_index,
+                              wdata->xid,
                               io_parms->persistent_fid,
                               io_parms->tcon->tid,
                               io_parms->tcon->ses->Suid,
@@ -5032,7 +5038,9 @@ smb2_async_writev(struct cifs_io_subrequest *wdata)
                             wdata, flags, &wdata->credits);
        /* Can't touch wdata if rc == 0 */
        if (rc) {
-               trace_smb3_write_err(xid,
+               trace_smb3_write_err(wdata->rreq->debug_id,
+                                    wdata->subreq.debug_index,
+                                    xid,
                                     io_parms->persistent_fid,
                                     io_parms->tcon->tid,
                                     io_parms->tcon->ses->Suid,
@@ -5112,7 +5120,7 @@ replay_again:
                                offsetof(struct smb2_write_req, Buffer));
        req->RemainingBytes = 0;
 
-       trace_smb3_write_enter(xid, io_parms->persistent_fid,
+       trace_smb3_write_enter(0, 0, xid, io_parms->persistent_fid,
                io_parms->tcon->tid, io_parms->tcon->ses->Suid,
                io_parms->offset, io_parms->length);
 
@@ -5133,7 +5141,7 @@ replay_again:
        rsp = (struct smb2_write_rsp *)rsp_iov.iov_base;
 
        if (rc) {
-               trace_smb3_write_err(xid,
+               trace_smb3_write_err(0, 0, xid,
                                     req->PersistentFileId,
                                     io_parms->tcon->tid,
                                     io_parms->tcon->ses->Suid,
@@ -5142,7 +5150,7 @@ replay_again:
                cifs_dbg(VFS, "Send error in write = %d\n", rc);
        } else {
                *nbytes = le32_to_cpu(rsp->DataLength);
-               trace_smb3_write_done(xid,
+               trace_smb3_write_done(0, 0, xid,
                                      req->PersistentFileId,
                                      io_parms->tcon->tid,
                                      io_parms->tcon->ses->Suid,
index 8e9964001e2aeda3d11792b91571ec0328077dad..0b52d22a91a0cb059fc5ecaa785c6a7a317c7cea 100644 (file)
@@ -157,6 +157,7 @@ DEFINE_EVENT(smb3_rw_err_class, smb3_##name,    \
        TP_ARGS(rreq_debug_id, rreq_debug_index, xid, fid, tid, sesid, offset, len, rc))
 
 DEFINE_SMB3_RW_ERR_EVENT(read_err);
+DEFINE_SMB3_RW_ERR_EVENT(write_err);
 
 /* For logging errors in other file I/O ops */
 DECLARE_EVENT_CLASS(smb3_other_err_class,
@@ -202,7 +203,6 @@ DEFINE_EVENT(smb3_other_err_class, smb3_##name, \
                int     rc),                    \
        TP_ARGS(xid, fid, tid, sesid, offset, len, rc))
 
-DEFINE_SMB3_OTHER_ERR_EVENT(write_err);
 DEFINE_SMB3_OTHER_ERR_EVENT(query_dir_err);
 DEFINE_SMB3_OTHER_ERR_EVENT(zero_err);
 DEFINE_SMB3_OTHER_ERR_EVENT(falloc_err);
@@ -370,6 +370,8 @@ DEFINE_EVENT(smb3_rw_done_class, smb3_##name,   \
 
 DEFINE_SMB3_RW_DONE_EVENT(read_enter);
 DEFINE_SMB3_RW_DONE_EVENT(read_done);
+DEFINE_SMB3_RW_DONE_EVENT(write_enter);
+DEFINE_SMB3_RW_DONE_EVENT(write_done);
 
 /* For logging successful other op */
 DECLARE_EVENT_CLASS(smb3_other_done_class,
@@ -411,11 +413,9 @@ DEFINE_EVENT(smb3_other_done_class, smb3_##name,   \
                __u32   len),                   \
        TP_ARGS(xid, fid, tid, sesid, offset, len))
 
-DEFINE_SMB3_OTHER_DONE_EVENT(write_enter);
 DEFINE_SMB3_OTHER_DONE_EVENT(query_dir_enter);
 DEFINE_SMB3_OTHER_DONE_EVENT(zero_enter);
 DEFINE_SMB3_OTHER_DONE_EVENT(falloc_enter);
-DEFINE_SMB3_OTHER_DONE_EVENT(write_done);
 DEFINE_SMB3_OTHER_DONE_EVENT(query_dir_done);
 DEFINE_SMB3_OTHER_DONE_EVENT(zero_done);
 DEFINE_SMB3_OTHER_DONE_EVENT(falloc_done);