mirror of
https://github.com/torvalds/linux.git
synced 2026-06-09 15:12:59 +02:00
smb: server: make use of smbdirect_socket_set_logging()
This will allow the logging to keep working as before, when we move to common functions in the next commits. Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Steve French <smfrench@gmail.com> Cc: Tom Talpey <tom@talpey.com> Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Signed-off-by: Stefan Metzmacher <metze@samba.org> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
4624f1bf1b
commit
bbf3559afe
|
|
@ -126,6 +126,65 @@ struct smb_direct_transport {
|
|||
struct smbdirect_socket socket;
|
||||
};
|
||||
|
||||
static bool smb_direct_logging_needed(struct smbdirect_socket *sc,
|
||||
void *private_ptr,
|
||||
unsigned int lvl,
|
||||
unsigned int cls)
|
||||
{
|
||||
if (lvl <= SMBDIRECT_LOG_ERR)
|
||||
return true;
|
||||
|
||||
if (lvl > SMBDIRECT_LOG_INFO)
|
||||
return false;
|
||||
|
||||
switch (cls) {
|
||||
/*
|
||||
* These were more or less also logged before
|
||||
* the move to common code.
|
||||
*
|
||||
* SMBDIRECT_LOG_RDMA_MR was not used, but
|
||||
* that's client only code and we should
|
||||
* notice if it's used on the server...
|
||||
*/
|
||||
case SMBDIRECT_LOG_RDMA_EVENT:
|
||||
case SMBDIRECT_LOG_RDMA_SEND:
|
||||
case SMBDIRECT_LOG_RDMA_RECV:
|
||||
case SMBDIRECT_LOG_WRITE:
|
||||
case SMBDIRECT_LOG_READ:
|
||||
case SMBDIRECT_LOG_NEGOTIATE:
|
||||
case SMBDIRECT_LOG_OUTGOING:
|
||||
case SMBDIRECT_LOG_RDMA_RW:
|
||||
case SMBDIRECT_LOG_RDMA_MR:
|
||||
return true;
|
||||
/*
|
||||
* These were not logged before the move
|
||||
* to common code.
|
||||
*/
|
||||
case SMBDIRECT_LOG_KEEP_ALIVE:
|
||||
case SMBDIRECT_LOG_INCOMING:
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Log all unknown messages
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
static void smb_direct_logging_vaprintf(struct smbdirect_socket *sc,
|
||||
const char *func,
|
||||
unsigned int line,
|
||||
void *private_ptr,
|
||||
unsigned int lvl,
|
||||
unsigned int cls,
|
||||
struct va_format *vaf)
|
||||
{
|
||||
if (lvl <= SMBDIRECT_LOG_ERR)
|
||||
pr_err("%pV", vaf);
|
||||
else
|
||||
ksmbd_debug(RDMA, "%pV", vaf);
|
||||
}
|
||||
|
||||
#define KSMBD_TRANS(t) (&(t)->transport)
|
||||
#define SMBD_TRANS(t) (container_of(t, \
|
||||
struct smb_direct_transport, transport))
|
||||
|
|
@ -447,6 +506,9 @@ static struct smb_direct_transport *alloc_transport(struct rdma_cm_id *cm_id)
|
|||
return NULL;
|
||||
sc = &t->socket;
|
||||
smbdirect_socket_prepare_create(sc, sp, smb_direct_wq);
|
||||
smbdirect_socket_set_logging(sc, NULL,
|
||||
smb_direct_logging_needed,
|
||||
smb_direct_logging_vaprintf);
|
||||
/*
|
||||
* from here we operate on the copy.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user