CIFS: Introduce credit-based flow control
and send no more than credits value requests at once. For SMB/CIFS it's trivial: increment this value by receiving any message and decrement by sending one. Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:

committed by
Steve French

parent
fc40f9cf82
commit
2d86dbc970
@@ -690,3 +690,22 @@ backup_cred(struct cifs_sb_info *cifs_sb)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
cifs_add_credits(struct TCP_Server_Info *server, const unsigned int add)
|
||||
{
|
||||
spin_lock(&server->req_lock);
|
||||
server->credits += add;
|
||||
server->in_flight--;
|
||||
spin_unlock(&server->req_lock);
|
||||
wake_up(&server->request_q);
|
||||
}
|
||||
|
||||
void
|
||||
cifs_set_credits(struct TCP_Server_Info *server, const int val)
|
||||
{
|
||||
spin_lock(&server->req_lock);
|
||||
server->credits = val;
|
||||
server->oplocks = val > 1 ? enable_oplocks : false;
|
||||
spin_unlock(&server->req_lock);
|
||||
}
|
||||
|
Reference in New Issue
Block a user