CIFS: Send as many mandatory unlock ranges at once as possible
that reduces a traffic and increases a performance. Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
This commit is contained in:

committed by
Steve French

parent
4f6bcec910
commit
9ee305b70e
@@ -2320,6 +2320,46 @@ CIFSSMBWrite2(const int xid, struct cifs_io_parms *io_parms,
|
||||
return rc;
|
||||
}
|
||||
|
||||
int cifs_lockv(const int xid, struct cifs_tcon *tcon, const __u16 netfid,
|
||||
const __u8 lock_type, const __u32 num_unlock,
|
||||
const __u32 num_lock, LOCKING_ANDX_RANGE *buf)
|
||||
{
|
||||
int rc = 0;
|
||||
LOCK_REQ *pSMB = NULL;
|
||||
struct kvec iov[2];
|
||||
int resp_buf_type;
|
||||
__u16 count;
|
||||
|
||||
cFYI(1, "cifs_lockv num lock %d num unlock %d", num_lock, num_unlock);
|
||||
|
||||
rc = small_smb_init(SMB_COM_LOCKING_ANDX, 8, tcon, (void **) &pSMB);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
pSMB->Timeout = 0;
|
||||
pSMB->NumberOfLocks = cpu_to_le16(num_lock);
|
||||
pSMB->NumberOfUnlocks = cpu_to_le16(num_unlock);
|
||||
pSMB->LockType = lock_type;
|
||||
pSMB->AndXCommand = 0xFF; /* none */
|
||||
pSMB->Fid = netfid; /* netfid stays le */
|
||||
|
||||
count = (num_unlock + num_lock) * sizeof(LOCKING_ANDX_RANGE);
|
||||
inc_rfc1001_len(pSMB, count);
|
||||
pSMB->ByteCount = cpu_to_le16(count);
|
||||
|
||||
iov[0].iov_base = (char *)pSMB;
|
||||
iov[0].iov_len = be32_to_cpu(pSMB->hdr.smb_buf_length) + 4 -
|
||||
(num_unlock + num_lock) * sizeof(LOCKING_ANDX_RANGE);
|
||||
iov[1].iov_base = (char *)buf;
|
||||
iov[1].iov_len = (num_unlock + num_lock) * sizeof(LOCKING_ANDX_RANGE);
|
||||
|
||||
cifs_stats_inc(&tcon->num_locks);
|
||||
rc = SendReceive2(xid, tcon->ses, iov, 2, &resp_buf_type, CIFS_NO_RESP);
|
||||
if (rc)
|
||||
cFYI(1, "Send error in cifs_lockv = %d", rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
CIFSSMBLock(const int xid, struct cifs_tcon *tcon,
|
||||
|
Reference in New Issue
Block a user