diff mbox series

[3/9] cifs: change unlink to use a compound

Message ID 20180820033920.31435-4-lsahlber@redhat.com (mailing list archive)
State New, archived
Headers show
Series [1/9] cifs: add a smb2_compound_op and change QUERY_INFO to use it | expand

Commit Message

Ronnie Sahlberg Aug. 20, 2018, 3:39 a.m. UTC
This,and previous patches, drops the number of roundtrips from five to two for
unlink()

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/smb2inode.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
index 5040e963d9e0..2a52b3370cee 100644
--- a/fs/cifs/smb2inode.c
+++ b/fs/cifs/smb2inode.c
@@ -105,6 +105,8 @@  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_DELETE:
+		break;
 	case SMB2_OP_MKDIR:
 		/*
 		 * Directories are created through parameters in the
@@ -146,6 +148,7 @@  smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
 		SMB2_query_info_free(&rqst[1]);
 		SMB2_close_free(&rqst[2]);
 		break;
+	case SMB2_OP_DELETE:
 	case SMB2_OP_MKDIR:
 		SMB2_close_free(&rqst[1]);
 		break;
@@ -199,8 +202,6 @@  smb2_open_op_close(const unsigned int xid, struct cifs_tcon *tcon,
 	}
 
 	switch (command) {
-	case SMB2_OP_DELETE:
-		break;
 	case SMB2_OP_RMDIR:
 		tmprc = SMB2_rmdir(xid, tcon, fid.persistent_fid,
 				   fid.volatile_fid);
@@ -327,9 +328,9 @@  int
 smb2_unlink(const unsigned int xid, struct cifs_tcon *tcon, const char *name,
 	    struct cifs_sb_info *cifs_sb)
 {
-	return smb2_open_op_close(xid, tcon, cifs_sb, name, DELETE, FILE_OPEN,
-				  CREATE_DELETE_ON_CLOSE | OPEN_REPARSE_POINT,
-				  NULL, SMB2_OP_DELETE);
+	return smb2_compound_op(xid, tcon, cifs_sb, name, DELETE, FILE_OPEN,
+				CREATE_DELETE_ON_CLOSE | OPEN_REPARSE_POINT,
+				NULL, SMB2_OP_DELETE);
 }
 
 static int