浏览代码

[CIFS] Reduce CIFS tcp congestion timeout (it was too long) and backoff
ever longer amounts (up to 15 seconds). This improves performance
especially when using large wsize.

Signed-off-by: Steve French (sfrench@us.ibm.com)

Steve French 20 年之前
父节点
当前提交
68058e7575
共有 3 个文件被更改,包括 22 次插入11 次删除
  1. 2 2
      fs/cifs/cifs_debug.c
  2. 13 3
      fs/cifs/cifsfs.c
  3. 7 6
      fs/cifs/transport.c

+ 2 - 2
fs/cifs/cifs_debug.c

@@ -114,7 +114,7 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
 				atomic_read(&ses->server->inFlight));
 				atomic_read(&ses->server->inFlight));
 
 
 #ifdef CONFIG_CIFS_STATS2
 #ifdef CONFIG_CIFS_STATS2
-			buf += sprintf(buf, "\tIn Send: %d In MaxReq Wait: %d",
+			buf += sprintf(buf, " In Send: %d In MaxReq Wait: %d",
 				atomic_read(&ses->server->inSend), 
 				atomic_read(&ses->server->inSend), 
 				atomic_read(&ses->server->num_waiters));
 				atomic_read(&ses->server->num_waiters));
 #endif
 #endif
@@ -267,7 +267,7 @@ cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
 			atomic_read(&tcon->num_oplock_brks));
 			atomic_read(&tcon->num_oplock_brks));
 		buf += item_length;
 		buf += item_length;
 		length += item_length;
 		length += item_length;
-		item_length = sprintf(buf, "\nReads: %d Bytes %lld",
+		item_length = sprintf(buf, "\nReads:  %d Bytes %lld",
 			atomic_read(&tcon->num_reads),
 			atomic_read(&tcon->num_reads),
 			(long long)(tcon->bytes_read));
 			(long long)(tcon->bytes_read));
 		buf += item_length;
 		buf += item_length;

+ 13 - 3
fs/cifs/cifsfs.c

@@ -405,6 +405,16 @@ static struct quotactl_ops cifs_quotactl_ops = {
 };
 };
 #endif
 #endif
 
 
+static void cifs_umount_begin(struct super_block * sblock)
+{
+	cERROR(1,("kill all tasks now - umount begin not implemented yet"));
+
+/* BB FIXME - finish BB */
+
+	return;
+}
+	
+
 static int cifs_remount(struct super_block *sb, int *flags, char *data)
 static int cifs_remount(struct super_block *sb, int *flags, char *data)
 {
 {
 	*flags |= MS_NODIRATIME;
 	*flags |= MS_NODIRATIME;
@@ -422,7 +432,7 @@ struct super_operations cifs_super_ops = {
    unless later we add lazy close of inodes or unless the kernel forgets to call
    unless later we add lazy close of inodes or unless the kernel forgets to call
    us with the same number of releases (closes) as opens */
    us with the same number of releases (closes) as opens */
 	.show_options = cifs_show_options,
 	.show_options = cifs_show_options,
-/*    .umount_begin   = cifs_umount_begin, *//* consider adding in the future */
+/*	.umount_begin   = cifs_umount_begin, */ /* BB finish in the future */
 	.remount_fs = cifs_remount,
 	.remount_fs = cifs_remount,
 };
 };
 
 
@@ -790,9 +800,7 @@ static int cifs_oplock_thread(void * dummyarg)
 	do {
 	do {
 		if(try_to_freeze()) 
 		if(try_to_freeze()) 
 			continue;
 			continue;
-		set_current_state(TASK_INTERRUPTIBLE);
 		
 		
-		schedule_timeout(1*HZ);  
 		spin_lock(&GlobalMid_Lock);
 		spin_lock(&GlobalMid_Lock);
 		if(list_empty(&GlobalOplock_Q)) {
 		if(list_empty(&GlobalOplock_Q)) {
 			spin_unlock(&GlobalMid_Lock);
 			spin_unlock(&GlobalMid_Lock);
@@ -841,6 +849,8 @@ static int cifs_oplock_thread(void * dummyarg)
 				}
 				}
 			} else
 			} else
 				spin_unlock(&GlobalMid_Lock);
 				spin_unlock(&GlobalMid_Lock);
+			set_current_state(TASK_INTERRUPTIBLE);
+			schedule_timeout(1);  /* yield in case q were corrupt */
 		}
 		}
 	} while(!signal_pending(current));
 	} while(!signal_pending(current));
 	oplockThread = NULL;
 	oplockThread = NULL;

+ 7 - 6
fs/cifs/transport.c

@@ -157,14 +157,14 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
 		/* smaller timeout here than send2 since smaller size */
 		/* smaller timeout here than send2 since smaller size */
 		/* Although it may not be required, this also is smaller 
 		/* Although it may not be required, this also is smaller 
 		   oplock break time */  
 		   oplock break time */  
-			if(i > 30) {
+			if(i > 12) {
 				cERROR(1,
 				cERROR(1,
-				   ("sends on sock %p stuck for 15 seconds",
+				   ("sends on sock %p stuck for 7 seconds",
 				    ssocket));
 				    ssocket));
 				rc = -EAGAIN;
 				rc = -EAGAIN;
 				break;
 				break;
 			}
 			}
-			msleep(500);
+			msleep(1 << i);
 			continue;
 			continue;
 		}
 		}
 		if (rc < 0) 
 		if (rc < 0) 
@@ -224,14 +224,14 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
 				    n_vec - first_vec, total_len);
 				    n_vec - first_vec, total_len);
 		if ((rc == -ENOSPC) || (rc == -EAGAIN)) {
 		if ((rc == -ENOSPC) || (rc == -EAGAIN)) {
 			i++;
 			i++;
-			if(i > 40) {
+			if(i >= 14) {
 				cERROR(1,
 				cERROR(1,
-				   ("sends on sock %p stuck for 20 seconds",
+				   ("sends on sock %p stuck for 15 seconds",
 				    ssocket));
 				    ssocket));
 				rc = -EAGAIN;
 				rc = -EAGAIN;
 				break;
 				break;
 			}
 			}
-			msleep(500);
+			msleep(1 << i);
 			continue;
 			continue;
 		}
 		}
 		if (rc < 0) 
 		if (rc < 0) 
@@ -249,6 +249,7 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
 			continue;
 			continue;
 		}
 		}
 		total_len -= rc;
 		total_len -= rc;
+		/* the line below resets i */
 		for (i = first_vec; i < n_vec; i++) {
 		for (i = first_vec; i < n_vec; i++) {
 			if (iov[i].iov_len) {
 			if (iov[i].iov_len) {
 				if (rc > iov[i].iov_len) {
 				if (rc > iov[i].iov_len) {