CIFS: Extend credit mechanism to process request type

Split all requests to echos, oplocks and others - each group uses
its own credit slot. This is indicated by new flags

CIFS_ECHO_OP and CIFS_OBREAK_OP

that are not used now for CIFS. This change is required to support
SMB2 protocol because of different processing of these commands.

Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
This commit is contained in:
Pavel Shilovsky
2012-05-23 16:14:34 +04:00
committed by Steve French
parent 316cf94a91
commit a891f0f895
5 changed files with 74 additions and 49 deletions

View File

@@ -101,7 +101,8 @@ cifs_find_mid(struct TCP_Server_Info *server, char *buffer)
}
static void
cifs_add_credits(struct TCP_Server_Info *server, const unsigned int add)
cifs_add_credits(struct TCP_Server_Info *server, const unsigned int add,
const int optype)
{
spin_lock(&server->req_lock);
server->credits += add;
@@ -120,11 +121,17 @@ cifs_set_credits(struct TCP_Server_Info *server, const int val)
}
static int *
cifs_get_credits_field(struct TCP_Server_Info *server)
cifs_get_credits_field(struct TCP_Server_Info *server, const int optype)
{
return &server->credits;
}
static unsigned int
cifs_get_credits(struct mid_q_entry *mid)
{
return 1;
}
/*
* Find a free multiplex id (SMB mid). Otherwise there could be
* mid collisions which might cause problems, demultiplexing the
@@ -390,6 +397,7 @@ struct smb_version_operations smb1_operations = {
.add_credits = cifs_add_credits,
.set_credits = cifs_set_credits,
.get_credits_field = cifs_get_credits_field,
.get_credits = cifs_get_credits,
.get_next_mid = cifs_get_next_mid,
.read_data_offset = cifs_read_data_offset,
.read_data_length = cifs_read_data_length,