cifs: replace code with free_rsp_buf()
The functionality provided by free_rsp_buf() is duplicated in a number of places. Replace these instances with a call to free_rsp_buf(). Signed-off-by: Sachin Prabhu <sprabhu@redhat.com> Reviewed-by: Shirish Pargaonkar <spargaonkar@suse.com> Signed-off-by: Steve French <smfrench@gmail.com>
This commit is contained in:
parent
6f0928036b
commit
6d81ed1ec2
@ -36,6 +36,7 @@ extern struct smb_hdr *cifs_buf_get(void);
|
|||||||
extern void cifs_buf_release(void *);
|
extern void cifs_buf_release(void *);
|
||||||
extern struct smb_hdr *cifs_small_buf_get(void);
|
extern struct smb_hdr *cifs_small_buf_get(void);
|
||||||
extern void cifs_small_buf_release(void *);
|
extern void cifs_small_buf_release(void *);
|
||||||
|
extern void free_rsp_buf(int, void *);
|
||||||
extern void cifs_rqst_page_to_kvec(struct smb_rqst *rqst, unsigned int idx,
|
extern void cifs_rqst_page_to_kvec(struct smb_rqst *rqst, unsigned int idx,
|
||||||
struct kvec *iov);
|
struct kvec *iov);
|
||||||
extern int smb_send(struct TCP_Server_Info *, struct smb_hdr *,
|
extern int smb_send(struct TCP_Server_Info *, struct smb_hdr *,
|
||||||
|
@ -1734,10 +1734,7 @@ CIFSSMBRead(const unsigned int xid, struct cifs_io_parms *io_parms,
|
|||||||
|
|
||||||
/* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */
|
/* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */
|
||||||
if (*buf) {
|
if (*buf) {
|
||||||
if (resp_buf_type == CIFS_SMALL_BUFFER)
|
free_rsp_buf(resp_buf_type, iov[0].iov_base);
|
||||||
cifs_small_buf_release(iov[0].iov_base);
|
|
||||||
else if (resp_buf_type == CIFS_LARGE_BUFFER)
|
|
||||||
cifs_buf_release(iov[0].iov_base);
|
|
||||||
} else if (resp_buf_type != CIFS_NO_BUFFER) {
|
} else if (resp_buf_type != CIFS_NO_BUFFER) {
|
||||||
/* return buffer to caller to free */
|
/* return buffer to caller to free */
|
||||||
*buf = iov[0].iov_base;
|
*buf = iov[0].iov_base;
|
||||||
@ -2203,10 +2200,7 @@ CIFSSMBWrite2(const unsigned int xid, struct cifs_io_parms *io_parms,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */
|
/* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */
|
||||||
if (resp_buf_type == CIFS_SMALL_BUFFER)
|
free_rsp_buf(resp_buf_type, iov[0].iov_base);
|
||||||
cifs_small_buf_release(iov[0].iov_base);
|
|
||||||
else if (resp_buf_type == CIFS_LARGE_BUFFER)
|
|
||||||
cifs_buf_release(iov[0].iov_base);
|
|
||||||
|
|
||||||
/* Note: On -EAGAIN error only caller can retry on handle based calls
|
/* Note: On -EAGAIN error only caller can retry on handle based calls
|
||||||
since file handle passed in no longer valid */
|
since file handle passed in no longer valid */
|
||||||
@ -2451,10 +2445,7 @@ plk_err_exit:
|
|||||||
if (pSMB)
|
if (pSMB)
|
||||||
cifs_small_buf_release(pSMB);
|
cifs_small_buf_release(pSMB);
|
||||||
|
|
||||||
if (resp_buf_type == CIFS_SMALL_BUFFER)
|
free_rsp_buf(resp_buf_type, iov[0].iov_base);
|
||||||
cifs_small_buf_release(iov[0].iov_base);
|
|
||||||
else if (resp_buf_type == CIFS_LARGE_BUFFER)
|
|
||||||
cifs_buf_release(iov[0].iov_base);
|
|
||||||
|
|
||||||
/* Note: On -EAGAIN error only caller can retry on handle based calls
|
/* Note: On -EAGAIN error only caller can retry on handle based calls
|
||||||
since file handle passed in no longer valid */
|
since file handle passed in no longer valid */
|
||||||
@ -3838,10 +3829,7 @@ CIFSSMBGetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon, __u16 fid,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
qsec_out:
|
qsec_out:
|
||||||
if (buf_type == CIFS_SMALL_BUFFER)
|
free_rsp_buf(buf_type, iov[0].iov_base);
|
||||||
cifs_small_buf_release(iov[0].iov_base);
|
|
||||||
else if (buf_type == CIFS_LARGE_BUFFER)
|
|
||||||
cifs_buf_release(iov[0].iov_base);
|
|
||||||
/* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */
|
/* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -226,6 +226,15 @@ cifs_small_buf_release(void *buf_to_free)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
free_rsp_buf(int resp_buftype, void *rsp)
|
||||||
|
{
|
||||||
|
if (resp_buftype == CIFS_SMALL_BUFFER)
|
||||||
|
cifs_small_buf_release(rsp);
|
||||||
|
else if (resp_buftype == CIFS_LARGE_BUFFER)
|
||||||
|
cifs_buf_release(rsp);
|
||||||
|
}
|
||||||
|
|
||||||
/* NB: MID can not be set if treeCon not passed in, in that
|
/* NB: MID can not be set if treeCon not passed in, in that
|
||||||
case it is responsbility of caller to set the mid */
|
case it is responsbility of caller to set the mid */
|
||||||
void
|
void
|
||||||
|
@ -309,16 +309,6 @@ small_smb2_init(__le16 smb2_command, struct cifs_tcon *tcon,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
free_rsp_buf(int resp_buftype, void *rsp)
|
|
||||||
{
|
|
||||||
if (resp_buftype == CIFS_SMALL_BUFFER)
|
|
||||||
cifs_small_buf_release(rsp);
|
|
||||||
else if (resp_buftype == CIFS_LARGE_BUFFER)
|
|
||||||
cifs_buf_release(rsp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* SMB2 Worker functions follow:
|
* SMB2 Worker functions follow:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user