Skip to content

Commit 85633c0

Browse files
dhowellssmfrench
authored andcommitted
cifs: Make the write_{enter,done,err} tracepoints display netfs info
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 519be98 "cifs: Add a tracepoint to track credits involved in R/W requests"). Signed-off-by: David Howells <[email protected]> cc: Steve French <[email protected]> cc: Paulo Alcantara (Red Hat) <[email protected]> cc: Jeff Layton <[email protected]> cc: [email protected] cc: [email protected] cc: [email protected] Signed-off-by: Steve French <[email protected]>
1 parent 4f42a8b commit 85633c0

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

fs/smb/client/smb2pdu.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4866,15 +4866,19 @@ smb2_writev_callback(struct mid_q_entry *mid)
48664866
#endif
48674867
if (result) {
48684868
cifs_stats_fail_inc(tcon, SMB2_WRITE_HE);
4869-
trace_smb3_write_err(wdata->xid,
4869+
trace_smb3_write_err(wdata->rreq->debug_id,
4870+
wdata->subreq.debug_index,
4871+
wdata->xid,
48704872
wdata->req->cfile->fid.persistent_fid,
48714873
tcon->tid, tcon->ses->Suid, wdata->subreq.start,
48724874
wdata->subreq.len, wdata->result);
48734875
if (wdata->result == -ENOSPC)
48744876
pr_warn_once("Out of space writing to %s\n",
48754877
tcon->tree_name);
48764878
} else
4877-
trace_smb3_write_done(0 /* no xid */,
4879+
trace_smb3_write_done(wdata->rreq->debug_id,
4880+
wdata->subreq.debug_index,
4881+
wdata->xid,
48784882
wdata->req->cfile->fid.persistent_fid,
48794883
tcon->tid, tcon->ses->Suid,
48804884
wdata->subreq.start, wdata->subreq.len);
@@ -4952,7 +4956,9 @@ smb2_async_writev(struct cifs_io_subrequest *wdata)
49524956
offsetof(struct smb2_write_req, Buffer));
49534957
req->RemainingBytes = 0;
49544958

4955-
trace_smb3_write_enter(wdata->xid,
4959+
trace_smb3_write_enter(wdata->rreq->debug_id,
4960+
wdata->subreq.debug_index,
4961+
wdata->xid,
49564962
io_parms->persistent_fid,
49574963
io_parms->tcon->tid,
49584964
io_parms->tcon->ses->Suid,
@@ -5032,7 +5038,9 @@ smb2_async_writev(struct cifs_io_subrequest *wdata)
50325038
wdata, flags, &wdata->credits);
50335039
/* Can't touch wdata if rc == 0 */
50345040
if (rc) {
5035-
trace_smb3_write_err(xid,
5041+
trace_smb3_write_err(wdata->rreq->debug_id,
5042+
wdata->subreq.debug_index,
5043+
xid,
50365044
io_parms->persistent_fid,
50375045
io_parms->tcon->tid,
50385046
io_parms->tcon->ses->Suid,
@@ -5112,7 +5120,7 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
51125120
offsetof(struct smb2_write_req, Buffer));
51135121
req->RemainingBytes = 0;
51145122

5115-
trace_smb3_write_enter(xid, io_parms->persistent_fid,
5123+
trace_smb3_write_enter(0, 0, xid, io_parms->persistent_fid,
51165124
io_parms->tcon->tid, io_parms->tcon->ses->Suid,
51175125
io_parms->offset, io_parms->length);
51185126

@@ -5133,7 +5141,7 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
51335141
rsp = (struct smb2_write_rsp *)rsp_iov.iov_base;
51345142

51355143
if (rc) {
5136-
trace_smb3_write_err(xid,
5144+
trace_smb3_write_err(0, 0, xid,
51375145
req->PersistentFileId,
51385146
io_parms->tcon->tid,
51395147
io_parms->tcon->ses->Suid,
@@ -5142,7 +5150,7 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
51425150
cifs_dbg(VFS, "Send error in write = %d\n", rc);
51435151
} else {
51445152
*nbytes = le32_to_cpu(rsp->DataLength);
5145-
trace_smb3_write_done(xid,
5153+
trace_smb3_write_done(0, 0, xid,
51465154
req->PersistentFileId,
51475155
io_parms->tcon->tid,
51485156
io_parms->tcon->ses->Suid,

fs/smb/client/trace.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ DEFINE_EVENT(smb3_rw_err_class, smb3_##name, \
157157
TP_ARGS(rreq_debug_id, rreq_debug_index, xid, fid, tid, sesid, offset, len, rc))
158158

159159
DEFINE_SMB3_RW_ERR_EVENT(read_err);
160+
DEFINE_SMB3_RW_ERR_EVENT(write_err);
160161

161162
/* For logging errors in other file I/O ops */
162163
DECLARE_EVENT_CLASS(smb3_other_err_class,
@@ -202,7 +203,6 @@ DEFINE_EVENT(smb3_other_err_class, smb3_##name, \
202203
int rc), \
203204
TP_ARGS(xid, fid, tid, sesid, offset, len, rc))
204205

205-
DEFINE_SMB3_OTHER_ERR_EVENT(write_err);
206206
DEFINE_SMB3_OTHER_ERR_EVENT(query_dir_err);
207207
DEFINE_SMB3_OTHER_ERR_EVENT(zero_err);
208208
DEFINE_SMB3_OTHER_ERR_EVENT(falloc_err);
@@ -370,6 +370,8 @@ DEFINE_EVENT(smb3_rw_done_class, smb3_##name, \
370370

371371
DEFINE_SMB3_RW_DONE_EVENT(read_enter);
372372
DEFINE_SMB3_RW_DONE_EVENT(read_done);
373+
DEFINE_SMB3_RW_DONE_EVENT(write_enter);
374+
DEFINE_SMB3_RW_DONE_EVENT(write_done);
373375

374376
/* For logging successful other op */
375377
DECLARE_EVENT_CLASS(smb3_other_done_class,
@@ -411,11 +413,9 @@ DEFINE_EVENT(smb3_other_done_class, smb3_##name, \
411413
__u32 len), \
412414
TP_ARGS(xid, fid, tid, sesid, offset, len))
413415

414-
DEFINE_SMB3_OTHER_DONE_EVENT(write_enter);
415416
DEFINE_SMB3_OTHER_DONE_EVENT(query_dir_enter);
416417
DEFINE_SMB3_OTHER_DONE_EVENT(zero_enter);
417418
DEFINE_SMB3_OTHER_DONE_EVENT(falloc_enter);
418-
DEFINE_SMB3_OTHER_DONE_EVENT(write_done);
419419
DEFINE_SMB3_OTHER_DONE_EVENT(query_dir_done);
420420
DEFINE_SMB3_OTHER_DONE_EVENT(zero_done);
421421
DEFINE_SMB3_OTHER_DONE_EVENT(falloc_done);

0 commit comments

Comments
 (0)