Re: [PATCH] add dynamic trace points for compounded query/setinfo paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



вт, 26 февр. 2019 г. в 22:06, Steve French <smfrench@xxxxxxxxx>:
>
> Add tracepoints for enter/exit (error or done without error)
> for compounded query_info and set_info
>
> Sample output (trace-cmd record -e smb3_*compound*):
>     touch-30074 [005] .... 33989.459514: smb3_set_info_compound_enter:
> xid=8 sid=0xbe534a7e tid=0x82c96a43
>     touch-30074 [005] .N.. 33989.471834: smb3_set_info_compound_done:
> xid=8 sid=0xbe534a7e tid=0x82c96a43
>     mkdir-30076 [007] .... 33999.239926:
> smb3_query_info_compound_enter: xid=10 sid=0xbe534a7e tid=0x82c96a43
>     mkdir-30076 [007] .... 33999.247180:
> smb3_query_info_compound_done: xid=10 sid=0xbe534a7e tid=0x82c96a43
>

 case SMB2_OP_RENAME:
  case SMB2_OP_RMDIR:
  case SMB2_OP_SET_EOF:
+ if (rqst[1].rq_iov)
+ SMB2_set_info_free(&rqst[1]);
+ if (rqst[2].rq_iov)
+ SMB2_close_free(&rqst[2]);
+ break;
  case SMB2_OP_SET_INFO:
  if (rqst[1].rq_iov)
  SMB2_set_info_free(&rqst[1]);
  if (rqst[2].rq_iov)
  SMB2_close_free(&rqst[2]);
+ if (rc)
+ trace_smb3_set_info_compound_err(xid, tcon->tid,
+    ses->Suid, rc);
+ else
+ trace_smb3_set_info_compound_done(xid, tcon->tid,
+    ses->Suid);
  break;
  }

This approach will require to duplicate code:

+ if (rqst[1].rq_iov)
+ SMB2_set_info_free(&rqst[1]);
+ if (rqst[2].rq_iov)
+ SMB2_close_free(&rqst[2]);
+ break;

for all set_info commands once we start tracing them.

How about to create a helper function for it? Something like:

  case SMB2_OP_RENAME:
  case SMB2_OP_RMDIR:
  case SMB2_OP_SET_EOF:
  case SMB2_OP_SET_INFO:
+    trace_set_info_compound(command, xid, tcon->tid, ses->Suid, rc);
      if (rqst[1].rq_iov)
          SMB2_set_info_free(&rqst[1]);
      if (rqst[2].rq_iov)
          SMB2_close_free(&rqst[2]);
      break;
  }

and when gradually add more trace points once we implement them.

void trace_set_info_compound(xid, tcon->tid, ses->Suid, rc)
{
    switch (command) {
/*
 * BB - add the following trace points:
 * case SMB2_OP_HARDLINK:
 * case SMB2_OP_RENAME:
 * case SMB2_OP_RMDIR:
 * case SMB2_OP_SET_EOF:
 */
    case SMB2_OP_SET_INFO:
          if (rc)
              trace_smb3_set_info_compound_err(xid, tcon->tid, ses->Suid, rc);
         else
              trace_smb3_set_info_compound_done(xid, tcon->tid, ses->Suid);
         break;
    }
}

--
Best regards,
Pavel Shilovsky




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux