OSDN Git Service

cifs: change SMB2_OP_SET_INFO to use compounding
authorRonnie Sahlberg <lsahlber@redhat.com>
Mon, 3 Sep 2018 03:33:48 +0000 (13:33 +1000)
committerSteve French <stfrench@microsoft.com>
Wed, 24 Oct 2018 02:16:04 +0000 (21:16 -0500)
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>
fs/cifs/smb2inode.c
fs/cifs/smb2pdu.c
fs/cifs/smb2proto.h

index e9794a2..007bd35 100644 (file)
@@ -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;
 }
index 8d2efca..29ed580 100644 (file)
@@ -3947,17 +3947,6 @@ SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
 }
 
 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,
                struct cifs_ntsd *pnntsd, int pacllen, int aclflag)
index 9367439..5881213 100644 (file)
@@ -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);