mirror of https://gitee.com/openkylin/linux.git
cifs: change SMB2_OP_SET_INFO to use compounding
Cuts number of network roundtrips significantly for some common syscalls Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
f7bfe04bf0
commit
dcbf910357
|
@ -147,6 +147,21 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
|
|||
smb2_set_next_command(server, &rqst[num_rqst]);
|
||||
smb2_set_related(&rqst[num_rqst++]);
|
||||
break;
|
||||
case SMB2_OP_SET_INFO:
|
||||
memset(&si_iov, 0, sizeof(si_iov));
|
||||
rqst[num_rqst].rq_iov = si_iov;
|
||||
rqst[num_rqst].rq_nvec = 1;
|
||||
|
||||
size[0] = sizeof(FILE_BASIC_INFO);
|
||||
data[0] = ptr;
|
||||
|
||||
rc = SMB2_set_info_init(tcon, &rqst[num_rqst], COMPOUND_FID,
|
||||
COMPOUND_FID, current->tgid,
|
||||
FILE_BASIC_INFORMATION,
|
||||
SMB2_O_INFO_FILE, 0, data, size);
|
||||
smb2_set_next_command(server, &rqst[num_rqst]);
|
||||
smb2_set_related(&rqst[num_rqst++]);
|
||||
break;
|
||||
default:
|
||||
cifs_dbg(VFS, "Invalid command\n");
|
||||
rc = -EINVAL;
|
||||
|
@ -190,8 +205,9 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
|
|||
if (rqst[1].rq_iov)
|
||||
SMB2_close_free(&rqst[1]);
|
||||
break;
|
||||
case SMB2_OP_SET_EOF:
|
||||
case SMB2_OP_RMDIR:
|
||||
case SMB2_OP_SET_EOF:
|
||||
case SMB2_OP_SET_INFO:
|
||||
if (rqst[1].rq_iov)
|
||||
SMB2_set_info_free(&rqst[1]);
|
||||
if (rqst[2].rq_iov)
|
||||
|
@ -255,11 +271,6 @@ smb2_open_op_close(const unsigned int xid, struct cifs_tcon *tcon,
|
|||
tmprc = SMB2_set_hardlink(xid, tcon, fid.persistent_fid,
|
||||
fid.volatile_fid, (__le16 *)data);
|
||||
break;
|
||||
case SMB2_OP_SET_INFO:
|
||||
tmprc = SMB2_set_basic_info(xid, tcon, fid.persistent_fid,
|
||||
fid.volatile_fid,
|
||||
(FILE_BASIC_INFO *)data);
|
||||
break;
|
||||
default:
|
||||
cifs_dbg(VFS, "Invalid command\n");
|
||||
break;
|
||||
|
@ -344,9 +355,9 @@ smb2_mkdir_setinfo(struct inode *inode, const char *name,
|
|||
cifs_i = CIFS_I(inode);
|
||||
dosattrs = cifs_i->cifsAttrs | ATTR_READONLY;
|
||||
data.Attributes = cpu_to_le32(dosattrs);
|
||||
tmprc = smb2_open_op_close(xid, tcon, cifs_sb, name,
|
||||
FILE_WRITE_ATTRIBUTES, FILE_CREATE,
|
||||
CREATE_NOT_FILE, &data, SMB2_OP_SET_INFO);
|
||||
tmprc = smb2_compound_op(xid, tcon, cifs_sb, name,
|
||||
FILE_WRITE_ATTRIBUTES, FILE_CREATE,
|
||||
CREATE_NOT_FILE, &data, SMB2_OP_SET_INFO);
|
||||
if (tmprc == 0)
|
||||
cifs_i->cifsAttrs = dosattrs;
|
||||
}
|
||||
|
@ -437,9 +448,9 @@ smb2_set_file_info(struct inode *inode, const char *full_path,
|
|||
if (IS_ERR(tlink))
|
||||
return PTR_ERR(tlink);
|
||||
|
||||
rc = smb2_open_op_close(xid, tlink_tcon(tlink), cifs_sb, full_path,
|
||||
FILE_WRITE_ATTRIBUTES, FILE_OPEN, 0, buf,
|
||||
SMB2_OP_SET_INFO);
|
||||
rc = smb2_compound_op(xid, tlink_tcon(tlink), cifs_sb, full_path,
|
||||
FILE_WRITE_ATTRIBUTES, FILE_OPEN, 0, buf,
|
||||
SMB2_OP_SET_INFO);
|
||||
cifs_put_tlink(tlink);
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -3946,17 +3946,6 @@ SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
|
|||
0, 1, &data, &size);
|
||||
}
|
||||
|
||||
int
|
||||
SMB2_set_basic_info(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
u64 persistent_fid, u64 volatile_fid, FILE_BASIC_INFO *buf)
|
||||
{
|
||||
unsigned int size;
|
||||
size = sizeof(FILE_BASIC_INFO);
|
||||
return send_set_info(xid, tcon, persistent_fid, volatile_fid,
|
||||
current->tgid, FILE_BASIC_INFORMATION, SMB2_O_INFO_FILE,
|
||||
0, 1, (void **)&buf, &size);
|
||||
}
|
||||
|
||||
int
|
||||
SMB2_set_acl(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
u64 persistent_fid, u64 volatile_fid,
|
||||
|
|
|
@ -196,9 +196,6 @@ extern int SMB2_set_info_init(struct cifs_tcon *tcon, struct smb_rqst *rqst,
|
|||
u8 info_class, u8 info_type, u32 additional_info,
|
||||
void **data, unsigned int *size);
|
||||
extern void SMB2_set_info_free(struct smb_rqst *rqst);
|
||||
extern int SMB2_set_basic_info(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
u64 persistent_fid, u64 volatile_fid,
|
||||
FILE_BASIC_INFO *buf);
|
||||
extern int SMB2_set_acl(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
u64 persistent_fid, u64 volatile_fid,
|
||||
struct cifs_ntsd *pnntsd, int pacllen, int aclflag);
|
||||
|
|
Loading…
Reference in New Issue